com php-src: non readline fixes: phpdbg_help.c phpdbg_p rint.c phpdbg_prompt.c phpdbg_utils.c phpdbg_ utils.h
| From: | Bob Weinand | Date: | Wed, 13 Nov 2013 08:05:26 +0000 |
| Subject: | com php-src: non readline fixes: phpdbg_help.c phpdbg_p rint.c phpdbg_prompt.c phpdbg_utils.c phpdbg_ utils.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75026@lists.php.net to get a copy of this message | ||
Commit: 5e266f34fc4b45be6ee04749d62bb379bef2c692
Author: krakjoe <joe.watkins@live.co.uk> Wed, 13 Nov 2013 08:05:26 +0000
Parents: b6c4fbee1b4e0fbfea56d335142a917b40b42a25
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5e266f34fc4b45be6ee04749d62bb379bef2c692
Log:
non readline fixes
Changed paths:
M phpdbg_help.c
M phpdbg_print.c
M phpdbg_prompt.c
M phpdbg_utils.c
M phpdbg_utils.h
Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 78d12c8..c337ec9 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -67,8 +67,12 @@ PHPDBG_HELP(print) /* {{{ */
phpdbg_writeln("Examples:");
phpdbg_writeln("\t%sprint class \\my\\class", PROMPT);
phpdbg_writeln("Will print information about \\my\\class, including the instructions for
every method and their address");
+ phpdbg_writeln("\t%sprint method \\my\\class::method", PROMPT);
+ phpdbg_writeln("Will print the instructions for \\my\\class::method");
phpdbg_writeln("\t%sprint func .getSomething", PROMPT);
phpdbg_writeln("Will print the instructions for the method getSomething in the currently
active scope");
+ phpdbg_writeln("\t%sprint func my_function", PROMPT);
+ phpdbg_writeln("Will print the instructions for the global function my_function");
phpdbg_writeln("\t%sprint opline", PROMPT);
phpdbg_writeln("Will print the instruction for the current opline");
phpdbg_writeln(EMPTY);
diff --git a/phpdbg_print.c b/phpdbg_print.c
index 1524ec5..600d8f2 100644
--- a/phpdbg_print.c
+++ b/phpdbg_print.c
@@ -146,6 +146,8 @@ PHPDBG_PRINT(method) /* {{{ */
} else {
phpdbg_error("The method %s could not be found", func_name);
}
+ } else {
+ phpdbg_error("Failed to find the requested class %s", class_name);
}
efree(class_name);
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 60982a9..85c5345 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -208,8 +208,7 @@ static PHPDBG_COMMAND(back) /* {{{ */
static PHPDBG_COMMAND(print) /* {{{ */
{
if (expr && expr_len > 0L) {
- if (phpdbg_print_commands &&
- phpdbg_do_cmd(phpdbg_print_commands, (char*)expr, expr_len TSRMLS_CC) == FAILURE) {
+ if (phpdbg_do_cmd(phpdbg_print_commands, (char*)expr, expr_len TSRMLS_CC) == FAILURE) {
phpdbg_error("Failed to find print command %s", expr);
}
return SUCCESS;
@@ -569,7 +568,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */
/* ensure string is null terminated */
cmd[cmd_len] = '\0';
- if (cmd && cmd_len > 0L) {
+ if (*cmd && cmd_len > 0L) {
#ifdef HAVE_LIBREADLINE
add_history(cmd);
#endif
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index df37df0..4fff467 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -71,8 +71,9 @@ int phpdbg_is_class_method(const char *str, size_t len, char **class, char **met
return 1;
} /* }}} */
-void phpdbg_print(int type TSRMLS_DC, const char *format, ...) /* {{{ */
+int phpdbg_print(int type TSRMLS_DC, const char *format, ...) /* {{{ */
{
+ int rc = 0;
char *buffer = NULL;
va_list args;
@@ -86,39 +87,41 @@ void phpdbg_print(int type TSRMLS_DC, const char *format, ...) /* {{{ */
switch (type) {
case ERROR:
- printf("%s%s%s\n",
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;31m[" : "["),
- buffer,
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]"));
+ rc = printf("%s%s%s\n",
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;31m[" : "["),
+ buffer,
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]"));
break;
case NOTICE:
- printf("%s%s%s\n",
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64m[" : "["),
- buffer,
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]"));
+ rc = printf("%s%s%s\n",
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64m[" : "["),
+ buffer,
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]"));
break;
case WRITELN: {
if (buffer) {
- printf("%s%s%s\n",
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[37m" : ""),
- buffer,
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[0m" : ""));
+ rc = printf("%s%s%s\n",
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[37m" : ""),
+ buffer,
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[0m" : ""));
} else {
- printf("\n");
+ rc = printf("\n");
}
} break;
case WRITE: if (buffer) {
- printf("%s%s%s",
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[37m" : ""),
- buffer,
- ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[0m" : ""));
+ rc = printf("%s%s%s",
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[37m" : ""),
+ buffer,
+ ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[0m" : ""));
} break;
}
if (buffer) {
efree(buffer);
}
+
+ return rc;
} /* }}} */
diff --git a/phpdbg_utils.h b/phpdbg_utils.h
index 7682201..b45342d 100644
--- a/phpdbg_utils.h
+++ b/phpdbg_utils.h
@@ -38,7 +38,7 @@ enum {
WRITE
};
-void phpdbg_print(int TSRMLS_DC, const char*, ...);
+int phpdbg_print(int TSRMLS_DC, const char*, ...);
#define phpdbg_error(fmt, ...) phpdbg_print(ERROR TSRMLS_CC, fmt, ##__VA_ARGS__)
#define phpdbg_notice(fmt, ...) phpdbg_print(NOTICE TSRMLS_CC, fmt, ##__VA_ARGS__)