Add usage().

This commit is contained in:
Philippe Charnier 1997-08-12 06:45:43 +00:00
parent 885dbf9c1f
commit 7be91299b0
2 changed files with 20 additions and 14 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)su.1 8.2 (Berkeley) 4/18/94
.\" $Id: su.1,v 1.7 1997/02/22 19:57:15 peter Exp $
.\" $Id: su.1,v 1.8 1997/02/24 20:32:23 guido Exp $
.\"
.\" this is for hilit19's braindeadness: "
.Dd April 18, 1994
@ -40,7 +40,7 @@
.Nm su
.Nd substitute user identity
.Sh SYNOPSIS
.Nm su
.Nm
.Op Fl Kflm
.Op Ar login Op Ar args
.Sh DESCRIPTION
@ -57,7 +57,7 @@ will resort to the local password file to find the password for
.Ar login
if there is a Kerberos error.
If
.Nm su
.Nm
is executed by root, no password is requested and a shell
with the appropriate user ID is executed; no additional Kerberos tickets
are obtained.
@ -115,7 +115,7 @@ is imported from your current environment.
Envronment variables may be set or overridden from the login class
capabilities database according to the class of the target login.
The invoked shell is the target login's, and
.Nm su
.Nm
will change directory to the target login's home directory.
Resource limits and session priority are modified to that for the
target account's login class.
@ -127,7 +127,7 @@ shell (as defined by
.Xr getusershell 3 )
and the caller's real uid is
non-zero,
.Nm su
.Nm
will fail.
.El
.Pp
@ -152,7 +152,7 @@ passing multiple words.
Only users listed in group 0 (normally
.Dq wheel )
can
.Nm su
.Nm
to
.Dq root ,
unless this group is empty.
@ -185,7 +185,7 @@ Provides terminal type which may be retained for the substituted
user ID.
.It Ev USER
The user ID is always the effective ID (the target user ID) after an
.Nm su
.Nm
unless the user ID is 0 (root).
.El
.Sh EXAMPLES

View File

@ -38,11 +38,11 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
/*
#if 0
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";
*/
#endif
static const char rcsid[] =
"$Id: su.c,v 1.19 1997/03/29 04:32:40 imp Exp $";
"$Id: su.c,v 1.20 1997/05/10 19:01:32 davidn Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -89,6 +89,7 @@ int use_kerberos = 1;
char *ontty __P((void));
int chshell __P((char *));
static void usage __P((void));
int
main(argc, argv)
@ -142,10 +143,8 @@ main(argc, argv)
break;
case '?':
default:
(void)fprintf(stderr, "usage: su [%s] [login]\n",
ARGSTR);
exit(1);
}
usage();
}
else
{
user = argv[optind++];
@ -402,6 +401,13 @@ main(argc, argv)
err(1, "%s", shell);
}
static void
usage()
{
(void)fprintf(stderr, "usage: su [%s] [login [args]]\n", ARGSTR);
exit(1);
}
int
chshell(sh)
char *sh;