1getpass(3C)              Standard C Library Functions              getpass(3C)
2
3
4

NAME

6       getpass, getpassphrase - read a string of characters without echo
7

SYNOPSIS

9       #include <stdlib.h>
10
11       char *getpass(const char *prompt);
12
13
14       char *getpassphrase(const char *prompt);
15
16
17   XPG4, SUS, SUSv2
18       #include <unistd.h>
19
20       char *getpass(const char *prompt);
21
22

DESCRIPTION

24       The getpass() function opens the process's controlling terminal, writes
25       to that device the null-terminated  string  prompt,  disables  echoing,
26       reads  a  string of characters up to the next newline character or EOF,
27       restores the terminal state and closes the terminal.
28
29
30       The getpassphrase() function is identical to getpass(), except that  it
31       reads and returns a string of up to 257 characters in length.
32

RETURN VALUES

34       Upon  successful completion, getpass() returns a pointer to a null-ter‐
35       minated string of at most 9 bytes that  were  read  from  the  terminal
36       device.  If an error is encountered, the terminal state is restored and
37       a null pointer is returned.
38

ERRORS

40       The getpass() and  getpassphrase() functions may fail if:
41
42       EINTR     The function was interrupted by a signal.
43
44
45       EIO       The process is a member of a background process attempting to
46                 read  from  its controlling terminal, the process is ignoring
47                 or blocking the  SIGTTIN  signal  or  the  process  group  is
48                 orphaned.
49
50
51       EMFILE    OPEN_MAX  file  descriptors are currently open in the calling
52                 process.
53
54
55       ENFILE    The maximum allowable number of files is  currently  open  in
56                 the system.
57
58
59       ENXIO     The process does not have a controlling terminal.
60
61

USAGE

63       The return value points to static data whose content may be overwritten
64       by each call.
65

ATTRIBUTES

67       See attributes(5) for descriptions of the following attributes:
68
69
70
71
72       ┌─────────────────────────────┬─────────────────────────────┐
73       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
74       ├─────────────────────────────┼─────────────────────────────┤
75       │Interface Stability          │getpass() is Standard.       │
76       ├─────────────────────────────┼─────────────────────────────┤
77       │MT-Level                     │Unsafe                       │
78       └─────────────────────────────┴─────────────────────────────┘
79

SEE ALSO

81       attributes(5), standards(5)
82
83
84
85SunOS 5.11                        2 Sep 2003                       getpass(3C)
Impressum