1LOGNAME(1P)                POSIX Programmer's Manual               LOGNAME(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       logname - return the user's login name
13

SYNOPSIS

15       logname
16

DESCRIPTION

18       The logname utility shall write the user's login name to standard  out‐
19       put.  The  login name shall be the string that would be returned by the
20       getlogin()  function  defined  in  the  System  Interfaces  volume   of
21       IEEE Std 1003.1-2001.  Under  the conditions where the getlogin() func‐
22       tion would fail, the logname utility shall write a  diagnostic  message
23       to standard error and exit with a non-zero exit status.
24

OPTIONS

26       None.
27

OPERANDS

29       None.
30

STDIN

32       Not used.
33

INPUT FILES

35       None.
36

ENVIRONMENT VARIABLES

38       The  following environment variables shall affect the execution of log‐
39       name:
40
41       LANG   Provide a default value for the  internationalization  variables
42              that  are  unset  or  null.  (See the Base Definitions volume of
43              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
44              ables  for the precedence of internationalization variables used
45              to determine the values of locale categories.)
46
47       LC_ALL If set to a non-empty string value, override the values  of  all
48              the other internationalization variables.
49
50       LC_CTYPE
51              Determine  the  locale  for  the  interpretation of sequences of
52              bytes of text data as characters (for  example,  single-byte  as
53              opposed to multi-byte characters in arguments).
54
55       LC_MESSAGES
56              Determine  the  locale  that should be used to affect the format
57              and contents of diagnostic messages written to standard error.
58
59       NLSPATH
60              Determine the location of message catalogs for the processing of
61              LC_MESSAGES .
62
63

ASYNCHRONOUS EVENTS

65       Default.
66

STDOUT

68       The  logname  utility  output  shall be a single line consisting of the
69       user's login name:
70
71
72              "%s\n", <login name>
73

STDERR

75       The standard error shall be used only for diagnostic messages.
76

OUTPUT FILES

78       None.
79

EXTENDED DESCRIPTION

81       None.
82

EXIT STATUS

84       The following exit values shall be returned:
85
86        0     Successful completion.
87
88       >0     An error occurred.
89
90

CONSEQUENCES OF ERRORS

92       Default.
93
94       The following sections are informative.
95

APPLICATION USAGE

97       The logname utility explicitly ignores the LOGNAME environment variable
98       because environment changes could produce erroneous results.
99

EXAMPLES

101       None.
102

RATIONALE

104       The  passwd  file  is not listed as required because the implementation
105       may have other means of mapping login names.
106

FUTURE DIRECTIONS

108       None.
109

SEE ALSO

111       id, who, the System Interfaces volume of  IEEE Std 1003.1-2001,  getlo‐
112       gin()
113
115       Portions  of  this text are reprinted and reproduced in electronic form
116       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
117       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
118       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
119       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
120       event of any discrepancy between this version and the original IEEE and
121       The  Open Group Standard, the original IEEE and The Open Group Standard
122       is the referee document. The original Standard can be  obtained  online
123       at http://www.opengroup.org/unix/online.html .
124
125
126
127IEEE/The Open Group                  2003                          LOGNAME(1P)
Impressum