9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / getpass.3c
blob932ebb113b2e1bade423fce75d79ec5eac95c3b6
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
45 .\" Portions Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH GETPASS 3C "Sep 2, 2003"
48 .SH NAME
49 getpass, getpassphrase \- read a string of characters without echo
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <stdlib.h>
55 \fBchar *\fR\fBgetpass\fR(\fBconst char *\fR\fIprompt\fR);
56 .fi
58 .LP
59 .nf
60 \fBchar *\fR\fBgetpassphrase\fR(\fBconst char *\fR\fIprompt\fR);
61 .fi
63 .SS "XPG4, SUS, SUSv2"
64 .LP
65 .nf
66 #include <unistd.h>
68 \fBchar *\fR\fBgetpass\fR(\fBconst char *\fR\fIprompt\fR);
69 .fi
71 .SH DESCRIPTION
72 .sp
73 .LP
74 The \fBgetpass()\fR function opens the process's controlling terminal, writes
75 to that device the null-terminated string \fIprompt\fR, disables echoing, reads
76 a string of characters up to the next newline character or EOF, restores the
77 terminal state and closes the terminal.
78 .sp
79 .LP
80 The \fBgetpassphrase()\fR function is identical to \fBgetpass()\fR, except that
81 it reads and returns a string of up to 257 characters in length.
82 .SH RETURN VALUES
83 .sp
84 .LP
85 Upon successful completion, \fBgetpass()\fR returns a pointer to a
86 null-terminated string of at most 9 bytes that were read from the terminal
87 device. If an error is encountered, the terminal state is restored and a null
88 pointer is returned.
89 .SH ERRORS
90 .sp
91 .LP
92 The \fBgetpass()\fR and  \fBgetpassphrase()\fR functions may fail if:
93 .sp
94 .ne 2
95 .na
96 \fB\fBEINTR\fR\fR
97 .ad
98 .RS 10n
99 The function was interrupted by a signal.
103 .ne 2
105 \fB\fBEIO\fR\fR
107 .RS 10n
108 The process is a member of a background process attempting to read from its
109 controlling terminal, the process is ignoring or blocking the \fBSIGTTIN\fR
110 signal or the process group is orphaned.
114 .ne 2
116 \fB\fBEMFILE\fR\fR
118 .RS 10n
119 \fBOPEN_MAX\fR file descriptors are currently open in the calling process.
123 .ne 2
125 \fB\fBENFILE\fR\fR
127 .RS 10n
128 The maximum allowable number of files is currently open in the system.
132 .ne 2
134 \fB\fBENXIO\fR\fR
136 .RS 10n
137 The process does not have a controlling terminal.
140 .SH USAGE
143 The return value points to static data whose content may be overwritten by each
144 call.
145 .SH ATTRIBUTES
148 See \fBattributes\fR(5) for descriptions of the following attributes:
153 box;
154 c | c
155 l | l .
156 ATTRIBUTE TYPE  ATTRIBUTE VALUE
158 Interface Stability     \fBgetpass()\fR is Standard.
160 MT-Level        Unsafe
163 .SH SEE ALSO
166 \fBattributes\fR(5), \fBstandards\fR(5)