summaryrefslogtreecommitdiff
path: root/src/su.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-17 03:57:04 +0000
committerJim Meyering <jim@meyering.net>1993-10-17 03:57:04 +0000
commitfa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8 (patch)
treeffc67e10bcf805a9ee5b8243a5103f5bdb4fb90a /src/su.c
parent6e1a4cca6862fa1fb40b4c38b73fa30ebb61344b (diff)
downloadcoreutils-fa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8.tar.xz
merge with 1.8.1g
Diffstat (limited to 'src/su.c')
-rw-r--r--src/su.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/su.c b/src/su.c
index 6f6a146f3..f80963b1d 100644
--- a/src/su.c
+++ b/src/su.c
@@ -241,7 +241,7 @@ main (argc, argv)
break;
default:
- usage ();
+ usage (1);
}
}
@@ -252,7 +252,7 @@ main (argc, argv)
}
if (show_help)
- usage ();
+ usage (0);
if (optind < argc && !strcmp (argv[optind], "-"))
{
@@ -548,11 +548,32 @@ concat (s1, s2, s3)
}
static void
-usage ()
+usage (status)
+ int status;
{
- fprintf (stderr, "\
-Usage: %s [-flmp] [-c command] [-s shell] [--login] [--fast]\n\
- [--preserve-environment] [--command=command] [--shell=shell] [-]\n\
- [user [arg...]]\n", program_name);
- exit (1);
+ fprintf (status == 0 ? stdout : stderr, "\
+Usage: %s [OPTION]... [-] [USER [ARG]...]\n\
+",
+ program_name);
+
+ if (status != 0)
+ fprintf (stderr, "\nTry `%s --help' for more information.\n",
+ program_name);
+ else
+
+ printf ("\
+\n\
+ -l, --login make the shell a login shell\n\
+ -c, --commmand COMMAND pass a single COMMAND to the shell with -c\n\
+ -f, --fast pass -f to the shell (for csh or tcsh)\n\
+ -m, --preserve-environment do not reset environment variables\n\
+ -p same as -m\n\
+ -s, --shell SHELL run SHELL if /etc/shells allows it\n\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
+\n\
+A mere - implies -l. If USER not given, assume root.\n\
+");
+
+ exit (status);
}