]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0'...
authorJim Meyering <jim@meyering.net>
Sat, 1 Feb 1997 03:03:44 +0000 (03:03 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 1 Feb 1997 03:03:44 +0000 (03:03 +0000)
17 files changed:
src/chgrp.c
src/chown.c
src/cp.c
src/dd.c
src/df.c
src/dircolors.c
src/du.c
src/install.c
src/ln.c
src/ls.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/mv.c
src/rm.c
src/rmdir.c
src/touch.c

index 97374ceeaa655fd8b08c420eff99c446f612b552..40a1dc14b05898a94464f6519eb3e24fdd7a73c2 100644 (file)
@@ -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)
        {
index bd10f7ff4bc240f4c45a8a54306c873b1830e47f..9663cd17e60695edd3d78ca321527f52652451e4 100644 (file)
@@ -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)
        {
index 7e3489158b736ca4053120c4afef8c7a43a1f38b..3ec93b7d1ae834c5bc59466b1ffc66b2475aac1a 100644 (file)
--- 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)
        {
index 5ce8427c2657ea24305ae4b5bc6c71be6dc2f989..869477a2b16ff56c61d24cfb9ccb833762e4ff6f 100644 (file)
--- 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)
        {
index 2641d0f15002857da895a2bc0afc53cdcd950374..6547fc8bf5431a1fa4503d4527309f9b697b7322 100644 (file)
--- 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)
        {
index 2eac1920dfeb560ec4a1457e833cd9fb876f972f..18fb4ee61f517e0f2d545ab5c470c83af9f608ce 100644 (file)
@@ -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.  */
index 3b9f8226aa351bf78873fd71ab6944781b46a06e..efbd49dcea1782f59430307c98062f1b295f75b3 100644 (file)
--- 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)
        {
index e92cc83e3ecca1549cc832c76a75c40bcac355e0..23d2ebf6070b3b2de1bed047609046fea51e79d2 100644 (file)
@@ -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)
        {
index 62b4e8ef678e40c0b97d4e9a8b54cd6d63775477..cdf8e8b0af49f0036d84f6b4cedd849e2569bea8 100644 (file)
--- 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)
        {
index aae67d557b1b028919511b86cbc2f8d5cd5f833f..e906335a0d82c97197ebd1cc6393aaf5663e7793 100644 (file)
--- 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)
        {
index 9f1ae187f4b6afde52a0ac2b1f07d918690b4dc6..3c12625b75af9ea14c7185b816374480b417802e 100644 (file)
@@ -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)
        {
index 458ec9f716c2f9fe38a3e9ed96ecb5e33a1cd3ad..5243b6477378733da539e76861f8215bf2b99731 100644 (file)
@@ -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)
        {
index f3cb25a71fdd01efebdff051fe6300ed0ec892a3..a39b653ec24e06300d59f50bafb48d0546e6539b 100644 (file)
@@ -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)
        {
index 7b81c005f8fe23df8d072c996e65464bf8963bf3..5558b921ac8d083f003e7eb76cbd20f9dc0d7b23 100644 (file)
--- 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)
        {
index 6789c2447eee243750a7201daf7de029b5811967..53325b38ca61750e457044baeccfaa9bfd966f05 100644 (file)
--- 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)
        {
index 513575ab8d9947e9499c3f5a35fb0a7a5b26d565..0b4108d0211a838cd7bc45682efc1f3f1d091c6f 100644 (file)
@@ -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)
        {
index be49942ffda738e2efc1f20f65386df1123fd4ff..3855f5766831047e4bac6e57fcb36ee65b4f3768 100644 (file)
@@ -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)
        {