.\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" %sccs.include.redist.man% .\" .\" @(#)ctermid.3 8.1 (Berkeley) 06/04/93 .\" .Dd .Dt CTERMID 3 .Os .Sh NAME .Nm ctermid .Nd generate terminal pathname .Sh SYNOPSIS .Fd #include .Ft char * .Fn ctermid "char *buf" .Sh DESCRIPTION The .Fn ctermid function generates a string, that, when used as a pathname, refers to the current controlling terminal of the calling process. .Pp If .Ar buf is the .Dv NULL pointer, a pointer to a static area is returned. Otherwise, the pathname is copied into the memory referenced by .Ar buf . The argument .Ar buf is assumed to be at least .Dv L_ctermid (as defined in the include file .Aq Pa stdio.h ) bytes long. .Pp The current implementation simply returns .Ql /dev/tty . .Sh RETURN VALUES Upon successful completion, a .Pf non- Dv NULL pointer is returned. Otherwise, a .Dv NULL pointer is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS The current implementation detects no error conditions. .Sh SEE ALSO .Xr ttyname 3 .Sh STANDARDS The .Xr ctermid function conforms to .St -p1003.1-88 . .Sh BUGS By default the .Fn ctermid function writes all information to an internal static object. Subsequent calls to .Fn ctermid will modify the same object.