VMS Help  —  CRTL  ttyname  Description
    The implementation of the ttyname function that takes no
    argument is provided only for backward compatibility. This
    legacy implementation returns a pointer to the null-terminated
    name of the terminal device associated with file descriptor 0,
    the default input device (stdin). A value of 0 is returned if
    SYS$INPUT is not a TTY device.

    The ttyname_r function and the implementation of ttyname that
    takes a filedes argument are UNIX standard compliant and are
    available with only OpenVMS Version 7.3-2 and higher.

    The standard compliant ttyname function returns a pointer to a
    string containing a null-terminated pathname of the terminal
    associated with file descriptor filedes. The return value might
    point to static data whose content is overwritten by each call.
    The ttyname interface need not be reentrant.

    The ttyname_r function returns a pointer to store the null-
    terminated pathname of the terminal associated with the file
    descriptor filedes in the character array referenced by name. The
    array is namesize characters long and should have space for the
    name and the terminating null character. The maximum length of
    the terminal name is TTY_NAME_MAX.

    If successful, ttyname returns a pointer to a string. Otherwise,
    a NULL pointer is returned and errno is set to indicate the
    error.

    If successful, ttyname_r stores the terminal name as a null-
    terminated string in the buffer pointed to by name and returns 0.
    Otherwise, an error number is returned to indicate the error.
Close Help