com php-src: Fix issue krakjoe/phpdbg#97 - list now appends a newline if there is none The prompt should always ensure it is on a newline:
phpdbg_list.c

From: Date: Sun, 29 Jun 2014 10:18:39 +0000
Subject: com php-src: Fix issue krakjoe/phpdbg#97 - list now appends a newline if there is none The prompt should always ensure it is on a newline:
phpdbg_list.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-79118@lists.php.net to get a copy of this message
Commit: 4fde0c258ea3c094a421563deadbaa7811c67950 Author: Bob Weinand <bobwei9@hotmail.com> Sun, 29 Jun 2014 12:18:39 +0200 Parents: d29842532397233a0a9419962426965063ad376d Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4fde0c258ea3c094a421563deadbaa7811c67950 Log: Fix issue krakjoe/phpdbg#97 - list now appends a newline if there is none The prompt should always ensure it is on a newline Bugs: https://bugs.php.net/97 Changed paths: M phpdbg_list.c Diff: diff --git a/phpdbg_list.c b/phpdbg_list..c index 037c6c3..c745222 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -130,7 +130,7 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig char *opened = NULL; char buffer[8096] = {0,}; long line = 0; - + php_stream *stream = NULL; if (VCWD_STAT(filename, &st) == FAILURE) { @@ -146,6 +146,8 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig } while (php_stream_gets(stream, buffer, sizeof(buffer)) != NULL) { + long linelen = strlen(buffer); + ++line; if (!offset || offset <= line) { @@ -159,9 +161,13 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig phpdbg_write(">%05ld: %s", line, buffer); } } + + if (buffer[linelen - 1] != '\n') { + phpdbg_write("\n"); + } } - - if ((count + (offset-1)) == line) + + if ((count + (offset - 1)) == line) break; }

« previous php.cvs (#79118) next »