diff options
author | Jim Meyering <jim@meyering.net> | 1997-02-01 02:00:04 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-02-01 02:00:04 +0000 |
commit | c2d2dec516bd776d6acba7637d2e9ee721394604 (patch) | |
tree | 9c653ac2059ce12ae9004342e22881af2c68794a /src | |
parent | 1e40423be84cc3e594d7c64c923f39663549dcca (diff) | |
download | coreutils-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.c | 3 | ||||
-rw-r--r-- | src/cksum.c | 2 | ||||
-rw-r--r-- | src/comm.c | 2 | ||||
-rw-r--r-- | src/csplit.c | 3 | ||||
-rw-r--r-- | src/cut.c | 3 | ||||
-rw-r--r-- | src/expand.c | 3 | ||||
-rw-r--r-- | src/fmt.c | 2 | ||||
-rw-r--r-- | src/fold.c | 3 | ||||
-rw-r--r-- | src/head.c | 3 | ||||
-rw-r--r-- | src/join.c | 2 | ||||
-rw-r--r-- | src/md5sum.c | 6 | ||||
-rw-r--r-- | src/nl.c | 2 | ||||
-rw-r--r-- | src/od.c | 3 | ||||
-rw-r--r-- | src/paste.c | 3 | ||||
-rw-r--r-- | src/sum.c | 2 | ||||
-rw-r--r-- | src/tac.c | 3 | ||||
-rw-r--r-- | src/tail.c | 3 | ||||
-rw-r--r-- | src/tr.c | 3 | ||||
-rw-r--r-- | src/unexpand.c | 3 | ||||
-rw-r--r-- | src/uniq.c | 2 | ||||
-rw-r--r-- | src/wc.c | 2 |
21 files changed, 23 insertions, 35 deletions
@@ -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: @@ -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) { @@ -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")); @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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: |