static PHPDBG_COMMAND(exec) /* {{{ */
{
- switch (param->type) {
- case STR_PARAM: {
- struct stat sb;
-
- if (VCWD_STAT(param->str, &sb) != FAILURE) {
- if (sb.st_mode & (S_IFREG|S_IFLNK)) {
- if (PHPDBG_G(exec)) {
- phpdbg_notice("Unsetting old execution context: %s", PHPDBG_G(exec));
- efree(PHPDBG_G(exec));
- PHPDBG_G(exec) = NULL;
- }
-
- if (PHPDBG_G(ops)) {
- phpdbg_notice("Destroying compiled opcodes");
- phpdbg_clean(0 TSRMLS_CC);
- }
-
- PHPDBG_G(exec) = phpdbg_resolve_path(param->str TSRMLS_CC);
-
- if (!PHPDBG_G(exec)) {
- phpdbg_error("Cannot get real file path");
- return SUCCESS;
- }
-
- PHPDBG_G(exec_len) = strlen(PHPDBG_G(exec));
-
- phpdbg_notice("Set execution context: %s", PHPDBG_G(exec));
-
- } else {
- phpdbg_error("Cannot use %s as execution context, not a valid file or symlink", param->str);
- }
- } else {
- phpdbg_error("Cannot stat %s, ensure the file exists", param->str);
- }
- } break;
-
- phpdbg_default_switch_case();
- }
+ switch (param->type) {
+ case STR_PARAM: {
+ struct stat sb;
+
+ if (VCWD_STAT(param->str, &sb) != FAILURE) {
- if (sb.st_mode & S_IFREG|S_IFLNK) {
++ if (sb.st_mode & (S_IFREG|S_IFLNK)) {
+ if (PHPDBG_G(exec)) {
+ phpdbg_notice("Unsetting old execution context: %s", PHPDBG_G(exec));
+ efree(PHPDBG_G(exec));
+ PHPDBG_G(exec) = NULL;
+ }
+
+ if (PHPDBG_G(ops)) {
+ phpdbg_notice("Destroying compiled opcodes");
+ phpdbg_clean(0 TSRMLS_CC);
+ }
+
+ PHPDBG_G(exec) = phpdbg_resolve_path(param->str TSRMLS_CC);
+
+ if (!PHPDBG_G(exec)) {
+ phpdbg_error("Cannot get real file path");
+ return SUCCESS;
+ }
+
+ PHPDBG_G(exec_len) = strlen(PHPDBG_G(exec));
+
+ phpdbg_notice("Set execution context: %s", PHPDBG_G(exec));
+
+ } else {
+ phpdbg_error("Cannot use %s as execution context, not a valid file or symlink", param->str);
+ }
+ } else {
+ phpdbg_error("Cannot stat %s, ensure the file exists", param->str);
+ }
+ } break;
+
+ phpdbg_default_switch_case();
+ }
return SUCCESS;
} /* }}} */
#endif
size_t expr_len = (cmd != NULL) ? strlen(cmd) : 0;
- phpdbg_param_t *param = NULL;
+ phpdbg_param_t *param = NULL;
while (command && command->name && command->handler) {
-- if ((command->name_len == expr_len
- && memcmp(cmd, command->name, expr_len) == 0)
- || (expr_len == 1 && command->alias && command->alias == cmd_line[0])) {
- && memcmp(cmd, command->name, expr_len) == 0)
- || ((expr_len == 1) && (command->alias && command->alias == cmd_line[0]))) {
++ if ((command->name_len == expr_len && memcmp(cmd, command->name, expr_len) == 0)
++ || (expr_len == 1 && command->alias && command->alias == cmd_line[0])) {
- param = emalloc(sizeof(phpdbg_param_t));
+ param = emalloc(sizeof(phpdbg_param_t));
PHPDBG_G(last) = (phpdbg_command_t*) command;
- /* urm ... */
- if (PHPDBG_G(lparam)) {
- //phpdbg_clear_param(
- // PHPDBG_G(lparam) TSRMLS_CC);
- //efree(PHPDBG_G(lparam));
- }
+ /* urm ... */
+ if (PHPDBG_G(lparam)) {
+ //phpdbg_clear_param(
+ // PHPDBG_G(lparam) TSRMLS_CC);
+ //efree(PHPDBG_G(lparam));
+ }
- phpdbg_parse_param(
- expr,
- (cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
- param TSRMLS_CC);
+ phpdbg_parse_param(
+ expr,
+ (cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
+ param TSRMLS_CC);
- PHPDBG_G(lparam) = param;
+ PHPDBG_G(lparam) = param;
- if (command->subs && param->type == STR_PARAM) {
- if (phpdbg_do_cmd(command->subs, selected, param->str, param->len TSRMLS_CC) == SUCCESS) {
- rc = SUCCESS;
- /* because we can */
- phpdbg_clear_param(param TSRMLS_CC);
- efree(param);
- goto done;
- }
- }
- if (command->subs && (param->type == STR_PARAM)) {
++ if (command->subs && param->type == STR_PARAM) {
+ if (phpdbg_do_cmd(command->subs, selected, param->str, param->len TSRMLS_CC) == SUCCESS) {
+ rc = SUCCESS;
+ /* because we can */
+ phpdbg_clear_param(param TSRMLS_CC);
+ efree(param);
+ goto done;
+ }
+ }
- *selected = (phpdbg_command_t*) command;
+ *selected = (phpdbg_command_t*) command;
rc = command->handler(param TSRMLS_CC);