diff options
author | phk <phk@FreeBSD.org> | 1995-11-26 21:08:36 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-11-26 21:08:36 +0000 |
commit | 3533369fb8d96cc896623f9ae5dce31e50b0a066 (patch) | |
tree | 5737e587077ee2f51313b7d7dee87ae9fbe14017 /usr.bin/tip | |
parent | 6416fe008a59fa4eed3abbb0b7abbefe85f5d204 (diff) | |
download | FreeBSD-src-3533369fb8d96cc896623f9ae5dce31e50b0a066.zip FreeBSD-src-3533369fb8d96cc896623f9ae5dce31e50b0a066.tar.gz |
Make tip recognize EOF in more cases.
Diffstat (limited to 'usr.bin/tip')
-rw-r--r-- | usr.bin/tip/tip/tip.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/usr.bin/tip/tip/tip.c b/usr.bin/tip/tip/tip.c index 3482d00..b50f4c3 100644 --- a/usr.bin/tip/tip/tip.c +++ b/usr.bin/tip/tip/tip.c @@ -398,6 +398,7 @@ intprompt() */ tipin() { + int i; char gch, bol = 1; /* @@ -413,7 +414,10 @@ tipin() } while (1) { - gch = getchar()&0177; + i = getchar(); + if (i == EOF) + break; + gch = i&0177; if ((gch == character(value(ESCAPE))) && bol) { if (!(gch = escape())) continue; @@ -426,8 +430,12 @@ tipin() if (boolean(value(HALFDUPLEX))) printf("\r\n"); continue; - } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()&0177; + } else if (!cumode && gch == character(value(FORCE))) { + i = getchar(); + if (i == EOF) + break; + gch = i & 0177; + } bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -448,8 +456,12 @@ escape() register char gch; register esctable_t *p; char c = character(value(ESCAPE)); + int i; - gch = (getchar()&0177); + i = getchar(); + if (i == EOF) + return 0; + gch = (i&0177); for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) @@ -636,8 +648,7 @@ pwrite(fd, buf, n) tipabort("Lost carrier."); if (errno == ENODEV) tipabort("tty not available."); - /* this is questionable */ - perror("write"); + tipabort("Something wrong..."); } } |