OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / isatty.3
1 .\" Copyright 2008, Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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.
8 .\"
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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH ISATTY 3 2014-01-27 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 isatty \- test whether a file descriptor refers to a terminal
29 .SH SYNOPSIS
30 .nf
31 .B #include <unistd.h>
32 .sp
33 .BI "int isatty(int " fd );
34 .fi
35 .SH DESCRIPTION
36 The
37 .BR isatty ()
38 function tests whether
39 .I fd
40 is an open file descriptor referring to a terminal.
41 .SH RETURN VALUE
42 .BR isatty ()
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
55 .B EINVAL
56 .I fd
57 refers to a file other than a terminal.
58 POSIX.1-2001 specifies the error
59 .BR ENOTTY
60 .\" FIXME . File a bug for this?
61 for this case.
62 .SH ATTRIBUTES
63 .SS Multithreading (see pthreads(7))
64 The
65 .BR isatty ()
66 function is thread-safe.
67 .SH CONFORMING TO
68 SVr4, 4.3BSD, POSIX.1-2001.
69 .SH SEE ALSO
70 .BR fstat (2),
71 .BR ttyname (3)
72 .SH COLOPHON
73 This page is part of release 3.79 of the Linux
74 .I man-pages
75 project.
76 A description of the project,
77 information about reporting bugs,
78 and the latest version of this page,
79 can be found at
80 \%http://www.kernel.org/doc/man\-pages/.