From: <ama...@us...> - 2003-08-05 06:19:32
|
Update of /cvsroot/binaryphp/binaryphp/functions/exec In directory sc8-pr-cvs1:/tmp/cvs-serv4995/functions/exec Added Files: passthru.cpp shell_exec.cpp Log Message: finished cleaning up the functions dir --- NEW FILE: passthru.cpp --- php_var passthru(php_var str) { int i; i = system ((char *)str); if(i == -1) { return (php_var) 0; } else { return (php_var) 1; } } --- NEW FILE: shell_exec.cpp --- php_var shell_exec(php_var cmd) { FILE *fp = popen(cmd, "r"); if(fp == NULL) { return (php_var) 0; } string returner; char * buf = (char *) malloc(1024); while(!feof(fp)) { fread(buf, 1, 1023, fp); returner += buf; } pclose(fp); return (php_var) returner; } |