]> 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 02:00:04 +0000 (02:00 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 1 Feb 1997 02:00:04 +0000 (02:00 +0000)
21 files changed:
src/cat.c
src/cksum.c
src/comm.c
src/csplit.c
src/cut.c
src/expand.c
src/fmt.c
src/fold.c
src/head.c
src/join.c
src/md5sum.c
src/nl.c
src/od.c
src/paste.c
src/sum.c
src/tac.c
src/tail.c
src/tr.c
src/unexpand.c
src/uniq.c
src/wc.c

index d8594cba6d8a2ca5909b9f013b8e0924fd6d738b..186cc98fe20379a9e33e32885d538dce8ae2452b 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -512,8 +512,7 @@ main (int argc, char **argv)
 
   /* Parse command line options.  */
 
-  while ((c = getopt_long (argc, argv, "benstuvAET", long_options, (int *) 0))
-        != EOF)
+  while ((c = getopt_long (argc, argv, "benstuvAET", long_options, NULL)) != -1)
     {
       switch (c)
        {
index 2318d5b2140e918aeaf2e7a16fa5a9af29b0f454..c3f06eb6ad4207128548e9d4f10b30b20eb982b1 100644 (file)
@@ -293,7 +293,7 @@ main (int argc, char **argv)
 
   have_read_stdin = 0;
 
-  while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
+  while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
     {
       switch (c)
        {
index b329e46e49801b0eba6a6254c33524cf123e506e..c11953e610f0d9aef7eece5ed7b9ef4d859d4e13 100644 (file)
@@ -226,7 +226,7 @@ main (int argc, char **argv)
   only_file_2 = 1;
   both = 1;
 
-  while ((c = getopt_long (argc, argv, "123", long_options, (int *) 0)) != EOF)
+  while ((c = getopt_long (argc, argv, "123", long_options, NULL)) != -1)
     switch (c)
       {
       case 0:
index ddd4311c3c1b2a86dc184553dd6718bc53cb00bc..08546f3e723b12cd663b9b494f3f05d4ebe1622c 100644 (file)
@@ -1476,8 +1476,7 @@ main (int argc, char **argv)
     signal (SIGTERM, interrupt_handler);
 #endif /* not SA_INTERRUPT */
 
-  while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, (int *) 0))
-        != EOF)
+  while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, NULL)) != -1)
     switch (optc)
       {
       case 0:
index 59711a01ea7b7c50174ace89138d4547a203710c..991baa9031d9c68aea354b74cfc492320e16f15c 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -688,8 +688,7 @@ main (int argc, char **argv)
   delim = '\0';
   have_read_stdin = 0;
 
-  while ((optc = getopt_long (argc, argv, "b:c:d:f:ns", longopts, (int *) 0))
-        != EOF)
+  while ((optc = getopt_long (argc, argv, "b:c:d:f:ns", longopts, NULL)) != -1)
     {
       switch (optc)
        {
index 9beb877015447223d8409f90d27a6949e64835ca..2b525251436979d3c6779431579d89060f9d6317 100644 (file)
@@ -338,8 +338,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  while ((c = getopt_long (argc, argv, "it:,0123456789", longopts, (int *) 0))
-        != EOF)
+  while ((c = getopt_long (argc, argv, "it:,0123456789", longopts, NULL)) != -1)
     {
       switch (c)
        {
index b8de7574f2ddff71eb819860148143557275f3a1..3830880723bc9b700c61e7c5e398f90f73510b09 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -353,7 +353,7 @@ main (register int argc, register char **argv)
 
   while ((optchar = getopt_long (argc, argv, "0123456789cstuw:p:",
                                 long_options, NULL))
-        != EOF)
+        != -1)
     switch (optchar)
       {
       default:
index b86810285ba581ef7a5809312e23c8579816bee0..8d634990f4d6311e7a22f164a70f9a34ce8db921 100644 (file)
@@ -276,8 +276,7 @@ main (int argc, char **argv)
        }
     }
 
-  while ((optc = getopt_long (argc, argv, "bsw:", longopts, (int *) 0))
-        != EOF)
+  while ((optc = getopt_long (argc, argv, "bsw:", longopts, NULL)) != -1)
     {
       switch (optc)
        {
index 52aae62a0ecb9645437a636e12bf7ba81a8b993c..aba3d5cc0a29ba8278aacab1059f54d3503b5ba6 100644 (file)
@@ -317,8 +317,7 @@ main (int argc, char **argv)
       argc--;
     }
 
-  while ((c = getopt_long (argc, argv, "c:n:qv", long_options, (int *) 0))
-        != EOF)
+  while ((c = getopt_long (argc, argv, "c:n:qv", long_options, NULL)) != -1)
     {
       switch (c)
        {
index d84f62d39180532520efd0d9324a61ffacd8c808..b46275ec5497675269c3d075c2afd160467172cb 100644 (file)
@@ -773,7 +773,7 @@ main (int argc, char **argv)
   print_pairables = 1;
 
   while ((optc = getopt_long_only (argc, argv, "-a:e:i1:2:o:t:v:", longopts,
-                                  (int *) 0)) != EOF)
+                                  NULL)) != -1)
     {
       long int val;
 
index 16f35476ebfff1f10e17fc2dc2875a78a06b9a5a..0410fea4a53b5e951b01bdc3b11348713c43f05f 100644 (file)
@@ -448,7 +448,6 @@ main (int argc, char **argv)
   int opt;
   char **string = NULL;
   size_t n_strings = 0;
-  size_t i;
   size_t err = 0;
   int file_type_specified = 0;
 
@@ -463,8 +462,7 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, "md5sum", GNU_PACKAGE, VERSION, usage);
 
-  while ((opt = getopt_long (argc, argv, "bctw", long_options, NULL))
-        != EOF)
+  while ((opt = getopt_long (argc, argv, "bctw", long_options, NULL)) != -1)
     switch (opt)
       {
       case 0:                  /* long option */
@@ -532,6 +530,8 @@ verifying checksums"));
 
   if (n_strings > 0)
     {
+      size_t i;
+
       if (optind < argc)
        {
          error (0, 0, _("no files may be specified when using --string"));
index 62e5e2ebf8c6ce7aca405833177dbc4c35ba6401..d1410816e13c8124d1d0c575bb95afd5fd7101f3 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -473,7 +473,7 @@ main (int argc, char **argv)
   have_read_stdin = 0;
 
   while ((c = getopt_long (argc, argv, "h:b:f:v:i:pl:s:w:n:d:", longopts,
-                          (int *) 0)) != EOF)
+                          NULL)) != -1)
     {
       switch (c)
        {
index c3ad92b97cb452490479bc2d4aea8df61866bf11..4241ec504ecbb1d56b123c8eadd54668daae13ba 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -1651,8 +1651,7 @@ main (int argc, char **argv)
   flag_dump_strings = 0;
 
   while ((c = getopt_long (argc, argv, "abcdfhilos::xw::A:j:N:t:v",
-                          long_options, (int *) 0))
-        != EOF)
+                          long_options, NULL)) != -1)
     {
       unsigned long int tmp;
       enum strtol_error s_err;
index 4d6edf2f80974ce9ccf41155862b90f56562c5f1..725269b1f023d3e9ae09767381b64c2931785a77 100644 (file)
@@ -447,8 +447,7 @@ main (int argc, char **argv)
   strcpy (delims, "\t");
   strcpy (zero_delims, "\\0");
 
-  while ((optc = getopt_long (argc, argv, "d:s", longopts, (int *) 0))
-        != EOF)
+  while ((optc = getopt_long (argc, argv, "d:s", longopts, NULL)) != -1)
     {
       switch (optc)
        {
index e4f51e8bd9b5d91a6a008ef8079e15eab0df44a4..9e7d252bbbd77f816d4c0bfaddcde1acb41fd3b8 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -213,7 +213,7 @@ main (int argc, char **argv)
 
   have_read_stdin = 0;
 
-  while ((optc = getopt_long (argc, argv, "rs", longopts, (int *) 0)) != -1)
+  while ((optc = getopt_long (argc, argv, "rs", longopts, NULL)) != -1)
     {
       switch (optc)
        {
index d81ff6c07ef78b2dde9bb2e0ed5a69cf8f26be2e..6b166d7d186f38d4b1824ad6f3cd1ee9d221987c 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -597,8 +597,7 @@ main (int argc, char **argv)
   sentinel_length = 1;
   separator_ends_record = 1;
 
-  while ((optc = getopt_long (argc, argv, "brs:", longopts, (int *) 0))
-        != EOF)
+  while ((optc = getopt_long (argc, argv, "brs:", longopts, NULL)) != -1)
     {
       switch (optc)
        {
index cede32010e0df425825650f4309f0be5055aaa96..b774606d6d3044f6e5f6e15618128a054c0fe2a8 100644 (file)
@@ -993,8 +993,7 @@ parse_options (int argc, char **argv,
   count_lines = 1;
   forever = forever_multiple = from_start = print_headers = 0;
 
-  while ((c = getopt_long (argc, argv, "c:n:fqv", long_options, (int *) 0))
-        != EOF)
+  while ((c = getopt_long (argc, argv, "c:n:fqv", long_options, NULL)) != -1)
     {
       switch (c)
        {
index dcd40aa976e2526eefa5d40e5eb92916170a04fc..da0f01b15e41439db07ad88a44a45a1d14591cf7 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -1837,8 +1837,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  while ((c = getopt_long (argc, argv, "cdst", long_options,
-                          (int *) 0)) != EOF)
+  while ((c = getopt_long (argc, argv, "cdst", long_options, NULL)) != -1)
     {
       switch (c)
        {
index 0d04ced64f106d5781a0bdfe39942ac5b68f6578..9c13c51a29196a50f59d6d82442646be6dd9d81f 100644 (file)
@@ -408,8 +408,7 @@ main (int argc, char **argv)
   tab_list = NULL;
   first_free_tab = 0;
 
-  while ((c = getopt_long (argc, argv, "at:,0123456789", longopts, (int *) 0))
-        != EOF)
+  while ((c = getopt_long (argc, argv, "at:,0123456789", longopts, NULL)) != -1)
     {
       switch (c)
        {
index 237eb11249d1198474776cc5168656e1328e402c..f716f38ea54379a8b1057cae885d1918712fa49e 100644 (file)
@@ -305,7 +305,7 @@ main (int argc, char **argv)
   countmode = count_none;
 
   while ((optc = getopt_long (argc, argv, "0123456789cdf:is:uw:", longopts,
-                             (int *) 0)) != EOF)
+                             NULL)) != -1)
     {
       switch (optc)
        {
index e101b903320a1e6da71162c182e03b0f6ca4aa33..114b27dbe7aa33141effca9029fab2ef76f6237c 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -269,7 +269,7 @@ main (int argc, char **argv)
   print_lines = print_words = print_chars = 0;
   total_lines = total_words = total_chars = 0;
 
-  while ((optc = getopt_long (argc, argv, "clw", longopts, (int *) 0)) != EOF)
+  while ((optc = getopt_long (argc, argv, "clw", longopts, NULL)) != -1)
     switch (optc)
       {
       case 0: