From: Stathis Kamperis Date: Sat, 7 Mar 2009 15:58:30 +0000 (+0000) Subject: isatty(3): mention return values and error codes X-Git-Tag: v2.3.1~238 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/0ab0bcb6455df20e4d40b518eaccaf8da91de821 isatty(3): mention return values and error codes --- diff --git a/lib/libc/gen/ttyname.3 b/lib/libc/gen/ttyname.3 index eb3769d9fe..6edcb7bc8b 100644 --- a/lib/libc/gen/ttyname.3 +++ b/lib/libc/gen/ttyname.3 @@ -83,12 +83,12 @@ function gets the related device name of a file descriptor for which .Fn isatty -is true +is true. .Pp The .Fn ttyname_r function is a thread-safe version of -.Fn ttyname +.Fn ttyname . .Pp The .Fn ttyslot @@ -98,6 +98,12 @@ fetches the current process' control terminal number from the file entry. .Sh RETURN VALUES The +.Fn isatty +function +returns 1 if the file descriptor refers to a valid terminal +device and 0 otherwise. +.Pp +The .Fn ttyname function returns the null terminated name if the device is found and @@ -117,6 +123,21 @@ the value zero is returned. .It Pa /dev/\(** .It Pa /etc/ttys .El +.Sh ERRORS +The +.Fn isatty +function +may fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fd +is not a valid open file descriptor. +.It Bq Er ENOTTY +The +.Fa fd +is not associated with a terminal. +.El .Sh SEE ALSO .Xr ioctl 2 , .Xr ttys 5