xref: /original-bsd/lib/libc/gen/ctermid.3 (revision acda45c0)
Copyright (c) 1990 The Regents of the University of California.
All rights reserved.

%sccs.include.redist.man%

@(#)ctermid.3 5.1 (Berkeley) 02/19/91

CTERMID 3 ""
C 7
NAME
ctermid - generate terminal pathname
SYNOPSIS
#include <stdio.h>
char *ctermid(char *buf);
DESCRIPTION
The ctermid function generates a string, that, when used as a pathname, refers to the current controlling terminal for the current process.

If buf is a NULL pointer, a pointer to a static area is returned. Otherwise, the pathname is copied into the memory referenced by buf . Buf is assumed to be at least L_ctermid (as defined in the include file <stdio.h>) bytes long.

The current implementation simply returns ``/dev/tty''.

RETURN
Upon successful completion, a non-NULL pointer is returned. Otherwise, a NULL pointer is returned and errno is set to indicate the error.
ERRORS
The current implementation detects no error conditions.
"SEE ALSO"
ttyname(3)
STANDARDS
Ctermid conforms to IEEE Std 1003.1-1988 (``POSIX'').
BUGS
By default, all information is contained in a static buffer which is overwritten by each new call. It must be copied elsewhere to be retained.