@@ -467,43 +467,32 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
467
467
}
468
468
469
469
if (buffered == NULL ) {
470
- disconnect :
471
- if (0 ) {
472
- PHPDBG_G (flags ) |= (PHPDBG_IS_QUITTING |PHPDBG_IS_DISCONNECTED );
473
- zend_bailout ();
474
- return NULL ;
475
- }
476
-
477
470
#ifndef HAVE_LIBREADLINE
478
471
char buf [PHPDBG_MAX_CMD ];
479
- if (!(PHPDBG_G (flags ) & PHPDBG_IS_REMOTE )) {
480
- if (!phpdbg_write (phpdbg_get_prompt (TSRMLS_CC ))) {
481
- goto disconnect ;
482
- }
483
- }
484
-
485
- /* note: EOF is ignored */
486
- readline :
487
- if (!fgets (buf , PHPDBG_MAX_CMD , PHPDBG_G (io )[PHPDBG_STDIN ])) {
472
+ if ((!(PHPDBG_G (flags ) & PHPDBG_IS_REMOTE ) && !phpdbg_write (phpdbg_get_prompt (TSRMLS_C ))) ||
473
+ !fgets (buf , PHPDBG_MAX_CMD , PHPDBG_G (io )[PHPDBG_STDIN ])) {
488
474
/* the user has gone away */
489
- if ((PHPDBG_G (flags ) & PHPDBG_IS_REMOTE )) {
490
- goto disconnect ;
491
- } else goto readline ;
475
+ phpdbg_error ("Failed to read console!" );
476
+ PHPDBG_G (flags ) |= (PHPDBG_IS_QUITTING |PHPDBG_IS_DISCONNECTED );
477
+ zend_bailout ();
478
+ return NULL ;
492
479
}
493
480
494
481
cmd = buf ;
495
482
#else
496
- /* note: EOF makes readline write prompt again in local console mode */
497
- readline :
498
483
if ((PHPDBG_G (flags ) & PHPDBG_IS_REMOTE )) {
499
484
char buf [PHPDBG_MAX_CMD ];
500
485
if (fgets (buf , PHPDBG_MAX_CMD , PHPDBG_G (io )[PHPDBG_STDIN ])) {
501
486
cmd = buf ;
502
- } else goto disconnect ;
487
+ } else cmd = NULL ;
503
488
} else cmd = readline (phpdbg_get_prompt (TSRMLS_C ));
504
489
505
490
if (!cmd ) {
506
- goto readline ;
491
+ /* the user has gone away */
492
+ phpdbg_error ("Failed to read console!" );
493
+ PHPDBG_G (flags ) |= (PHPDBG_IS_QUITTING |PHPDBG_IS_DISCONNECTED );
494
+ zend_bailout ();
495
+ return NULL ;
507
496
}
508
497
509
498
if (!(PHPDBG_G (flags ) & PHPDBG_IS_REMOTE )) {
0 commit comments