diff --git a/src/lisp/lisp.c b/src/lisp/lisp.c index 0bd6aff1c491bb7ac10ce1fed898efc808bc54f3..d719c8df7cc55c221b76cd98f63f9a495cb196ce 100644 --- a/src/lisp/lisp.c +++ b/src/lisp/lisp.c @@ -33,10 +33,8 @@ #include "save.h" #include "lispregs.h" #if defined(FEATURE_EXECUTABLE) -#if !defined(DARWIN) #include "elf.h" #endif -#endif #ifdef __linux__ #include <sys/utsname.h> diff --git a/src/lisp/monitor.c b/src/lisp/monitor.c index 806e503c67e902c2a4b83b00a963de849e6c75a1..64e44f52f1c2bf2028507095b618a5a368d42eef 100644 --- a/src/lisp/monitor.c +++ b/src/lisp/monitor.c @@ -312,12 +312,14 @@ static void quit(char **ptr) { char buf[10]; + char *result; printf("Really quit? [y] "); fflush(stdout); - fgets(buf, sizeof(buf), stdin); - if (buf[0] == 'y' || buf[0] == 'Y' || buf[0] == '\n') + result = fgets(buf, sizeof(buf), stdin); + if (result && (buf[0] == 'y' || buf[0] == 'Y' || buf[0] == '\n')) { exit(0); + } } static void @@ -467,7 +469,14 @@ sub_monitor(void) if (line == NULL) { if (isatty(0)) { putchar('\n'); - continue; + /* + * We can no longer read anything from stdin, so + * just exit this loop instead of spewing an + * endless stream of prompts. This also means we + * can't use ldb anymore because stdin is + * unreadable. + */ + break; } else { fprintf(stderr, "\nEOF on something other than a tty.\n"); exit(1); diff --git a/src/lisp/print.c b/src/lisp/print.c index cdf4b56bf21c4c647bf0471c3d1eef7db9fc80ff..9f8fa10b9841e8d7d7907e6c5984f5b038d7b993 100644 --- a/src/lisp/print.c +++ b/src/lisp/print.c @@ -154,12 +154,13 @@ continue_p(boolean newline) putchar('\n'); if (cur_lines >= max_lines) { + char *result; printf("More? [y] "); fflush(stdout); - fgets(buffer, sizeof(buffer), stdin); + result = fgets(buffer, sizeof(buffer), stdin); - if (buffer[0] == 'n' || buffer[0] == 'N') + if (result == NULL || buffer[0] == 'n' || buffer[0] == 'N') throw_to_monitor(); else cur_lines = 0;