rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 37d2cf03f1f15f57432d3d4fb0c3c451438afdb0
parent 034adee7e777b3f841eebed9fe827689721847c9
Author: tgoodwin <tgoodwin>
Date:   Wed, 11 Feb 1998 14:04:49 +0000

fix prompting for readline

Diffstat:
Minput.c | 20+++++++++++++++++---
Mlex.c | 10----------
Mrc.h | 2+-
3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/input.c b/input.c @@ -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); + } +} + diff --git a/lex.c b/lex.c @@ -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., diff --git a/rc.h b/rc.h @@ -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 */