diff options
author | peter <peter@FreeBSD.org> | 1996-08-19 20:23:35 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-08-19 20:23:35 +0000 |
commit | d093c7b48e95c00d2fcbc70970b1e99c1a5712b7 (patch) | |
tree | 2f7a1aed406bea4049bb1f4e000e564c5c306112 /usr.bin/mail/tty.c | |
parent | 65b6e7181bc8bde1918c94186c38543764663453 (diff) | |
download | FreeBSD-src-d093c7b48e95c00d2fcbc70970b1e99c1a5712b7.zip FreeBSD-src-d093c7b48e95c00d2fcbc70970b1e99c1a5712b7.tar.gz |
Simplistic conversion of mail to use termios instead of sgtty.
Diffstat (limited to 'usr.bin/mail/tty.c')
-rw-r--r-- | usr.bin/mail/tty.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/mail/tty.c b/usr.bin/mail/tty.c index b39eba5..53cb456 100644 --- a/usr.bin/mail/tty.c +++ b/usr.bin/mail/tty.c @@ -61,7 +61,7 @@ grabh(hp, gflags) struct header *hp; int gflags; { - struct sgttyb ttybuf; + struct termios tio; sig_t saveint; #ifndef TIOCSTI sig_t savequit; @@ -79,15 +79,15 @@ grabh(hp, gflags) #ifndef TIOCSTI ttyset = 0; #endif - if (ioctl(fileno(stdin), TIOCGETP, &ttybuf) < 0) { - perror("gtty"); + if (tcgetattr(fileno(stdin), &tio) < 0) { + perror("tcgetattr(stdin)"); return(-1); } - c_erase = ttybuf.sg_erase; - c_kill = ttybuf.sg_kill; + c_erase = tio.c_cc[VERASE]; + c_kill = tio.c_cc[VKILL]; #ifndef TIOCSTI - ttybuf.sg_erase = 0; - ttybuf.sg_kill = 0; + tio.c_cc[VERASE] = 0; + tio.c_cc[VKILL] = 0; if ((saveint = signal(SIGINT, SIG_IGN)) == SIG_DFL) signal(SIGINT, SIG_DFL); if ((savequit = signal(SIGQUIT, SIG_IGN)) == SIG_DFL) @@ -100,7 +100,7 @@ grabh(hp, gflags) if (gflags & GTO) { #ifndef TIOCSTI if (!ttyset && hp->h_to != NIL) - ttyset++, stty(fileno(stdin), &ttybuf); + ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &tio); #endif hp->h_to = extract(readtty("To: ", detract(hp->h_to, 0)), GTO); @@ -108,14 +108,14 @@ grabh(hp, gflags) if (gflags & GSUBJECT) { #ifndef TIOCSTI if (!ttyset && hp->h_subject != NOSTR) - ttyset++, stty(fileno(stdin), &ttybuf); + ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &tio); #endif hp->h_subject = readtty("Subject: ", hp->h_subject); } if (gflags & GCC) { #ifndef TIOCSTI if (!ttyset && hp->h_cc != NIL) - ttyset++, stty(fileno(stdin), &ttybuf); + ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &tio); #endif hp->h_cc = extract(readtty("Cc: ", detract(hp->h_cc, 0)), GCC); @@ -123,7 +123,7 @@ grabh(hp, gflags) if (gflags & GBCC) { #ifndef TIOCSTI if (!ttyset && hp->h_bcc != NIL) - ttyset++, stty(fileno(stdin), &ttybuf); + ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &tio); #endif hp->h_bcc = extract(readtty("Bcc: ", detract(hp->h_bcc, 0)), GBCC); @@ -133,10 +133,10 @@ out: signal(SIGTTOU, savettou); signal(SIGTTIN, savettin); #ifndef TIOCSTI - ttybuf.sg_erase = c_erase; - ttybuf.sg_kill = c_kill; + tio.c_cc[VERASE] = c_erase; + tio.c_cc[VKILL] = c_kill; if (ttyset) - stty(fileno(stdin), &ttybuf); + tcsetattr(fileno(stdin), TCSADRAIN, &tio); signal(SIGQUIT, savequit); #endif signal(SIGINT, saveint); |