1*61111Sbostic.\" Copyright (c) 1990, 1991, 1993 2*61111Sbostic.\" The Regents of the University of California. All rights reserved. 346475Sbostic.\" 446475Sbostic.\" %sccs.include.redist.man% 546475Sbostic.\" 6*61111Sbostic.\" @(#)ctermid.3 8.1 (Berkeley) 06/04/93 746475Sbostic.\" 848352Scael.Dd 948352Scael.Dt CTERMID 3 1048352Scael.Os 1148352Scael.Sh NAME 1248352Scael.Nm ctermid 1348352Scael.Nd generate terminal pathname 1448352Scael.Sh SYNOPSIS 1548352Scael.Fd #include <stdio.h> 1648352Scael.Ft char * 1748352Scael.Fn ctermid "char *buf" 1848352Scael.Sh DESCRIPTION 1946475SbosticThe 2048352Scael.Fn ctermid 2146475Sbosticfunction generates a string, that, when used as a pathname, refers to 2248352Scaelthe current controlling terminal of the calling process. 2348352Scael.Pp 2446475SbosticIf 2548352Scael.Ar buf 2648352Scaelis the 2748352Scael.Dv NULL 2848352Scaelpointer, a pointer to a static area is returned. 2946475SbosticOtherwise, the pathname is copied into the memory referenced by 3048352Scael.Ar buf . 3148352ScaelThe argument 3248352Scael.Ar buf 3348352Scaelis assumed to be at least 3448352Scael.Dv L_ctermid 3548352Scael(as defined in the include 3648352Scaelfile 3748352Scael.Aq Pa stdio.h ) 3848352Scaelbytes long. 3948352Scael.Pp 4048352ScaelThe current implementation simply returns 4148352Scael.Ql /dev/tty . 4248352Scael.Sh RETURN VALUES 4348352ScaelUpon successful completion, a 4448352Scael.Pf non- Dv NULL 4548352Scaelpointer is returned. 4648352ScaelOtherwise, a 4748352Scael.Dv NULL 4848352Scaelpointer is returned and the global variable 4948352Scael.Va errno 5046475Sbosticis set to indicate the error. 5148352Scael.Sh ERRORS 5246475SbosticThe current implementation detects no error conditions. 5348352Scael.Sh SEE ALSO 5448352Scael.Xr ttyname 3 5548352Scael.Sh STANDARDS 5648352ScaelThe 5748352Scael.Xr ctermid 5848352Scaelfunction conforms to 5948352Scael.St -p1003.1-88 . 6048352Scael.Sh BUGS 6148352ScaelBy default the 6248352Scael.Fn ctermid 6348352Scaelfunction 6448352Scaelwrites all information to an internal static object. 6548352ScaelSubsequent calls to 6648352Scael.Fn ctermid 6748352Scaelwill modify the same object. 68