man page macro and text revisions (-mdoc version 3)
[unix-history] / usr / src / lib / libc / sys / getlogin.2
index 3a3ada7..85a1194 100644 (file)
@@ -1,88 +1,99 @@
-.\" Copyright (c) 1989 The Regents of the University of California.
+.\" Copyright (c) 1989, 1991 The Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" %sccs.include.redist.man%
 .\"
 .\" All rights reserved.
 .\"
 .\" %sccs.include.redist.man%
 .\"
-.\"    @(#)getlogin.2  6.1 (Berkeley) %G%
+.\"     @(#)getlogin.2 6.2 (Berkeley) %G%
 .\"
 .\"
-.TH GETLOGIN 2 ""
-.UC 5
-.SH NAME
-getlogin, setlogin \- get/set login name
-.SH SYNOPSIS
-.nf
-.ft B
-char *getlogin()
-.PP
-.ft B
-setlogin(name)
-char *name;
-.fi
-.SH DESCRIPTION
+.Dd 
+.Dt GETLOGIN 2
+.Os BSD 4.2
+.Sh NAME
+.Nm getlogin ,
+.Nm setlogin
+.Nd get/set login name
+.Sh SYNOPSIS
+.Fd #include <unistd.h>
+.Ft char *
+.Fn getlogin void
+.Ft int
+.Fn setlogin "const char *name"
+.Sh DESCRIPTION
 The
 The
-.I getlogin
+.Fn getlogin
 routine
 returns the login name of the user associated with the current session,
 as previously set by
 routine
 returns the login name of the user associated with the current session,
 as previously set by
-.IR setlogin .
+.Fn setlogin .
 The name is normally associated with a login shell
 at the time a session is created,
 and is inherited by all processes descended from the login shell.
 (This is true even if some of those processes assume another user ID,
 for example when
 The name is normally associated with a login shell
 at the time a session is created,
 and is inherited by all processes descended from the login shell.
 (This is true even if some of those processes assume another user ID,
 for example when
-.IR su (1)
+.Xr su 1
 is used.)
 is used.)
-.PP
-.I Setlogin
+.Pp
+.Fn Setlogin
 sets the login name of the user associated with the current session to
 sets the login name of the user associated with the current session to
-.IR name .
+.Fa name .
 This call is restricted to the super-user, and
 is normally used only when a new session is being created on behalf
 of the named user
 (for example, at login time, or when a remote shell is invoked).
 This call is restricted to the super-user, and
 is normally used only when a new session is being created on behalf
 of the named user
 (for example, at login time, or when a remote shell is invoked).
-.SH "RETURN VALUE
+.Sh RETURN VALUES
 If a call to
 If a call to
-.I getlogin
+.Fn getlogin
 succeeds, it returns a pointer to a null-terminated string in a static buffer.
 If the name has not been set, it returns NULL.
 If a call to
 succeeds, it returns a pointer to a null-terminated string in a static buffer.
 If the name has not been set, it returns NULL.
 If a call to
-.I setlogin
+.Fn setlogin
 succeeds, a value of 0 is returned.  If
 succeeds, a value of 0 is returned.  If
-.I setlogin
-fails, then a value of \-1 is returned and an error code is
-placed in the global location \fIerrno\fP.
-.SH "ERRORS
+.Fn setlogin
+fails, a value of -1 is returned and an error code is
+placed in the global location
+.Va errno .
+.Sh ERRORS
 The following errors may be returned by these calls:
 The following errors may be returned by these calls:
-.TP 15
-[EFAULT]
-The \fIname\fP parameter gave an
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The
+.Fa name
+parameter gave an
 invalid address.
 invalid address.
-.TP 15
-[EINVAL]
-The \fIname\fP parameter
+.It Bq Er EINVAL
+The
+.Fa name
+parameter
 pointed to a string that was too long.
 pointed to a string that was too long.
-Login names are limited to MAXLOGNAME (from
-.IR <sys/param.h> )
+Login names are limited to
+.Dv MAXLOGNAME
+(from
+.Ao Pa sys/param.h Ac )
 characters, currently 12.
 characters, currently 12.
-.TP 15
-[EPERM]
+.It Bq Er EPERM
 The caller tried to set the login name and was not the super-user.
 The caller tried to set the login name and was not the super-user.
-.SH SEE ALSO
-setsid(2)
-.SH BUGS
+.El
+.Sh SEE ALSO
+.Xr setsid 2
+.Sh BUGS
 Login names are limited in length by
 Login names are limited in length by
-.IR setlogin .
+.Fn setlogin .
 However, lower limits are placed on login names elsewhere in the system
 However, lower limits are placed on login names elsewhere in the system
-(UT_NAMESIZE in
-.IR <utmp.h> ).
-.PP
+.Pf ( Dv UT_NAMESIZE
+in
+.Ao Pa utmp.h Ac ) .
+.Pp
 In earlier versions of the system,
 In earlier versions of the system,
-.I getlogin
+.Fn getlogin
 failed unless the process was associated with a login terminal.
 The current implementation (using
 failed unless the process was associated with a login terminal.
 The current implementation (using
-.IR setlogin )
+.Fn setlogin )
 allows getlogin to succeed even when the process has no controlling terminal.
 In earlier versions of the system, the value returned by
 allows getlogin to succeed even when the process has no controlling terminal.
 In earlier versions of the system, the value returned by
-.I getlogin
+.Fn getlogin
 could not be trusted without checking the user ID.
 Portable programs should probably still make this check.
 could not be trusted without checking the user ID.
 Portable programs should probably still make this check.
+.Sh HISTORY
+The
+.Nm
+function call is currently under development.