summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-02-01 02:00:04 +0000
committerJim Meyering <jim@meyering.net>1997-02-01 02:00:04 +0000
commitc2d2dec516bd776d6acba7637d2e9ee721394604 (patch)
tree9c653ac2059ce12ae9004342e22881af2c68794a /src
parent1e40423be84cc3e594d7c64c923f39663549dcca (diff)
downloadcoreutils-c2d2dec516bd776d6acba7637d2e9ee721394604.tar.xz
Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call.
Diffstat (limited to 'src')
-rw-r--r--src/cat.c3
-rw-r--r--src/cksum.c2
-rw-r--r--src/comm.c2
-rw-r--r--src/csplit.c3
-rw-r--r--src/cut.c3
-rw-r--r--src/expand.c3
-rw-r--r--src/fmt.c2
-rw-r--r--src/fold.c3
-rw-r--r--src/head.c3
-rw-r--r--src/join.c2
-rw-r--r--src/md5sum.c6
-rw-r--r--src/nl.c2
-rw-r--r--src/od.c3
-rw-r--r--src/paste.c3
-rw-r--r--src/sum.c2
-rw-r--r--src/tac.c3
-rw-r--r--src/tail.c3
-rw-r--r--src/tr.c3
-rw-r--r--src/unexpand.c3
-rw-r--r--src/uniq.c2
-rw-r--r--src/wc.c2
21 files changed, 23 insertions, 35 deletions
diff --git a/src/cat.c b/src/cat.c
index d8594cba6..186cc98fe 100644
--- 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)
{
diff --git a/src/cksum.c b/src/cksum.c
index 2318d5b21..c3f06eb6a 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -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)
{
diff --git a/src/comm.c b/src/comm.c
index b329e46e4..c11953e61 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -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:
diff --git a/src/csplit.c b/src/csplit.c
index ddd4311c3..08546f3e7 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -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:
diff --git a/src/cut.c b/src/cut.c
index 59711a01e..991baa903 100644
--- 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)
{
diff --git a/src/expand.c b/src/expand.c
index 9beb87701..2b5252514 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -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)
{
diff --git a/src/fmt.c b/src/fmt.c
index b8de7574f..383088072 100644
--- 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:
diff --git a/src/fold.c b/src/fold.c
index b86810285..8d634990f 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -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)
{
diff --git a/src/head.c b/src/head.c
index 52aae62a0..aba3d5cc0 100644
--- a/src/head.c
+++ b/src/head.c
@@ -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)
{
diff --git a/src/join.c b/src/join.c
index d84f62d39..b46275ec5 100644
--- a/src/join.c
+++ b/src/join.c
@@ -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;
diff --git a/src/md5sum.c b/src/md5sum.c
index 16f35476e..0410fea4a 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -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"));
diff --git a/src/nl.c b/src/nl.c
index 62e5e2ebf..d1410816e 100644
--- 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)
{
diff --git a/src/od.c b/src/od.c
index c3ad92b97..4241ec504 100644
--- 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;
diff --git a/src/paste.c b/src/paste.c
index 4d6edf2f8..725269b1f 100644
--- a/src/paste.c
+++ b/src/paste.c
@@ -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)
{
diff --git a/src/sum.c b/src/sum.c
index e4f51e8bd..9e7d252bb 100644
--- 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)
{
diff --git a/src/tac.c b/src/tac.c
index d81ff6c07..6b166d7d1 100644
--- 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)
{
diff --git a/src/tail.c b/src/tail.c
index cede32010..b774606d6 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -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)
{
diff --git a/src/tr.c b/src/tr.c
index dcd40aa97..da0f01b15 100644
--- 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)
{
diff --git a/src/unexpand.c b/src/unexpand.c
index 0d04ced64..9c13c51a2 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -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)
{
diff --git a/src/uniq.c b/src/uniq.c
index 237eb1124..f716f38ea 100644
--- a/src/uniq.c
+++ b/src/uniq.c
@@ -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)
{
diff --git a/src/wc.c b/src/wc.c
index e101b9033..114b27dbe 100644
--- 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: