blob: 6c937bcf495318f2b2b6ef934cc5536e5d464864 [file] [log] [blame]
Fred Drake5ac2a071998-12-22 23:37:21 +00001\section{\module{getpass}
Fred Drakeb3a20bc1999-03-12 18:34:21 +00002 --- Portable password input}
Fred Drake5ac2a071998-12-22 23:37:21 +00003
4\declaremodule{standard}{getpass}
Fred Drake5ac2a071998-12-22 23:37:21 +00005\modulesynopsis{Portable reading of passwords and retrieval of the userid.}
Fred Drakeb3a20bc1999-03-12 18:34:21 +00006\moduleauthor{Piers Lauder}{piers@cs.su.oz.au}
7% Windows (& Mac?) support by Guido van Rossum.
8\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
Fred Drake5ac2a071998-12-22 23:37:21 +00009
10
11The \module{getpass} module provides two functions:
12
13
14\begin{funcdesc}{getpass}{\optional{prompt}}
15 Prompt the user for a password without echoing. The user is
16 prompted using the string \var{prompt}, which defaults to
17 \code{'Password: '}.
Fred Drakeb3a20bc1999-03-12 18:34:21 +000018 Availability: Macintosh, \UNIX{}, Windows.
Fred Drake5ac2a071998-12-22 23:37:21 +000019\end{funcdesc}
20
21
22\begin{funcdesc}{getuser}{}
23 Return the ``login name'' of the user.
Fred Drakeb3a20bc1999-03-12 18:34:21 +000024 Availability: \UNIX{}, Windows.
Fred Drake5ac2a071998-12-22 23:37:21 +000025
26 This function checks the environment variables \envvar{LOGNAME},
27 \envvar{USER}, \envvar{LNAME} and \envvar{USERNAME}, in order, and
28 returns the value of the first one which is set to a non-empty
29 string. If none are set, the login name from the password database
Fred Drakeffbe6871999-04-22 21:23:22 +000030 is returned on systems which support the \refmodule{pwd} module,
Fred Drake5ac2a071998-12-22 23:37:21 +000031 otherwise, an exception is raised.
32\end{funcdesc}