From 631a195412f53135179f761573a56e457911603f Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Thu, 19 Jan 2017 23:04:47 +0100 Subject: [PATCH] chsh: use -h as shorthand for --help instead of -u The -u is still supported (but no longer documented). (This matches the switches used by shadow chsh.) --- login-utils/chsh.1 | 4 ++-- login-utils/chsh.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/login-utils/chsh.1 b/login-utils/chsh.1 index d63c23e695..c03ef65e51 100644 --- a/login-utils/chsh.1 +++ b/login-utils/chsh.1 @@ -14,7 +14,7 @@ chsh \- change your login shell .RB [ \-s .IR shell ] .RB [ \-l ] -.RB [ \-u ] +.RB [ \-h ] .RB [ \-v ] .RI [ username ] .SH DESCRIPTION @@ -38,7 +38,7 @@ Print the list of shells listed in .I /etc/shells and exit. .TP -.BR \-u , " \-\-help" +.BR \-h , " \-\-help" Display help text and exit. .TP .BR \-v , " \-\-version" diff --git a/login-utils/chsh.c b/login-utils/chsh.c index 79fc19d2c0..c7defd49f6 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -131,18 +131,19 @@ static void parse_argv(int argc, char **argv, struct sinfo *pinfo) static const struct option long_options[] = { {"shell", required_argument, 0, 's'}, {"list-shells", no_argument, 0, 'l'}, - {"help", no_argument, 0, 'u'}, + {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {NULL, no_argument, 0, '0'}, }; int c; - while ((c = getopt_long(argc, argv, "s:luv", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "s:lhuv", long_options, NULL)) != -1) { switch (c) { case 'v': printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS); - case 'u': + case 'u': /* deprecated */ + case 'h': usage(stdout); case 'l': get_shell_list(NULL); -- 2.39.5