summaryrefslogtreecommitdiff
path: root/usr.bin/tip
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1995-11-26 21:08:36 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1995-11-26 21:08:36 +0000
commitdc22f7a98e42a7f768bc5f19ff70eac208e0c2dc (patch)
tree5737e587077ee2f51313b7d7dee87ae9fbe14017 /usr.bin/tip
parent84478e7f42962b1bbbfbfa42ffbd24f194e8cdc2 (diff)
Notes
Diffstat (limited to 'usr.bin/tip')
-rw-r--r--usr.bin/tip/tip/tip.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/usr.bin/tip/tip/tip.c b/usr.bin/tip/tip/tip.c
index 3482d003b5fb..b50f4c3a29db 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...");
}
}