Lines Matching refs:cmd
93 PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value) in php_exec() argument
111 fp = VCWD_POPEN(cmd, "rb"); in php_exec()
113 fp = VCWD_POPEN(cmd, "r"); in php_exec()
116 php_error_docref(NULL, E_WARNING, "Unable to fork [%s]", cmd); in php_exec()
207 char *cmd; in php_exec_ex() local
213 if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/", &cmd, &cmd_len, &ret_code) == FAILURE) { in php_exec_ex()
217 …if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z/z/", &cmd, &cmd_len, &ret_array, &ret_code) == FAI… in php_exec_ex()
225 if (strlen(cmd) != cmd_len) { in php_exec_ex()
231 ret = php_exec(mode, cmd, NULL, return_value); in php_exec_ex()
237 ret = php_exec(2, cmd, ret_array, return_value); in php_exec_ex()
284 zend_string *cmd; in php_escape_shell_cmd() local
295 cmd = zend_string_safe_alloc(2, l, 0, 0); in php_escape_shell_cmd()
304 memcpy(ZSTR_VAL(cmd) + y, str + x, mb_len); in php_escape_shell_cmd()
319 ZSTR_VAL(cmd)[y++] = '\\'; in php_escape_shell_cmd() local
321 ZSTR_VAL(cmd)[y++] = str[x]; in php_escape_shell_cmd() local
354 ZSTR_VAL(cmd)[y++] = '^'; in php_escape_shell_cmd() local
356 ZSTR_VAL(cmd)[y++] = '\\'; in php_escape_shell_cmd() local
360 ZSTR_VAL(cmd)[y++] = str[x]; in php_escape_shell_cmd()
364 ZSTR_VAL(cmd)[y] = '\0'; in php_escape_shell_cmd() local
368 zend_string_release(cmd); in php_escape_shell_cmd()
375 cmd = zend_string_truncate(cmd, y, 0); in php_escape_shell_cmd()
378 ZSTR_LEN(cmd) = y; in php_escape_shell_cmd()
380 return cmd; in php_escape_shell_cmd()
390 zend_string *cmd; in php_escape_shell_arg() local
399 cmd = zend_string_safe_alloc(4, l, 2, 0); /* worst case */ in php_escape_shell_arg()
402 ZSTR_VAL(cmd)[y++] = '"'; in php_escape_shell_arg() local
404 ZSTR_VAL(cmd)[y++] = '\''; in php_escape_shell_arg() local
414 memcpy(ZSTR_VAL(cmd) + y, str + x, mb_len); in php_escape_shell_arg()
425 ZSTR_VAL(cmd)[y++] = ' '; in php_escape_shell_arg() local
429 ZSTR_VAL(cmd)[y++] = '\''; in php_escape_shell_arg()
430 ZSTR_VAL(cmd)[y++] = '\\'; in php_escape_shell_arg()
431 ZSTR_VAL(cmd)[y++] = '\''; in php_escape_shell_arg()
435 ZSTR_VAL(cmd)[y++] = str[x]; in php_escape_shell_arg()
439 if (y > 0 && '\\' == ZSTR_VAL(cmd)[y - 1]) { in php_escape_shell_arg()
441 for (; n >= 0 && '\\' == ZSTR_VAL(cmd)[n]; n--, k++); in php_escape_shell_arg()
443 ZSTR_VAL(cmd)[y++] = '\\'; in php_escape_shell_arg() local
447 ZSTR_VAL(cmd)[y++] = '"'; in php_escape_shell_arg() local
449 ZSTR_VAL(cmd)[y++] = '\''; in php_escape_shell_arg() local
451 ZSTR_VAL(cmd)[y] = '\0'; in php_escape_shell_arg() local
455 zend_string_release(cmd); in php_escape_shell_arg()
462 cmd = zend_string_truncate(cmd, y, 0); in php_escape_shell_arg()
464 ZSTR_LEN(cmd) = y; in php_escape_shell_arg()
465 return cmd; in php_escape_shell_arg()