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
4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history]
/
usr
/
src
/
lib
/
libc
/
gen
/
isatty.c
diff --git
a/usr/src/lib/libc/gen/isatty.c
b/usr/src/lib/libc/gen/isatty.c
index
fab1fd9
..
fc9de90
100644
(file)
--- a/
usr/src/lib/libc/gen/isatty.c
+++ b/
usr/src/lib/libc/gen/isatty.c
@@
-1,18
+1,22
@@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)isatty.c 5.2 (Berkeley) %G%";
-#endif LIBC_SCCS and not lint
-
/*
/*
- * Returns 1 iff file is a tty
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * %sccs.include.redist.c%
*/
*/
-#include <sgtty.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)isatty.c 8.1 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
+
+#include <termios.h>
+#include <unistd.h>
-isatty(f)
+int
+isatty(fd)
+ int fd;
{
{
- struct
sgttyb ttyb
;
+ struct
termios t
;
- if (ioctl(f, TIOCGETP, &ttyb) < 0)
- return(0);
- return(1);
+ return(tcgetattr(fd, &t) != -1);
}
}