From 68b24d53e15d16c929d2dab02ddf35082910bcc0 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 14 Dec 2014 22:58:01 +0000 Subject: [PATCH] chsh: clean up parse_argv() Signed-off-by: Sami Kerola --- login-utils/chsh.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) 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); -- 2.47.2