summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-02-01 03:05:36 +0000
committerJim Meyering <jim@meyering.net>1997-02-01 03:05:36 +0000
commitb8c82a8e39e901c6b231217a009982a0e0b782a6 (patch)
treeea1086eb40e509ef40ba21c407285ae847e263de /src
parent4f51b86bfb737aadf750d70b6a7bd4e0ec36962f (diff)
downloadcoreutils-b8c82a8e39e901c6b231217a009982a0e0b782a6.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/date.c2
-rw-r--r--src/env.c4
-rw-r--r--src/id.c3
-rw-r--r--src/logname.c2
-rw-r--r--src/nice.c2
-rw-r--r--src/pathchk.c2
-rw-r--r--src/printenv.c2
-rw-r--r--src/seq.c2
-rw-r--r--src/sleep.c2
-rw-r--r--src/stty.c3
-rw-r--r--src/su.c3
-rw-r--r--src/tee.c3
-rw-r--r--src/tty.c2
-rw-r--r--src/uname.c3
-rw-r--r--src/who-users.c9
-rw-r--r--src/whoami.c2
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:
diff --git a/src/env.c b/src/env.c
index 86d00d795..c6c8ab60d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -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. */
diff --git a/src/id.c b/src/id.c
index 6c54633bc..23c4ad506 100644
--- a/src/id.c
+++ b/src/id.c
@@ -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)
{
diff --git a/src/seq.c b/src/seq.c
index 5a8a26f6e..a92c670db 100644
--- a/src/seq.c
+++ b/src/seq.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)
{
diff --git a/src/su.c b/src/su.c
index 51e2e8165..6c8a942fc 100644
--- a/src/su.c
+++ b/src/su.c
@@ -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)
{
diff --git a/src/tee.c b/src/tee.c
index cda83fec0..e5946eeb8 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -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)
{
diff --git a/src/tty.c b/src/tty.c
index cc67bdcf4..dfc72e5c0 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -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)
{