summaryrefslogtreecommitdiffstats
path: root/login-utils/sulogin.c
diff options
context:
space:
mode:
authorDave Reisner2012-02-28 17:45:20 +0100
committerKarel Zak2012-03-12 11:17:45 +0100
commit9211be3043b0cdc3a5611b1200f399bb41334741 (patch)
treee852e964c1bc3e5ff82b1df7840337b29e6a2627 /login-utils/sulogin.c
parentsulogin: header/include cleanup (diff)
downloadkernel-qcow2-util-linux-9211be3043b0cdc3a5611b1200f399bb41334741.tar.gz
kernel-qcow2-util-linux-9211be3043b0cdc3a5611b1200f399bb41334741.tar.xz
kernel-qcow2-util-linux-9211be3043b0cdc3a5611b1200f399bb41334741.zip
sulogin: use a more standard usage output
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'login-utils/sulogin.c')
-rw-r--r--login-utils/sulogin.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index def733658..628329cc4 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -50,6 +50,8 @@
# include <selinux/get_context_list.h>
#endif
+#include "c.h"
+#include "nls.h"
#include "pathnames.h"
static int timeout;
@@ -398,9 +400,20 @@ static void sushell(struct passwd *pwd)
perror("/bin/sh");
}
-static void usage(void)
+static void usage(FILE *out)
{
- fprintf(stderr, "Usage: sulogin [-e] [-p] [-t timeout] [tty device]\n");
+ fprintf(out, USAGE_HEADER);
+ fprintf(out, _(
+ " %s [options] [tty device]\n"), program_invocation_short_name);
+
+ fprintf(out, USAGE_OPTIONS);
+ fprintf(out, _(
+ " -p start a login shell\n"
+ " -t SEC set max time to wait for a password (default: no limit)\n"
+ " -e examine shadow files directly if getpwnam(3) fails\n"
+ " -h display this help message\n"));
+
+ fprintf(out, _("\nFor more information see sulogin(8).\n"));
}
int main(int argc, char **argv)
@@ -417,7 +430,7 @@ int main(int argc, char **argv)
* See if we have a timeout flag.
*/
opterr = 0;
- while ((c = getopt(argc, argv, "ept:")) != EOF) {
+ while ((c = getopt(argc, argv, "ehpt:")) != EOF) {
switch(c) {
case 't':
timeout = atoi(optarg);
@@ -428,8 +441,11 @@ int main(int argc, char **argv)
case 'e':
opt_e = 1;
break;
+ case 'h':
+ usage(stdout);
+ return 0;
default:
- usage();
+ usage(stderr);
/* Do not exit! */
break;
}