NAME
logname — return
user’s login name
SYNOPSIS
logname |
DESCRIPTION
The logname utility shall write the
user’s login name to standard output. The login name shall be the
string that would be returned by the
POSIX. 1
{8}
getlogin()
function. Under the conditions where the getlogin()
function would fail, the logname utility shall write
a diagnostic message to standard error and exit with a nonzero exit
status.
OPTIONS
None.
OPERANDS
None.
STANDARD INPUT
None.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of
logname:
LANG-
This variable shall determine the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_ ) do not specify a locale. See 2.6.
LC_ALL-
This variable shall determine the locale to be used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_.
LC_MESSAGES-
This variable shall determine the language in which messages should be written.
ASYNCHRONOUS EVENTS
Default.
STANDARD OUTPUT
The logname utility output shall be a
single line consisting of the user’s login name: "%s\n",
<login name>
STANDARD ERROR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The logname utility shall exit with one of
the following values:
CONSEQUENCES OF ERRORS
Default.
RATIONALE
EXAMPLES
The logname utility explicitly ignores the
LOGNAME
environment variable because environment changes could produce erroneous
results.
HISTORY OF DECISIONS MADE
The passwd file is not listed as required, because the implementation may have other means of mapping login names.