diff options
author | krakjoe <joe.watkins@live.co.uk> | 2014-01-13 08:12:49 +0000 |
---|---|---|
committer | krakjoe <joe.watkins@live.co.uk> | 2014-01-13 08:12:49 +0000 |
commit | 9add0e9f5ce19e9e19a0ca341cbd92c74b35bfcc (patch) | |
tree | e8a2d5e459b9b7211ed47f84109c0eaf03bf7f66 /phpdbg_cmd.c | |
parent | 333264fdb718f337fb19d208e3d41aeef31f2ca1 (diff) | |
download | php-git-9add0e9f5ce19e9e19a0ca341cbd92c74b35bfcc.tar.gz |
Revert "fix #46 ignore EOF"
This reverts commit 333264fdb718f337fb19d208e3d41aeef31f2ca1.
Diffstat (limited to 'phpdbg_cmd.c')
-rw-r--r-- | phpdbg_cmd.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index 501d0b8bf6..9f052d6f6f 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -467,43 +467,32 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */ } if (buffered == NULL) { -disconnect: - if (0) { - PHPDBG_G(flags) |= (PHPDBG_IS_QUITTING|PHPDBG_IS_DISCONNECTED); - zend_bailout(); - return NULL; - } - #ifndef HAVE_LIBREADLINE char buf[PHPDBG_MAX_CMD]; - if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { - if (!phpdbg_write(phpdbg_get_prompt(TSRMLS_CC))) { - goto disconnect; - } - } - - /* note: EOF is ignored */ -readline: - if (!fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) { + if ((!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE) && !phpdbg_write(phpdbg_get_prompt(TSRMLS_C))) || + !fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) { /* the user has gone away */ - if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { - goto disconnect; - } else goto readline; + phpdbg_error("Failed to read console!"); + PHPDBG_G(flags) |= (PHPDBG_IS_QUITTING|PHPDBG_IS_DISCONNECTED); + zend_bailout(); + return NULL; } cmd = buf; #else - /* note: EOF makes readline write prompt again in local console mode */ -readline: if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { char buf[PHPDBG_MAX_CMD]; if (fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) { cmd = buf; - } else goto disconnect; + } else cmd = NULL; } else cmd = readline(phpdbg_get_prompt(TSRMLS_C)); if (!cmd) { - goto readline; + /* the user has gone away */ + phpdbg_error("Failed to read console!"); + PHPDBG_G(flags) |= (PHPDBG_IS_QUITTING|PHPDBG_IS_DISCONNECTED); + zend_bailout(); + return NULL; } if (!(PHPDBG_G(flags) & PHPDBG_IS_REMOTE)) { |