summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-09-07 02:05:53 +0000
committerpeter <peter@FreeBSD.org>1996-09-07 02:05:53 +0000
commit6720f124e4a30a7bd8199c51397f3590254e9366 (patch)
treeb32c6cb8bdf8cbbe59af3feb4a460b4e2e486619
parent7e1f106f1d60201fe697397cad2462f3f8b9ec68 (diff)
downloadFreeBSD-src-6720f124e4a30a7bd8199c51397f3590254e9366.zip
FreeBSD-src-6720f124e4a30a7bd8199c51397f3590254e9366.tar.gz
Another sgtty use bites the dust..
-rw-r--r--libexec/comsat/comsat.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
index 7fe1b60..acfde8f 100644
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -54,7 +54,7 @@ static char sccsid[] = "@(#)comsat.c 8.1 (Berkeley) 6/4/93";
#include <netdb.h>
#include <paths.h>
#include <pwd.h>
-#include <sgtty.h>
+#include <termios.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -206,7 +206,7 @@ notify(utp, file, offset, folder)
{
FILE *tp;
struct stat stb;
- struct sgttyb gttybuf;
+ struct termios tio;
char tty[20], name[sizeof(utmp[0].ut_name) + 1];
(void)snprintf(tty, sizeof(tty), "%s%.*s",
@@ -229,9 +229,8 @@ notify(utp, file, offset, folder)
dsyslog(LOG_ERR, "%s: %s", tty, strerror(errno));
_exit(-1);
}
- (void)ioctl(fileno(tp), TIOCGETP, &gttybuf);
- cr = (gttybuf.sg_flags&CRMOD) && !(gttybuf.sg_flags&RAW) ?
- "\n" : "\n\r";
+ (void)tcgetattr(fileno(tp), &tio);
+ cr = (tio.c_oflag & (OPOST|ONLCR) == (OPOST|ONLCR)) ? "\n" : "\n\r";
(void)strncpy(name, utp->ut_name, sizeof(utp->ut_name));
name[sizeof(name) - 1] = '\0';
(void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived%s%s%s:%s----%s",
OpenPOWER on IntegriCloud