*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> isatty (3)              
Title
Content
Arch
Section
 

ttyname(3)

Contents


NAME    [Toc]    [Back]

       ttyname, isatty, ttyname_r - Get the name of a terminal

SYNOPSIS    [Toc]    [Back]

       #include <unistd.h>

       char *ttyname(
               int file-descriptor ); int isatty(
               int file-descriptor ); int ttyname_r(
               int file-descriptor,
               char *buffer,
               int len );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       ttyname_r(): POSIX.1c

       isatty(), ttyname():  XSH4.2

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies  an open file descriptor.  Points to a buffer in
       which the terminal name is stored.  Specifies  the  length
       of the buffer pointed to by the buffer parameter.

DESCRIPTION    [Toc]    [Back]

       The  ttyname()  function  gets the name of a terminal.  It
       returns a pointer to a string containing  the  null-terminated
  pathname of the terminal device associated with the
       file-descriptor parameter.

       The isatty() function determines if the device  associated
       with the file-descriptor parameter is a terminal.

NOTES    [Toc]    [Back]

       The  ttyname()  function  returns a pointer to thread-specific
 data. Subsequent calls to  this  function  from  the
       same thread overwrite this data.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, the ttyname() function returns
       a pointer to a string identifying  a  terminal  device.  A
       NULL  pointer is returned if the file-descriptor parameter
       does not describe a terminal device in the /dev directory.

       Upon  successful completion, the isatty() function returns
       a value of 1 if the specified file-descriptor parameter is
       associated  with a terminal. Otherwise, it returns a value
       of zero (0).

       [POSIX]  Upon successful completion, the ttyname_r() function
  stores the terminal name as a null-terminated string
       in the buffer pointed  to  by  the  buffer  parameter  and
       returns  a  value  of  0  (zero). Otherwise, it returns an
       error number.

       [Tru64 UNIX]  The obsolete version  of  ttyname_r()  functions
 the same way as the POSIX version, except it returns
       a -1 upon unsuccessful completion.

ERRORS    [Toc]    [Back]

       If the isatty() function fails, errno may be  set  to  the
       following  value: The file associated with file-descriptor
       is not a terminal.

       If the ttyname_r() function fails, errno may be set to the
       following value: The buffer parameter is a null pointer or
       the len parameter was too short to store the string.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: ttyslot(3)

       Standards: standards(5)



                                                       ttyname(3)
[ Back ]
 Similar pages
Name OS Title
termios Linux get and set terminal attributes, line control, get and set baud rate, get and set terminal foregroun...
ct HP-UX spawn getty to a remote terminal (call terminal)
pty HP-UX get the name of the terminal
tty IRIX get the name of the terminal
tty HP-UX get the name of the terminal
tabs FreeBSD set terminal tabs
stty IRIX set the options for a terminal
gettydefs Tru64 Terminal attributes
lock FreeBSD reserve a terminal
tset FreeBSD terminal initialization
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service