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 97374ce..40a1dc1 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 bd10f7f..9663cd1 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 7e34891..3ec93b7 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 5ce8427..869477a 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 2641d0f..6547fc8 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 2eac192..18fb4ee 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 3b9f822..efbd49d 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 e92cc83..23d2ebf 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 62b4e8e..cdf8e8b 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 aae67d5..e906335 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 9f1ae18..3c12625 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 458ec9f..5243b64 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 f3cb25a..a39b653 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 7b81c00..5558b92 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 6789c24..53325b3 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 513575a..0b4108d 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 be49942..3855f57 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)
        {