Commit | Line | Data |
---|---|---|
e767d426 | 1 | .\" @(#)getlogin.3 6.1 (Berkeley) %G% |
4db1fb17 | 2 | .\" |
e767d426 | 3 | .TH GETLOGIN 3 "" |
4db1fb17 KM |
4 | .AT 3 |
5 | .SH NAME | |
6 | getlogin \- get login name | |
7 | .SH SYNOPSIS | |
8 | .B char *getlogin() | |
9 | .SH DESCRIPTION | |
10 | .I Getlogin | |
6f005db8 | 11 | returns a pointer to the login name as found in |
4db1fb17 | 12 | .IR /etc/utmp . |
6f005db8 | 13 | It may be used in conjunction with |
4db1fb17 | 14 | .I getpwnam |
6f005db8 KM |
15 | to locate the correct password file entry when the same userid |
16 | is shared by several login names. | |
4db1fb17 KM |
17 | .PP |
18 | If | |
19 | .I getlogin | |
6f005db8 | 20 | is called within a process that is not attached to a |
4db1fb17 | 21 | typewriter, it returns NULL. |
6f005db8 | 22 | The correct procedure for determining the login name is to first call |
4db1fb17 | 23 | .I getlogin |
6f005db8 KM |
24 | and if it fails, to call |
25 | .IR getpw ( getuid ()). | |
4db1fb17 KM |
26 | .SH FILES |
27 | /etc/utmp | |
28 | .SH "SEE ALSO" | |
6f005db8 | 29 | getpwent(3), getgrent(3), utmp(5), getpw(3) |
4db1fb17 KM |
30 | .SH DIAGNOSTICS |
31 | Returns NULL (0) if name not found. | |
32 | .SH BUGS | |
33 | The return values point to static data | |
34 | whose content is overwritten by each call. |