From: Jim Meyering Date: Sat, 1 Feb 1997 03:03:44 +0000 (+0000) Subject: Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0'... X-Git-Tag: SH-UTILS-1_16a~318 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f51b86bfb737aadf750d70b6a7bd4e0ec36962f;p=platform%2Fupstream%2Fcoreutils.git Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call. --- diff --git a/src/chgrp.c b/src/chgrp.c index 97374ce..40a1dc1 100644 --- a/src/chgrp.c +++ b/src/chgrp.c @@ -306,8 +306,7 @@ main (int argc, char **argv) recurse = force_silent = verbose = changes_only = 0; - while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, (int *) 0)) - != EOF) + while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1) { switch (optc) { diff --git a/src/chown.c b/src/chown.c index bd10f7f..9663cd1 100644 --- a/src/chown.c +++ b/src/chown.c @@ -272,8 +272,7 @@ main (int argc, char **argv) recurse = force_silent = verbose = changes_only = 0; - while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, (int *) 0)) - != EOF) + while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1) { switch (optc) { diff --git a/src/cp.c b/src/cp.c index 7e34891..3ec93b7 100644 --- a/src/cp.c +++ b/src/cp.c @@ -250,7 +250,7 @@ main (int argc, char **argv) umask_kill = 0777777 ^ umask (0); while ((c = getopt_long (argc, argv, "abdfilprsuvxPRS:V:", long_opts, - (int *) 0)) != EOF) + NULL)) != -1) { switch (c) { diff --git a/src/dd.c b/src/dd.c index 5ce8427..869477a 100644 --- a/src/dd.c +++ b/src/dd.c @@ -809,7 +809,7 @@ scanargs (int argc, char **argv) int i, n; int c; - while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) { switch (c) { diff --git a/src/df.c b/src/df.c index 2641d0f..6547fc8 100644 --- a/src/df.c +++ b/src/df.c @@ -611,7 +611,7 @@ main (int argc, char **argv) exit_status = 0; while ((i = getopt_long (argc, argv, "aiF:hkmPTt:vx:", long_options, NULL)) - != EOF) + != -1) { switch (i) { diff --git a/src/dircolors.c b/src/dircolors.c index 2eac192..18fb4ee 100644 --- a/src/dircolors.c +++ b/src/dircolors.c @@ -424,8 +424,7 @@ main (int argc, char **argv) parse_long_options (argc, argv, "dircolors", GNU_PACKAGE, VERSION, usage); - while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL)) - != EOF) + while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL)) != -1) switch (optc) { case 'b': /* Bourne shell syntax. */ diff --git a/src/du.c b/src/du.c index 3b9f822..efbd49d 100644 --- a/src/du.c +++ b/src/du.c @@ -268,9 +268,8 @@ main (int argc, char **argv) else output_size = size_kilobytes; - while ((c = getopt_long (argc, argv, "abchklmsxDLS", long_options, - (int *) 0)) - != EOF) + while ((c = getopt_long (argc, argv, "abchklmsxDLS", long_options, NULL)) + != -1) { switch (c) { diff --git a/src/install.c b/src/install.c index e92cc83..23d2ebf 100644 --- a/src/install.c +++ b/src/install.c @@ -204,7 +204,7 @@ main (int argc, char **argv) version = getenv ("VERSION_CONTROL"); while ((optc = getopt_long (argc, argv, "bcsdg:m:o:V:S:", long_options, - (int *) 0)) != EOF) + NULL)) != -1) { switch (optc) { diff --git a/src/ln.c b/src/ln.c index 62b4e8e..cdf8e8b 100644 --- a/src/ln.c +++ b/src/ln.c @@ -371,9 +371,8 @@ main (int argc, char **argv) = hard_dir_link = 0; errors = 0; - while ((c = getopt_long (argc, argv, - "bdfinsvFS:V:", long_options, (int *) 0)) - != EOF) + while ((c = getopt_long (argc, argv, "bdfinsvFS:V:", long_options, NULL)) + != -1) { switch (c) { diff --git a/src/ls.c b/src/ls.c index aae67d5..e906335 100644 --- a/src/ls.c +++ b/src/ls.c @@ -866,7 +866,7 @@ decode_switches (int argc, char **argv) while ((c = getopt_long (argc, argv, "abcdfgiklmnopqrstuw:xABCDFGI:LNQRST:UX1", - long_options, (int *) 0)) != EOF) + long_options, NULL)) != -1) { switch (c) { diff --git a/src/mkdir.c b/src/mkdir.c index 9f1ae18..3c12625 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -89,7 +89,7 @@ main (int argc, char **argv) path_mode = 0; - while ((optc = getopt_long (argc, argv, "pm:", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "pm:", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/mkfifo.c b/src/mkfifo.c index 458ec9f..5243b64 100644 --- a/src/mkfifo.c +++ b/src/mkfifo.c @@ -90,7 +90,7 @@ main (int argc, char **argv) #ifndef S_ISFIFO error (4, 0, _("fifo files not supported")); #else - while ((optc = getopt_long (argc, argv, "m:", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/mknod.c b/src/mknod.c index f3cb25a..a39b653 100644 --- a/src/mknod.c +++ b/src/mknod.c @@ -99,7 +99,7 @@ main (int argc, char **argv) symbolic_mode = NULL; - while ((optc = getopt_long (argc, argv, "m:", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/mv.c b/src/mv.c index 7b81c00..5558b92 100644 --- a/src/mv.c +++ b/src/mv.c @@ -431,8 +431,7 @@ main (int argc, char **argv) interactive = override_mode = verbose = update = 0; errors = 0; - while ((c = getopt_long (argc, argv, "bfiuvS:V:", long_options, (int *) 0)) - != EOF) + while ((c = getopt_long (argc, argv, "bfiuvS:V:", long_options, NULL)) != -1) { switch (c) { diff --git a/src/rm.c b/src/rm.c index 6789c24..53325b3 100644 --- a/src/rm.c +++ b/src/rm.c @@ -126,7 +126,7 @@ main (int argc, char **argv) pnsize = 256; pathname = xmalloc (pnsize); - while ((c = getopt_long (argc, argv, "dfirvR", long_opts, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "dfirvR", long_opts, NULL)) != -1) { switch (c) { diff --git a/src/rmdir.c b/src/rmdir.c index 513575a..0b4108d 100644 --- a/src/rmdir.c +++ b/src/rmdir.c @@ -109,7 +109,7 @@ main (int argc, char **argv) empty_paths = 0; - while ((optc = getopt_long (argc, argv, "p", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "p", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/touch.c b/src/touch.c index be49942..3855f57 100644 --- a/src/touch.c +++ b/src/touch.c @@ -279,8 +279,7 @@ main (int argc, char **argv) change_times = no_create = use_ref = posix_date = flexible_date = 0; newtime = (time_t) -1; - while ((c = getopt_long (argc, argv, "acd:fmr:t:", longopts, (int *) 0)) - != EOF) + while ((c = getopt_long (argc, argv, "acd:fmr:t:", longopts, NULL)) != -1) { switch (c) {