ttyname(3C) DG/UX 5.4R3.00 ttyname(3C)
NAME
ttyname, ttynamer, isatty - find name of a terminal
SYNOPSIS
#include <stdlib.h>
char *ttyname (int fildes);
char *ttynamer (int fildes, char *buffer, int buflen);
int isatty (int fildes);
DESCRIPTION
ttyname and ttynamer return a pointer to a string containing the
null-terminated pathname of the terminal device associated with file
descriptor fildes. Instead of returning static data, ttynamer
returns the string into the location pointed to by buffer. The return
value of ttynamer is the same as buffer. buffer has a length of
buflen characters. If ttynamer detects an error, a NULL is returned
and errno is set to indicate the error.
isatty returns 1 if fildes is associated with a terminal device, 0
otherwise.
Considerations for Threads Programming
+----------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+----------+-----------------------------+
|isatty | Y N N |
|ttyname | N - - |
|ttynamer | Y Y N |
+----------+-----------------------------+
FILES
/dev/*
DIAGNOSTICS
ttyname and ttynamer return a NULL pointer if fildes does not
describe a terminal device in directory /dev.
Errors
If the following condition occurs, ttyname, ttynamer, and isatty
return NULL and set errno to the corresponding value:
[ERANGE] The value of buflen is smaller than the length of the
string to be returned.
[EBADF] The value of fildes is not a valid file descriptor.
[ENOTTY] The value of fildes does not refer to a terminal device.
Licensed material--property of copyright holder(s) 1
ttyname(3C) DG/UX 5.4R3.00 ttyname(3C)
SEE ALSO
reentrant(3), ttyslot(3C), ttysrch(4M).
NOTES
The function ttynamer is available only in the shared library,
libc.so.
The return value for ttyname and isatty points to static data whose
content is overwritten by each call.
Licensed material--property of copyright holder(s) 2