aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-08-12 06:45:43 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-08-12 06:45:43 +0000
commit7be91299b0712b5058efc9a3ab15e8838c70150c (patch)
tree175a977ec115a0f3159dde55ddf03929b0899bc7
parent885dbf9c1f87242a0bb9372dc61c81b295436672 (diff)
downloadsrc-7be91299b0712b5058efc9a3ab15e8838c70150c.tar.gz
src-7be91299b0712b5058efc9a3ab15e8838c70150c.zip
Add usage().
Notes
Notes: svn path=/head/; revision=28099
-rw-r--r--usr.bin/su/su.114
-rw-r--r--usr.bin/su/su.c20
2 files changed, 20 insertions, 14 deletions
diff --git a/usr.bin/su/su.1 b/usr.bin/su/su.1
index 0c60ec73a82a..530faf17faf1 100644
--- a/usr.bin/su/su.1
+++ b/usr.bin/su/su.1
@@ -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
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index fb137d898904..a358d7aac0ac 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -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;