diff options
| author | tgoodwin <tgoodwin> | 1998-02-11 14:04:49 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:02 +0100 |
| commit | 37d2cf03f1f15f57432d3d4fb0c3c451438afdb0 (patch) | |
| tree | 08c497ec516bf3012d8d209674b1f3da0d853e8e | |
| parent | 034adee7e777b3f841eebed9fe827689721847c9 (diff) | |
fix prompting for readline
| -rw-r--r-- | input.c | 20 | ||||
| -rw-r--r-- | lex.c | 10 | ||||
| -rw-r--r-- | rc.h | 2 |
3 files changed, 18 insertions, 14 deletions
@@ -280,10 +280,11 @@ extern Node *doit(bool execit) { } if ((s = varlookup("prompt")) != NULL) { #if READLINE - prompt = s->w; -#else - fprint(2, "%s", s->w); + if (istack->fd == 0) + prompt = s->w; + else #endif + fprint(2, "%s", s->w); prompt2 = (s->n == NULL ? "" : s->n->w); } } @@ -361,3 +362,16 @@ extern void closefds() { i->fd = -1; } } + +extern void print_prompt2() { + lineno++; + if (interactive) { +#if READLINE + if (istack->fd == 0) + prompt = prompt2; + else +#endif + fprint(2, "%s", prompt2); + } +} + @@ -336,16 +336,6 @@ extern void inityy() { realbuf = ealloc(bufsize); } -extern void print_prompt2() { - lineno++; -#if READLINE - prompt = prompt2; -#else - if (interactive) - fprint(2, "%s", prompt2); -#endif -} - /* Scan in a pair of integers for redirections like >[2=1]. CLOSED represents a closed file descriptor (i.e., >[2=]) and UNSET represents an undesignated file descriptor (e.g., @@ -300,6 +300,7 @@ extern int gchar(void); extern void ugchar(int); extern Node *doit(bool); extern void flushu(void); +extern void print_prompt2(void); extern void pushfd(int); extern void pushstring(char **, bool); extern void popinput(void); @@ -312,7 +313,6 @@ extern int yylex(void); extern void inityy(void); extern void yyerror(const char *); extern void scanerror(char *); -extern void print_prompt2(void); extern const char nw[], dnw[]; /* list.c */ |