Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ttyname(3)



  ctermid(3)                          CLIX                          ctermid(3)



  NAME

    ctermid - Generates the pathname for the controlling terminal

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    #include <stdio.h>

    char *ctermid(
      char *s );

  PARAMETERS

    s   If the s parameter is a NULL pointer, the string is stored in an
        internal static area and the address is returned.  The next call to
        ctermid() overwrites the contents of the internal static area.

        If the s parameter is not a NULL pointer, it points to a character
        array of at least L_ctermid elements, as defined in the <stdio.h>
        header file.  The pathname is placed in this array and the value of
        the s parameter is returned.

  DESCRIPTION

    The ctermid() function generates the pathname of the controlling terminal
    for the current process and stores it in a string.

    The difference between ctermid() and the ttyname() function is that
    ttyname() requires a file descriptor and returns the name of the terminal
    associated with that file descriptor, while ctermid() returns a string
    (/dev/tty) that refers to the terminal if used as a filename.  Thus, the
    ttyname() function is useful only if the process already has at least one
    file open to a terminal.

  RETURN VALUES

    Upon successful completion, ctermid() returns the address of the generated
    string.

    The ctermid() function returns an empty string if the pathname for the
    controlling terminal cannot be determined or another error occurs.

  RELATED INFORMATION

    Functions:  ttyname(3)





  2/94 - Intergraph Corporation                                              1




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026