From 419b1e014f9b2508a14d93e3c86b5aeab4f67513 Mon Sep 17 00:00:00 2001 From: "Kurt A. Schoens" Date: Tue, 3 Mar 1981 03:46:54 -0800 Subject: [PATCH] more careful about clobbering the supposed newline at the end of the string when reading in a header line; careful to clear string initially when using the enhanced tty driver to avoid picking up a ghost from previous header SCCS-vsn: usr.bin/mail/tty.c 1.2 --- usr/src/usr.bin/mail/tty.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr/src/usr.bin/mail/tty.c b/usr/src/usr.bin/mail/tty.c index a5e9a51daa..20f6d3676b 100644 --- a/usr/src/usr.bin/mail/tty.c +++ b/usr/src/usr.bin/mail/tty.c @@ -9,7 +9,7 @@ #include "rcv.h" #include -static char *SccsId = "@(#)tty.c 1.1 %G%"; +static char *SccsId = "@(#)tty.c 1.2 %G%"; static int c_erase; /* Current erase char */ static int c_kill; /* Current kill char */ @@ -131,9 +131,12 @@ readtty(pr, src) ioctl(0, TIOCSTI, &c); } cp = canonb; + *cp = 0; #endif cp2 = fgets(cp, BUFSIZ - (cp - canonb), stdin); - canonb[strlen(canonb) - 1] = '\0'; + cp = index(canonb, '\n'); + if (cp != NOSTR) + *cp = 0; #ifndef TIOCSTI if (cp2 == NOSTR || *cp2 == '\0') return(src); -- 2.20.1