]>
Commit | Line | Data |
---|---|---|
fac98546 MK |
1 | .\" Copyright 2008, Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
fea681da | 3 | .\" |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
fac98546 MK |
5 | .\" Permission is granted to make and distribute verbatim copies of this |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
fea681da | 8 | .\" |
fac98546 MK |
9 | .\" Permission is granted to copy and distribute modified versions of this |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
fea681da | 13 | .\" |
fac98546 MK |
14 | .\" Since the Linux kernel and libraries are constantly changing, this |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
fea681da | 21 | .\" |
fac98546 MK |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
c13182ef | 25 | .\" |
460495ca | 26 | .TH ISATTY 3 2015-08-08 "Linux" "Linux Programmer's Manual" |
fea681da | 27 | .SH NAME |
fac98546 | 28 | isatty \- test whether a file descriptor refers to a terminal |
fea681da | 29 | .SH SYNOPSIS |
fea681da MK |
30 | .nf |
31 | .B #include <unistd.h> | |
68e4db0a | 32 | .PP |
fac98546 | 33 | .BI "int isatty(int " fd ); |
fea681da | 34 | .fi |
fea681da | 35 | .SH DESCRIPTION |
fac98546 | 36 | The |
0c637bbd MK |
37 | .BR isatty () |
38 | function tests whether | |
fac98546 MK |
39 | .I fd |
40 | is an open file descriptor referring to a terminal. | |
41 | .SH RETURN VALUE | |
0c637bbd | 42 | .BR isatty () |
fac98546 MK |
43 | returns 1 if |
44 | .I fd | |
45 | is an open file descriptor referring to a terminal; | |
46 | otherwise 0 is returned, and | |
47 | .I errno | |
48 | is set to indicate the error. | |
49 | .SH ERRORS | |
50 | .TP | |
51 | .B EBADF | |
52 | .I fd | |
53 | is not a valid file descriptor. | |
54 | .TP | |
44e9941b | 55 | .B ENOTTY |
fac98546 MK |
56 | .I fd |
57 | refers to a file other than a terminal. | |
44e9941b | 58 | On some older kernels, some types of files |
2d224c30 | 59 | .\" e.g., FIFOs and pipes on 2.6.32 |
44e9941b MK |
60 | resulted in the error |
61 | .B EINVAL | |
62 | in this case (which is a violation of POSIX, which specifies the error | |
63 | .BR ENOTTY ). | |
8532fe64 | 64 | .SH ATTRIBUTES |
9ff4a537 MK |
65 | For an explanation of the terms used in this section, see |
66 | .BR attributes (7). | |
67 | .TS | |
68 | allbox; | |
69 | lb lb lb | |
70 | l l l. | |
71 | Interface Attribute Value | |
72 | T{ | |
8532fe64 | 73 | .BR isatty () |
9ff4a537 MK |
74 | T} Thread safety MT-Safe |
75 | .TE | |
47297adb | 76 | .SH CONFORMING TO |
eb03aa70 | 77 | POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. |
47297adb | 78 | .SH SEE ALSO |
fea681da MK |
79 | .BR fstat (2), |
80 | .BR ttyname (3) |