xref: /original-bsd/lib/libc/gen/ctermid.3 (revision 05bf53f3)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)ctermid.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt CTERMID 3
10.Os
11.Sh NAME
12.Nm ctermid
13.Nd generate terminal pathname
14.Sh SYNOPSIS
15.Fd #include <stdio.h>
16.Ft char *
17.Fn ctermid "char *buf"
18.Sh DESCRIPTION
19The
20.Fn ctermid
21function generates a string, that, when used as a pathname, refers to
22the current controlling terminal of the calling process.
23.Pp
24If
25.Ar buf
26is the
27.Dv NULL
28pointer, a pointer to a static area is returned.
29Otherwise, the pathname is copied into the memory referenced by
30.Ar buf .
31The argument
32.Ar buf
33is assumed to be at least
34.Dv L_ctermid
35(as defined in the include
36file
37.Aq Pa stdio.h )
38bytes long.
39.Pp
40The current implementation simply returns
41.Ql /dev/tty .
42.Sh RETURN VALUES
43Upon successful completion, a
44.Pf non- Dv NULL
45pointer is returned.
46Otherwise, a
47.Dv NULL
48pointer is returned and the global variable
49.Va errno
50is set to indicate the error.
51.Sh ERRORS
52The current implementation detects no error conditions.
53.Sh SEE ALSO
54.Xr ttyname 3
55.Sh STANDARDS
56The
57.Xr ctermid
58function conforms to
59.St -p1003.1-88 .
60.Sh BUGS
61By default the
62.Fn ctermid
63function
64writes all information to an internal static object.
65Subsequent calls to
66.Fn ctermid
67will modify the same object.
68