com php-src: Fix readline/libedit (Thanks to @remicollet): config.m4 phpdbg.h phpdbg_btree.c phpdbg_btree.h phpdbg_cmd .c phpdbg_prompt.c
phpdbg_utils.c

From: Date: Sun, 29 Jun 2014 09:26:03 +0000
Subject: com php-src: Fix readline/libedit (Thanks to @remicollet): config.m4 phpdbg.h phpdbg_btree.c phpdbg_btree.h phpdbg_cmd .c phpdbg_prompt.c
phpdbg_utils.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79123@lists.php.net to get a copy of this message
Commit: 219beac36b9e421fd9a4920f214e9c63747eaafb Author: Bob Weinand <bobwei9@hotmail.com> Sun, 29 Jun 2014 11:26:03 +0200 Parents: 858b45d4ad86a9d1ec857e20cf8c8e33c15500c0 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=219beac36b9e421fd9a4920f214e9c63747eaafb Log: Fix readline/libedit (Thanks to @remicollet) Changed paths: M config.m4 M phpdbg.h M phpdbg_btree.c M phpdbg_btree.h M phpdbg_cmd.c M phpdbg_prompt.c M phpdbg_utils.c Diff: diff --git a/config.m4 b/config.m4 index 1a6640e..d78a439 100644 --- a/config.m4 +++ b/config.m4 @@ -21,7 +21,7 @@ if test "$PHP_PHPDBG" != "no"; then PHP_PHPDBG_CFLAGS="-D_GNU_SOURCE" PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd..c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c" - if test "$PHP_READLINE" != "no"; then + if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" != "no"; then PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS" fi diff --git a/phpdbg.h b/phpdbg.h index 12350d5..2fa2d50 100644 --- a/phpdbg.h +++ b/phpdbg.h @@ -68,6 +68,9 @@ # include <readline/readline.h> # include <readline/history.h> #endif +#ifdef HAVE_LIBEDIT +# include <editline/readline.h> +#endif #include "phpdbg_lexer.h" #include "phpdbg_cmd.h" diff --git a/phpdbg_btree.c b/phpdbg_btree.c index 8fc2561..4914453 100644 --- a/phpdbg_btree.c +++ b/phpdbg_btree.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/phpdbg_btree.h b/phpdbg_btree.h index 5fb217d..af2a6ac 100644 --- a/phpdbg_btree.h +++ b/phpdbg_btree.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index d4ce8eb..a45513b 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -792,7 +792,7 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why TSRMLS_DC) PHPDBG_API char* phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */ { char *cmd = NULL; -#ifndef HAVE_LIBREADLINE +#if !defined(HAVE_LIBREADLINE) && !defined(HAVE_LIBEDIT) char buf[PHPDBG_MAX_CMD]; #endif char *buffer = NULL; @@ -811,7 +811,7 @@ disconnect: return NULL; } -#ifndef HAVE_LIBREADLINE +#if !defined(HAVE_LIBREADLINE) && !defined(HAVE_LIBEDIT) if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { if (!phpdbg_write("%s", phpdbg_get_prompt(TSRMLS_C))) { goto disconnect; @@ -850,7 +850,7 @@ readline: buffer = estrdup(cmd); -#ifdef HAVE_LIBREADLINE +#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) if (!buffered && cmd && !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { free(cmd); diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 5379e77..d91ef3f 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -732,6 +732,11 @@ PHPDBG_COMMAND(print) /* {{{ */ #else phpdbg_writeln("Readline\tno"); #endif +#ifdef HAVE_LIBEDIT + phpdbg_writeln("Libedit\t\tyes"); +#else + phpdbg_writeln("Libedit\t\tno"); +#endif phpdbg_writeln("Exec\t\t%s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none"); phpdbg_writeln("Compiled\t%s", PHPDBG_G(ops) ? "yes" : "no"); diff --git a/phpdbg_utils.c b/phpdbg_utils.c index 98748b2..3ce2fad 100644 --- a/phpdbg_utils.c +++ b/phpdbg_utils.c @@ -400,12 +400,16 @@ PHPDBG_API const char *phpdbg_get_prompt(TSRMLS_D) /* {{{ */ } /* create cached prompt */ +#ifndef HAVE_LIBEDIT + /* TODO: libedit doesn't seems to support coloured prompt */ if ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED)) { asprintf( &PHPDBG_G(prompt)[1], "\033[%sm%s\033[0m ", PHPDBG_G(colors)[PHPDBG_COLOR_PROMPT]->code, PHPDBG_G(prompt)[0]); - } else { + } else +#endif + { asprintf( &PHPDBG_G(prompt)[1], "%s ", PHPDBG_G(prompt)[0]);

« previous php.cvs (#79123) next »