Changeset 10019
- Timestamp:
- 11/23/14 15:14:44 (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-webif.c
r10000 r10019 5489 5489 char system_str[256]; 5490 5490 struct stat s; 5491 snprintf(system_str, 256, "%s/%s", cfg.http_script, scriptname);5491 snprintf(system_str, sizeof(system_str), "%s/%s", cfg.http_script, scriptname); 5492 5492 5493 5493 if(!stat(system_str,&s)) … … 5497 5497 if(s.st_mode & S_IXUSR) 5498 5498 { 5499 int32_t rc = 0; 5500 rc = system(system_str); 5501 if(rc == 0){ 5502 result = "done";} 5503 else{ 5504 result = "failed";} 5499 int8_t rc; 5500 FILE *fp; 5501 char buf[256]; 5502 fp = popen(system_str,"r"); 5503 5504 while (fgets(buf, sizeof(buf), fp) != NULL) { 5505 tpl_addVar(vars, TPLAPPEND, "SCRIPTRESULTOUT", buf); 5506 } 5507 5508 rc = WEXITSTATUS(pclose(fp)); 5509 5505 5510 tpl_printf(vars, TPLAPPEND, "CODE", "returncode: %d", rc); 5506 5511 tpl_printf(vars, TPLADD, "SCRIPTNAME", "scriptname: %s", scriptname); 5507 tpl_printf(vars, TPLADD, "SCRIPTRESULT", "scriptresult: %s", result); 5508 } 5512 } 5509 5513 else 5510 5514 { -
trunk/webif/script/script.html
r9618 r10019 12 12 </select> 13 13 </DIV> 14 <P ID="filesubmit">##SCRIPTNAME## ##SCRIPTRESULT## ##CODE##</P> 14 <P ID="filesubmit">##SCRIPTNAME##</P> 15 <P ID="filesubmit">##CODE##</P> 16 <textarea name="filecontent" class="editor">##SCRIPTRESULTOUT##</textarea> 15 17 ##TPLFOOTER##
Note:
See TracChangeset
for help on using the changeset viewer.