From: Sami Kerola Date: Sun, 14 Dec 2014 22:58:01 +0000 (+0000) Subject: chsh: clean up parse_argv() X-Git-Tag: v2.26-rc1~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68b24d53e15d16c929d2dab02ddf35082910bcc0;p=thirdparty%2Futil-linux.git chsh: clean up parse_argv() Signed-off-by: Sami Kerola --- diff --git a/login-utils/chsh.c b/login-utils/chsh.c index 0112fa45d1..5339e5508f 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -129,22 +129,17 @@ static int get_shell_list(const char *shell_name) */ static void parse_argv(int argc, char **argv, struct sinfo *pinfo) { - int index, c; - - static struct option long_options[] = { + const struct option long_options[] = { {"shell", required_argument, 0, 's'}, {"list-shells", no_argument, 0, 'l'}, {"help", no_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, {NULL, no_argument, 0, '0'}, }; + int c; - optind = c = 0; - while (c != EOF) { - c = getopt_long(argc, argv, "s:luv", long_options, &index); + while ((c = getopt_long(argc, argv, "s:luv", long_options, NULL)) != -1) { switch (c) { - case -1: - break; case 'v': printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS);