| Line | |
|---|
| 1 | .\" @(#)getlogin.3 6.2 (Berkeley) 5/9/86
|
|---|
| 2 | .\"
|
|---|
| 3 | .TH GETLOGIN 3 "May 9, 1986"
|
|---|
| 4 | .AT 3
|
|---|
| 5 | .SH NAME
|
|---|
| 6 | getlogin \- get login name
|
|---|
| 7 | .SH SYNOPSIS
|
|---|
| 8 | .nf
|
|---|
| 9 | .ft B
|
|---|
| 10 | #include <unistd.h>
|
|---|
| 11 |
|
|---|
| 12 | char *getlogin(void)
|
|---|
| 13 | .fi
|
|---|
| 14 | .SH DESCRIPTION
|
|---|
| 15 | .B Getlogin
|
|---|
| 16 | returns a pointer to the login name as found in
|
|---|
| 17 | .BR /etc/utmp .
|
|---|
| 18 | It may be used in conjunction with
|
|---|
| 19 | .B getpwnam
|
|---|
| 20 | to locate the correct password file entry when the same user ID
|
|---|
| 21 | is shared by several login names.
|
|---|
| 22 | .PP
|
|---|
| 23 | If
|
|---|
| 24 | .B getlogin
|
|---|
| 25 | is called within a process that is not attached to a
|
|---|
| 26 | terminal, or if there is no entry in
|
|---|
| 27 | .B /etc/utmp
|
|---|
| 28 | for the process's terminal,
|
|---|
| 29 | .B getlogin
|
|---|
| 30 | returns a null pointer.
|
|---|
| 31 | A reasonable procedure for determining the login name is to first call
|
|---|
| 32 | .B getlogin
|
|---|
| 33 | and if it fails, to call
|
|---|
| 34 | .BR getpwuid ( getuid ()).
|
|---|
| 35 | .SH FILES
|
|---|
| 36 | /etc/utmp
|
|---|
| 37 | .SH "SEE ALSO"
|
|---|
| 38 | .BR getpwent (3),
|
|---|
| 39 | .BR utmp (5),
|
|---|
| 40 | .BR ttyslot (3)
|
|---|
| 41 | .SH DIAGNOSTICS
|
|---|
| 42 | Returns a null pointer if the name cannot be found.
|
|---|
| 43 | .SH BUGS
|
|---|
| 44 | The return values point to static data
|
|---|
| 45 | whose content is overwritten by each call.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.