blob: cc27576f19a4dfd7d6c1cec2f7051e8c604c62ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "stddef.h"
#include "sys/types.h"
#include <unistd.h>
#include "termios.h"
/** test for a terminal device **/
int isatty(int fildes)
{
struct termios tios;
if (tcgetattr(fildes, &tios) == 0) {
/* errno set by tcgetattr() */
#if 0
errno = EBADF; /* ARGUMENT(fildes) is not a valid file descriptor */
errno = ENOTTY; /* ARGUMENT(fildes) is not associated with a terminal */
#endif
return 1;
}
return 0;
}
/***
checks whether the file descriptor ARGUMENT(fildes) is associated with a
terminal device.
***/
/*
RETURN(ZERO, ARGUMENT(fildes) is not a terminal)
RETURN(ONE, ARGUMENT(fildes) is a terminal device)
POSIX(1)
*/
|