summaryrefslogtreecommitdiffstats
path: root/login-utils/su.c
diff options
context:
space:
mode:
authorJim Meyering1993-10-17 04:57:04 +0100
committerJim Meyering1993-10-17 04:57:04 +0100
commitbc7510e02d2809f07dc543bedd8579dcf453c7e4 (patch)
treee027c2b0c29cc01ae04a8e73b43c19b4fe79f499 /login-utils/su.c
parentmerge with 1.8.1d (diff)
downloadkernel-qcow2-util-linux-bc7510e02d2809f07dc543bedd8579dcf453c7e4.tar.gz
kernel-qcow2-util-linux-bc7510e02d2809f07dc543bedd8579dcf453c7e4.tar.xz
kernel-qcow2-util-linux-bc7510e02d2809f07dc543bedd8579dcf453c7e4.zip
merge with 1.8.1g
Diffstat (limited to 'login-utils/su.c')
-rw-r--r--login-utils/su.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/login-utils/su.c b/login-utils/su.c
index 6f6a146f3..f80963b1d 100644
--- a/login-utils/su.c
+++ b/login-utils/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);
}