diff options
| author | tgoodwin <tgoodwin> | 1998-02-27 17:26:03 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:05 +0100 |
| commit | 18487b02b48a57c5d331bfb417feef451501cb51 (patch) | |
| tree | af390a00d2b9162cbe7271c1d4e9fcbd95bad799 /input.c | |
| parent | f5dde44eee092602bee6df746043abc6fcfec38f (diff) | |
next attempt to get readline interaction correct
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 32 |
1 files changed, 6 insertions, 26 deletions
@@ -2,7 +2,6 @@ #include <errno.h> #include <setjmp.h> -#include <signal.h> #include "rc.h" #include "jbwrap.h" @@ -22,29 +21,6 @@ typedef struct Input { #define BUFSIZE ((size_t) 256) -#if READLINE -extern void add_history(char *); -extern char *readline(char *); - -static char *rlinebuf, *prompt; -bool in_readline; - -static char *rc_readline(char *prompt) { - char *r; - void (*old)(int); - - in_readline = TRUE; - old = signal(SIGINT, sigint); - r = readline(prompt); - signal(SIGINT, old); - in_readline = FALSE; - sigchk(); - - return r; -} - -#endif - static char *prompt2; bool rcrc; @@ -65,6 +41,10 @@ static void (*realugchar)(int); int last; +#if READLINE +static char *rlinebuf, *prompt; +#endif + extern int gchar() { int c; @@ -133,8 +113,8 @@ static int fdgchar() { #endif /* There is a possible problem here. POSIX allows read() interrupted -by a signal to return -1 and set errno == EINTR *even if data have -successfully been read*. (They are also allowed to do the Right Thing, +by a signal to return -1 and set errno == EINTR *even if some data have +successfully been read*. (It is also allowed to do the Right Thing, and return a count of the partial read.) If you have such a broken system, you lose. */ { |