char *getpass( const char *prompt);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
Since glibc 2.2.2:
(_XOPEN_SOURCE >= 500 ||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
!(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
Before glibc 2.2.2: none
This function is obsolete. Do not use it.
The getpass() function opens /dev/tty (the controlling terminal of the
process), outputs the string prompt, turns off echoing, reads one line
(the "password"), restores the terminal state and closes /dev/tty
The function getpass() returns a pointer to a static buffer containing
(the first PASS_MAX bytes of) the password without the trailing new-
line, terminated by a null byte ('\0'). This buffer may be overwritten
by a following call. On error, the terminal state is restored, errno
is set appropriately, and NULL is returned.
The function may fail if
ENXIO The process does not have a controlling terminal.
Present in SUSv2, but marked LEGACY. Removed in POSIX.1-2001.
For libc4 and libc5, the prompt is not written to /dev/tty but to
stderr. Moreover, if /dev/tty cannot be opened, the password is read
from stdin. The static buffer has length 128 so that only the first
127 bytes of the password are returned. While reading the password,
signal generation (SIGINT, SIGQUIT, SIGSTOP, SIGTSTP) is disabled and
the corresponding characters (usually control-C, control-\, control-Z
and control-Y) are transmitted as part of the password. Since libc
5.4.19 also line editing is disabled, so that also backspace and the
like will be seen as part of the password.
For glibc2, if /dev/tty cannot be opened, the prompt is written to
avoid leaving the cleartext password visible in the process's address
This page is part of release 3.35 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://man7.org/linux/man-pages/.
Linux 2010-09-20 GETPASS(3)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2017
All Rights Reserved.