diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/getopt.c | 12 | ||||
-rw-r--r-- | posix/getopt.h | 4 | ||||
-rw-r--r-- | posix/getopt1.c | 5 |
3 files changed, 10 insertions, 11 deletions
diff --git a/posix/getopt.c b/posix/getopt.c index 1c79eaaae2..f57f281297 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -126,7 +126,7 @@ char *optarg = NULL; On entry to `getopt', zero means this is the first call; initialize. - When `getopt' returns EOF, this is the index of the first of the + When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next @@ -188,7 +188,7 @@ int optopt = '?'; The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { @@ -417,7 +417,7 @@ _getopt_initialize (argc, argv, optstring) updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. - If there are no more option characters, `getopt' returns `EOF'. + If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) @@ -546,7 +546,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; - return EOF; + return -1; } /* If we have come to a non-option and did not permute it, @@ -555,7 +555,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) - return EOF; + return -1; optarg = argv[optind++]; return 1; } @@ -945,7 +945,7 @@ main (argc, argv) int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); - if (c == EOF) + if (c == -1) break; switch (c) diff --git a/posix/getopt.h b/posix/getopt.h index 9da23aac2b..7dad11b79f 100644 --- a/posix/getopt.h +++ b/posix/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989, 90, 91, 92, 93, 94, 96 Free Software Foundation, Inc. + Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -40,7 +40,7 @@ extern char *optarg; On entry to `getopt', zero means this is the first call; initialize. - When `getopt' returns EOF, this is the index of the first of the + When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next diff --git a/posix/getopt1.c b/posix/getopt1.c index 358935db69..19fd4a0cb5 100644 --- a/posix/getopt1.c +++ b/posix/getopt1.c @@ -1,6 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 1996 - Free Software Foundation, Inc. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -124,7 +123,7 @@ main (argc, argv) c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); - if (c == EOF) + if (c == -1) break; switch (c) |