define new library function getgrouplist
[unix-history] / usr / src / lib / libc / gen / getpass.3
CommitLineData
ae59e04c
CL
1.\" Copyright (c) 1989, 1991 The Regents of the University of California.
2.\" All rights reserved.
0adf1b99 3.\"
ae59e04c
CL
4.\" %sccs.include.redist.man%
5.\"
9e0f9f92 6.\" @(#)getpass.3 6.6 (Berkeley) %G%
ae59e04c
CL
7.\"
8.Dd
9.Dt GETPASS 3
10.Os
11.Sh NAME
12.Nm getpass
13.Nd get a password
14.Sh SYNOPSIS
913ee8ae 15.Fd #include <pwd.h>
ae59e04c
CL
16.Fd #include <unistd.h>
17.Ft char *
18.Fn getpass "const char *prompt"
19.Sh DESCRIPTION
20The
21.Fn getpass
c8328751 22function displays a prompt to, and reads in a password from,
ae59e04c 23.Pa /dev/tty .
c8328751
KB
24If this file is not accessible,
25.Nm getpass
26displays the prompt on the standard error output and reads from the standard
27input.
28.Pp
913ee8ae
KB
29The password may be up to _PASSWORD_LEN (currently 128)
30characters in length.
31Any additional
c8328751
KB
32characters and the terminating newline character are discarded.
33.Pp
34.Nm Getpass
35turns off character echoing while reading the password.
ae59e04c
CL
36.Pp
37.Sh RETURN VALUES
c8328751
KB
38.Nm Getpass
39returns a pointer to the null terminated password.
ae59e04c
CL
40.Sh FILES
41.Bl -tag -width /dev/tty - compact
42.It Pa /dev/tty
43.El
44.Sh SEE ALSO
45.Xr crypt 3
46.Sh HISTORY
47A
c8328751 48.Nm getpass
ae59e04c
CL
49function appeared in
50.At v7 .
51.Sh BUGS
52The
c8328751 53.Nm getpass
ae59e04c 54function leaves its result in an internal static object and returns
c8328751
KB
55a pointer to that object.
56Subsequent calls to
57.Nm getpass
ae59e04c 58will modify the same object.
c8328751
KB
59.Pp
60The calling process should zero the password as soon as possible to
61avoid leaving the cleartext password visible in the process's address
62space.