Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Sep 1995 17:03:16 -0500
From:      cmf@netins.net (Carl Fongheiser)
To:        hackers@freebsd.org
Subject:   Diff to POSIX-ify ttyname.c
Message-ID:  <v02120d01ac824b326aa2@[44.50.32.7]>

next in thread | raw e-mail | index | archive | help
Apologies if something like this has already been committed -- I somehow
got dropped off cvs-all.

--- /usr/src/lib/libc/gen/ttyname.c     Fri Sep  8 21:58:45 1995
+++ ttyname.c   Sun Sep 17 16:34:57 1995
@@ -39,7 +39,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <dirent.h>
-#include <sgtty.h>
+#include <termios.h>
 #include <db.h>
 #include <string.h>
 #include <paths.h>
@@ -52,7 +52,7 @@
        int fd;
 {
        struct stat sb;
-       struct sgttyb ttyb;
+       struct termios ttyb;
        DB *db;
        DBT data, key;
        struct {
@@ -61,7 +61,7 @@
        } bkey;

        /* Must be a terminal. */
-       if (ioctl(fd, TIOCGETP, &ttyb) < 0)
+       if (tcgetattr(fd, &ttyb) < 0)
                return (NULL);
        /* Must be a character device. */
        if (fstat(fd, &sb) || !S_ISCHR(sb.st_mode))





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v02120d01ac824b326aa2>