diff options
author | Jim Meyering <jim@meyering.net> | 1997-02-01 03:05:36 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-02-01 03:05:36 +0000 |
commit | b8c82a8e39e901c6b231217a009982a0e0b782a6 (patch) | |
tree | ea1086eb40e509ef40ba21c407285ae847e263de | |
parent | 4f51b86bfb737aadf750d70b6a7bd4e0ec36962f (diff) | |
download | coreutils-b8c82a8e39e901c6b231217a009982a0e0b782a6.tar.xz |
Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call.
-rw-r--r-- | src/date.c | 2 | ||||
-rw-r--r-- | src/env.c | 4 | ||||
-rw-r--r-- | src/id.c | 3 | ||||
-rw-r--r-- | src/logname.c | 2 | ||||
-rw-r--r-- | src/nice.c | 2 | ||||
-rw-r--r-- | src/pathchk.c | 2 | ||||
-rw-r--r-- | src/printenv.c | 2 | ||||
-rw-r--r-- | src/seq.c | 2 | ||||
-rw-r--r-- | src/sleep.c | 2 | ||||
-rw-r--r-- | src/stty.c | 3 | ||||
-rw-r--r-- | src/su.c | 3 | ||||
-rw-r--r-- | src/tee.c | 3 | ||||
-rw-r--r-- | src/tty.c | 2 | ||||
-rw-r--r-- | src/uname.c | 3 | ||||
-rw-r--r-- | src/who-users.c | 9 | ||||
-rw-r--r-- | src/whoami.c | 2 |
16 files changed, 21 insertions, 25 deletions
diff --git a/src/date.c b/src/date.c index b336542f7..b69019b43 100644 --- a/src/date.c +++ b/src/date.c @@ -158,7 +158,7 @@ main (int argc, char **argv) textdomain (PACKAGE); while ((optc = getopt_long (argc, argv, "d:f:r:Rs:u", long_options, NULL)) - != EOF) + != -1) switch (optc) { case 0: @@ -122,7 +122,7 @@ main (register int argc, register char **argv, char **envp) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1) { switch (optc) { @@ -158,7 +158,7 @@ main (register int argc, register char **argv, char **envp) putenv (*envp); optind = 0; /* Force GNU getopt to re-initialize. */ - while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1) if (optc == 'u') putenv (optarg); /* Requires GNU putenv. */ @@ -104,8 +104,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - while ((optc = getopt_long (argc, argv, "agnruG", longopts, (int *) 0)) - != EOF) + while ((optc = getopt_long (argc, argv, "agnruG", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/logname.c b/src/logname.c index 235ad5dcd..c8197369f 100644 --- a/src/logname.c +++ b/src/logname.c @@ -69,7 +69,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - 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/nice.c b/src/nice.c index 029b85590..d66950e3b 100644 --- a/src/nice.c +++ b/src/nice.c @@ -106,7 +106,7 @@ main (int argc, char **argv) optind = 0; if ((optc = getopt_long (argc - (i - 1), fake_argv, "+n:", - longopts, (int *) 0)) != EOF) + longopts, NULL)) != -1) { switch (optc) { diff --git a/src/pathchk.c b/src/pathchk.c index c8346148e..db8e23496 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -124,7 +124,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - while ((optc = getopt_long (argc, argv, "p", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "p", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/printenv.c b/src/printenv.c index 6fb9aca84..ad548c421 100644 --- a/src/printenv.c +++ b/src/printenv.c @@ -87,7 +87,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) { switch (c) { @@ -130,7 +130,7 @@ main (int argc, char **argv) REQUIRE_ORDER (the '+' in the format string) and it abort on the first non-option or negative number. */ while ((optc = getopt_long (argc, argv, "+0123456789f:s:w", long_options, - (int *) 0)) != EOF) + NULL)) != -1) { if ('0' <= optc && optc <= '9') { diff --git a/src/sleep.c b/src/sleep.c index 9ec0bb338..6ab1e022e 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -73,7 +73,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - 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/stty.c b/src/stty.c index a8902f0d3..e2167765e 100644 --- a/src/stty.c +++ b/src/stty.c @@ -673,8 +673,7 @@ main (int argc, char **argv) /* Recognize the long options only. */ opterr = 0; - while ((optc = getopt_long_only (argc, argv, "ag", longopts, (int *) 0)) - != EOF) + while ((optc = getopt_long_only (argc, argv, "ag", longopts, NULL)) != -1) { switch (optc) { @@ -467,8 +467,7 @@ main (int argc, char **argv) simulate_login = 0; change_environment = 1; - while ((optc = getopt_long (argc, argv, "c:flmps:", longopts, (int *) 0)) - != EOF) + while ((optc = getopt_long (argc, argv, "c:flmps:", longopts, NULL)) != -1) { switch (optc) { @@ -91,8 +91,7 @@ main (int argc, char **argv) append = 0; ignore_interrupts = 0; - while ((optc = getopt_long (argc, argv, "ai", long_options, (int *) 0)) - != EOF) + while ((optc = getopt_long (argc, argv, "ai", long_options, NULL)) != -1) { switch (optc) { @@ -66,7 +66,7 @@ main (int argc, char **argv) silent = 0; - while ((optc = getopt_long (argc, argv, "s", longopts, (int *) 0)) != EOF) + while ((optc = getopt_long (argc, argv, "s", longopts, NULL)) != -1) { switch (optc) { diff --git a/src/uname.c b/src/uname.c index d8f02dbfa..a64839338 100644 --- a/src/uname.c +++ b/src/uname.c @@ -102,8 +102,7 @@ main (int argc, char **argv) toprint = 0; - while ((c = getopt_long (argc, argv, "snrvpma", long_options, (int *) 0)) - != EOF) + while ((c = getopt_long (argc, argv, "snrvpma", long_options, NULL)) != -1) { switch (c) { diff --git a/src/who-users.c b/src/who-users.c index a4f5e5b33..4bb76df4b 100644 --- a/src/who-users.c +++ b/src/who-users.c @@ -698,11 +698,12 @@ main (int argc, char **argv) textdomain (PACKAGE); #ifdef WHO - while ((optc = getopt_long (argc, argv, "imqsuwHT", longopts, &longind)) +# define WU_OPTS "imqsuwHT" #else - while ((optc = getopt_long (argc, argv, "", longopts, &longind)) -#endif /* WHO */ - != EOF) +# define WU_OPTS "" +#endif + + while ((optc = getopt_long (argc, argv, WU_OPTS, longopts, &longind)) != -1) { switch (optc) { diff --git a/src/whoami.c b/src/whoami.c index 4d1523690..52b7b650b 100644 --- a/src/whoami.c +++ b/src/whoami.c @@ -74,7 +74,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) { switch (c) { |