projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more careful about clobbering the supposed newline at the end of the string
[unix-history]
/
usr
/
src
/
usr.bin
/
mail
/
tty.c
diff --git
a/usr/src/usr.bin/mail/tty.c
b/usr/src/usr.bin/mail/tty.c
index
a5e9a51
..
20f6d36
100644
(file)
--- a/
usr/src/usr.bin/mail/tty.c
+++ b/
usr/src/usr.bin/mail/tty.c
@@
-9,7
+9,7
@@
#include "rcv.h"
#include <sgtty.h>
#include "rcv.h"
#include <sgtty.h>
-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 */
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;
ioctl(0, TIOCSTI, &c);
}
cp = canonb;
+ *cp = 0;
#endif
cp2 = fgets(cp, BUFSIZ - (cp - canonb), stdin);
#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);
#ifndef TIOCSTI
if (cp2 == NOSTR || *cp2 == '\0')
return(src);