BSD 4_3_Net_2 release
[unix-history] / usr / src / lib / libc / gen / ctermid.3
index 1a6b1ad..557f59f 100644 (file)
@@ -1,51 +1,93 @@
-.\" Copyright (c) 1990 The Regents of the University of California.
+.\" Copyright (c) 1990, 1991 The Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" All rights reserved.
 .\"
-.\" %sccs.include.redist.man%
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
 .\"
 .\"
-.\"    @(#)ctermid.3   5.1 (Berkeley) %G%
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
 .\"
-.TH CTERMID 3 ""
-.UC 7
-.SH NAME
-ctermid \- generate terminal pathname
-.SH SYNOPSIS
-.nf
-.ft B
-#include <stdio.h>
-.sp
-char *ctermid(char *buf);
-.ft R
-.fi
-.SH DESCRIPTION
+.\"     @(#)ctermid.3  5.2 (Berkeley) 4/19/91
+.\"
+.Dd April 19, 1991
+.Dt CTERMID 3
+.Os
+.Sh NAME
+.Nm ctermid
+.Nd generate terminal pathname
+.Sh SYNOPSIS
+.Fd #include <stdio.h>
+.Ft char *
+.Fn ctermid "char *buf"
+.Sh DESCRIPTION
 The
 The
-.I ctermid
+.Fn ctermid
 function generates a string, that, when used as a pathname, refers to
 function generates a string, that, when used as a pathname, refers to
-the current controlling terminal for the current process.
-.PP
+the current controlling terminal of the calling process.
+.Pp
 If
 If
-.I buf
-is a NULL pointer, a pointer to a static area is returned.
+.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
 Otherwise, the pathname is copied into the memory referenced by
-.IR buf .
-.I Buf
-is assumed to be at least L_ctermid (as defined in the include
-file <stdio.h>) bytes long.
-.PP
-The current implementation simply returns ``/dev/tty''.
-.SH RETURN
-Upon successful completion, a non-NULL pointer is returned.
-Otherwise, a NULL pointer is returned and
-.I errno
+.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.
 is set to indicate the error.
-.SH ERRORS
+.Sh ERRORS
 The current implementation detects no error conditions.
 The current implementation detects no error conditions.
-.SH "SEE ALSO"
-ttyname(3)
-.SH STANDARDS
-.I Ctermid
-conforms to IEEE Std 1003.1-1988 (``POSIX'').
-.SH 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.
+.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.