X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fterminal%2Fterminal-reader.c;h=0a1337d4ea0f3f8448a3f44df1524c7604825af6;hb=259b5c32c06fd93964720f4a0e7844b5a24c55db;hp=141474a95bb9f77d18b5178403127cd8c2e5cbe9;hpb=25e76c9c37c623a3eced22d23a60befb0067de68;p=pspp diff --git a/src/ui/terminal/terminal-reader.c b/src/ui/terminal/terminal-reader.c index 141474a95b..0a1337d4ea 100644 --- a/src/ui/terminal/terminal-reader.c +++ b/src/ui/terminal/terminal-reader.c @@ -38,7 +38,6 @@ static const bool have_readline = true; #else static const bool have_readline = false; -static int rl_end; #endif @@ -127,7 +126,7 @@ rl_echo_signal_char (int sig) if (0 == tcgetattr (0, &t)) { cc_t c = t.c_cc[VINTR]; - + if (c >= 0 && c <= 'Z' - 'A') fprintf (rl_outstream, "^%c", 'A' + c - 1); else @@ -138,7 +137,7 @@ rl_echo_signal_char (int sig) fprintf (rl_outstream, "^C"); fflush (rl_outstream); -} +} #endif #endif @@ -251,12 +250,12 @@ readline_prompt (enum prompt_style style) } +#if HAVE_READLINE static int pfd[2]; static bool sigint_received ; - -/* +/* A function similar to getc from stdio. However this one may be interrupted by SIGINT. If that happens it will return EOF and the global variable @@ -306,11 +305,7 @@ interruptible_getc (FILE *fp) return c; } - - -#if HAVE_READLINE - -static void +static void handler (int sig) { rl_end = 0; @@ -354,7 +349,7 @@ readline_done (void) free (history_file); } -/* Prompt the user for a line of input and return it in LINE. +/* Prompt the user for a line of input and return it in LINE. Returns true if the LINE should be considered valid, false otherwise. */ static bool @@ -454,9 +449,9 @@ readline_read (struct substring *line, enum prompt_style style) fflush (stdout); ds_init_empty (&string); ds_read_line (&string, stdin, SIZE_MAX); - + *line = string.ss; - + return false; } #endif /* !HAVE_READLINE */