Wargh! Who went and changed all the getopt() comparisons from -1 to

EOF?  The getopt(3) manpage clearly states that the return value is *-1*,
not EOF!  Besides, getopt(3) isn't reading from a file. :)

Noticed-while:	merging to 2.2 (where this is correct).
This commit is contained in:
Jordan K. Hubbard 1998-03-01 05:10:28 +00:00
parent ffc82b0a70
commit 01f228ffbe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33937
14 changed files with 16 additions and 16 deletions

View File

@ -105,7 +105,7 @@ main(argc, argv)
int ch, cnt;
void intr();
while ((ch = getopt(argc, argv, "r:o:")) != EOF)
while ((ch = getopt(argc, argv, "r:o:")) != -1)
switch(ch) {
case 'o': {
register char *p;

View File

@ -67,7 +67,7 @@ main(argc, argv)
/* revoke */
setgid(getgid());
while ((ch = getopt(argc, argv, "eqr")) != EOF)
while ((ch = getopt(argc, argv, "eqr")) != -1)
switch (ch) {
case 'e':
explain = TRUE;

View File

@ -94,7 +94,7 @@ main(argc, argv)
int ch;
char *p, buf[100]; /* > max number of digits. */
while ((ch = getopt(argc, argv, "")) != EOF)
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:

View File

@ -76,7 +76,7 @@ main(argc, argv)
{
int ch, move;
while ((ch = getopt(argc, argv, "p")) != EOF)
while ((ch = getopt(argc, argv, "p")) != -1)
switch(ch) {
case 'p':
promode = 1;

View File

@ -213,7 +213,7 @@ main(int argc, char **argv)
register int ch;
register char *p;
while ((ch = getopt(argc, argv, "spw:f:")) != EOF)
while ((ch = getopt(argc, argv, "spw:f:")) != -1)
switch ((char) ch) {
case 'f':
freq = atoi(optarg);

View File

@ -92,7 +92,7 @@ main(argc, argv)
char line[256];
lflag = 0;
while ((ch = getopt(argc, argv, "l")) != EOF)
while ((ch = getopt(argc, argv, "l")) != -1)
switch (ch) {
case 'l':
lflag = 1;

View File

@ -62,7 +62,7 @@ main(argc, argv)
struct stat fbuf; /* for getting files statistics */
int ch;
while ((ch = getopt(argc, argv, "m:")) != EOF)
while ((ch = getopt(argc, argv, "m:")) != -1)
switch(ch) {
case 'm':
monsterfile = optarg;

View File

@ -1,7 +1,7 @@
/*
* piano.c - a piano emulator
*/
static char rcsid[] = "$Id$";
static char rcsid[] = "$Id: piano.c,v 1.4 1997/02/22 14:46:57 peter Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -139,7 +139,7 @@ main(int argc, char *argv[])
extern int optind, opterr;
int ch, ex, show_usage = 0;
myname = argv[0];
while ((ch = getopt(argc, argv, "-vi:")) != EOF) {
while ((ch = getopt(argc, argv, "-vi:")) != -1) {
switch (ch) {
default:
case 'V':

View File

@ -61,7 +61,7 @@ main(argc, argv)
int ch;
char buf[1024];
while ((ch = getopt(argc, argv, "")) != EOF)
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
case '?':
default:

View File

@ -115,7 +115,7 @@ main(argc, argv)
int ch;
char *p;
while ((ch = getopt(argc, argv, "")) != EOF)
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:

View File

@ -85,7 +85,7 @@ main(argc, argv)
setgid(getgid());
indexfile = _PATH_QUIZIDX;
while ((ch = getopt(argc, argv, "i:t")) != EOF)
while ((ch = getopt(argc, argv, "i:t")) != -1)
switch(ch) {
case 'i':
indexfile = optarg;

View File

@ -67,7 +67,7 @@ main(argc, argv)
char *ep;
random_exit = unbuffer_output = 0;
while ((ch = getopt(argc, argv, "er")) != EOF)
while ((ch = getopt(argc, argv, "er")) != -1)
switch (ch) {
case 'e':
random_exit = 1;

View File

@ -205,7 +205,7 @@ main(argc, argv)
number = 3;
trail = ' ';
field = NULL;
while ((ch = getopt(argc, argv, "fl:n:t")) != EOF)
while ((ch = getopt(argc, argv, "fl:n:t")) != -1)
switch(ch) {
case 'f':
field = "WORM";

View File

@ -116,9 +116,9 @@ main(argc, argv)
setgid(getgid());
#ifdef DEBUG
while ((c = getopt(argc, argv, "a:b:hp:r:t:d")) != EOF)
while ((c = getopt(argc, argv, "a:b:hp:r:t:d")) != -1)
#else
while ((c = getopt(argc, argv, "a:b:hp:r:t:")) != EOF)
while ((c = getopt(argc, argv, "a:b:hp:r:t:")) != -1)
#endif
switch (c) {
case 'a':