1*48352Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 246475Sbostic.\" All rights reserved. 346475Sbostic.\" 446475Sbostic.\" %sccs.include.redist.man% 546475Sbostic.\" 6*48352Scael.\" @(#)ctermid.3 5.2 (Berkeley) 04/19/91 746475Sbostic.\" 8*48352Scael.Dd 9*48352Scael.Dt CTERMID 3 10*48352Scael.Os 11*48352Scael.Sh NAME 12*48352Scael.Nm ctermid 13*48352Scael.Nd generate terminal pathname 14*48352Scael.Sh SYNOPSIS 15*48352Scael.Fd #include <stdio.h> 16*48352Scael.Ft char * 17*48352Scael.Fn ctermid "char *buf" 18*48352Scael.Sh DESCRIPTION 1946475SbosticThe 20*48352Scael.Fn ctermid 2146475Sbosticfunction generates a string, that, when used as a pathname, refers to 22*48352Scaelthe current controlling terminal of the calling process. 23*48352Scael.Pp 2446475SbosticIf 25*48352Scael.Ar buf 26*48352Scaelis the 27*48352Scael.Dv NULL 28*48352Scaelpointer, a pointer to a static area is returned. 2946475SbosticOtherwise, the pathname is copied into the memory referenced by 30*48352Scael.Ar buf . 31*48352ScaelThe argument 32*48352Scael.Ar buf 33*48352Scaelis assumed to be at least 34*48352Scael.Dv L_ctermid 35*48352Scael(as defined in the include 36*48352Scaelfile 37*48352Scael.Aq Pa stdio.h ) 38*48352Scaelbytes long. 39*48352Scael.Pp 40*48352ScaelThe current implementation simply returns 41*48352Scael.Ql /dev/tty . 42*48352Scael.Sh RETURN VALUES 43*48352ScaelUpon successful completion, a 44*48352Scael.Pf non- Dv NULL 45*48352Scaelpointer is returned. 46*48352ScaelOtherwise, a 47*48352Scael.Dv NULL 48*48352Scaelpointer is returned and the global variable 49*48352Scael.Va errno 5046475Sbosticis set to indicate the error. 51*48352Scael.Sh ERRORS 5246475SbosticThe current implementation detects no error conditions. 53*48352Scael.Sh SEE ALSO 54*48352Scael.Xr ttyname 3 55*48352Scael.Sh STANDARDS 56*48352ScaelThe 57*48352Scael.Xr ctermid 58*48352Scaelfunction conforms to 59*48352Scael.St -p1003.1-88 . 60*48352Scael.Sh BUGS 61*48352ScaelBy default the 62*48352Scael.Fn ctermid 63*48352Scaelfunction 64*48352Scaelwrites all information to an internal static object. 65*48352ScaelSubsequent calls to 66*48352Scael.Fn ctermid 67*48352Scaelwill modify the same object. 68