summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortjg <tjg>2000-04-19 14:16:51 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:17 +0100
commit643d8f677a0554e323078b4d75171010dc5a612f (patch)
tree3db4bdd0b19ffff7654c4d881c4b2943c13383cb
parenta19078db3265138bbd50200fbadeaec16b8a27ee (diff)
2000-04-19
Bug: isatty() tests in input.c are relevant to any fd, not just 0. Now `. -i /dev/tty' works right.
-rw-r--r--input.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/input.c b/input.c
index 8daa6e2..f59f29e 100644
--- a/input.c
+++ b/input.c
@@ -94,7 +94,7 @@ static int fdgchar() {
if (chars_out >= chars_in + 2) { /* has the buffer been exhausted? if so, replenish it */
while (1) {
#if EDITLINE || READLINE
- if (interactive && istack->fd == 0 && isatty(0)) {
+ if (interactive && istack->t == iFd && isatty(istack->fd)) {
/* The readline library doesn't handle read() returning EAGAIN. */
makeblocking(istack->fd);
rlinebuf = rc_readline(prompt);
@@ -266,7 +266,7 @@ extern Node *doit(bool clobberexecit) {
}
if ((s = varlookup("prompt")) != NULL) {
#if EDITLINE || READLINE
- if (istack->t == iFd && istack->fd == 0 && isatty(0))
+ if (istack->t == iFd && isatty(istack->fd))
prompt = s->w;
else
#endif
@@ -353,7 +353,7 @@ extern void print_prompt2() {
lineno++;
if (interactive) {
#if EDITLINE || READLINE
- if (istack->t == iFd && istack->fd == 0 && isatty(0))
+ if (istack->t == iFd && isatty(istack->fd))
prompt = prompt2;
else
#endif