[PATCH 06/14] chsh: clean up parse_argv()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 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 0112fa4..5339e55 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.2.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux