59 is unused; 61 is ECONNREFUSED not EREFUSED; add Berkeley header
[unix-history] / usr / src / lib / libc / gen / getlogin.3
index 3ce4cd8..20e74b4 100644 (file)
@@ -1,6 +1,6 @@
-.\"    @(#)getlogin.3  4.1 (Berkeley) %G%
+.\"    @(#)getlogin.3  6.2 (Berkeley) %G%
 .\"
 .\"
-.TH GETLOGIN 3 
+.TH GETLOGIN 3  ""
 .AT 3
 .SH NAME
 getlogin \- get login name
 .AT 3
 .SH NAME
 getlogin \- get login name
@@ -8,38 +8,31 @@ getlogin \- get login name
 .B char *getlogin()
 .SH DESCRIPTION
 .I Getlogin
 .B char *getlogin()
 .SH DESCRIPTION
 .I Getlogin
-returns a pointer to
-the login name
-as found in
+returns a pointer to the login name as found in
 .IR /etc/utmp .
 .IR /etc/utmp .
-It may be used
-in conjunction
-with
+It may be used in conjunction with
 .I getpwnam
 .I getpwnam
-to locate the correct
-password file entry
-when the same userid
-is shared by several
-login names.
+to locate the correct password file entry when the same userid
+is shared by several login names.
 .PP
 If
 .I getlogin
 .PP
 If
 .I getlogin
-is called within a process
-that is not attached to a
-typewriter, it returns NULL.
-The correct procedure
-for determining the login name
-is to first call
+is called within a process that is not attached to a
+terminal, or if there is no entry in
+.I /etc/utmp
+for the process's terminal,
 .I getlogin
 .I getlogin
-and if it fails,
-to call
-.IR getpwuid .
+returns a NULL pointer (0).
+A reasonable procedure for determining the login name is to first call
+.I getlogin
+and if it fails, to call
+.IR getpwuid ( getuid ()).
 .SH FILES
 /etc/utmp
 .SH "SEE ALSO"
 .SH FILES
 /etc/utmp
 .SH "SEE ALSO"
-getpwent(3), getgrent(3), utmp(5)
+getpwent(3), utmp(5), ttyslot(3)
 .SH DIAGNOSTICS
 .SH DIAGNOSTICS
-Returns NULL (0) if name not found.
+Returns a NULL pointer (0) if name not found.
 .SH BUGS
 The return values point to static data
 whose content is overwritten by each call.
 .SH BUGS
 The return values point to static data
 whose content is overwritten by each call.