getopt(3) returns -1, not EOF.
This commit is contained in:
parent
58eefce0e6
commit
b7498df286
@ -270,7 +270,7 @@ char **argv;
|
||||
{
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "Cc:iorsx")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "Cc:iorsx")) != -1)
|
||||
switch(ch) {
|
||||
case 'C': /* embedded comments */
|
||||
Cflag++;
|
||||
|
@ -324,7 +324,7 @@ man_getopt (argc, argv)
|
||||
extern void downcase ();
|
||||
extern char *manpath ();
|
||||
|
||||
while ((c = getopt (argc, argv, args)) != EOF)
|
||||
while ((c = getopt (argc, argv, args)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ main(argc, argv)
|
||||
|
||||
prognam = mkprogname (argv[0]);
|
||||
|
||||
while ((c = getopt (argc, argv, "dhLq?")) != EOF)
|
||||
while ((c = getopt (argc, argv, "dhLq?")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
|
@ -1037,7 +1037,7 @@ main (int argc, char **argv)
|
||||
|
||||
for (;;) {
|
||||
switch (getopt (argc, argv, "mseftucviax")) {
|
||||
case EOF:
|
||||
case -1:
|
||||
break;
|
||||
case 'a':
|
||||
++aflag;
|
||||
|
@ -179,7 +179,7 @@ main(int argc, char *argv[])
|
||||
|
||||
/* process the argument list */
|
||||
kflag = 0;
|
||||
while ((i = getopt(argc, argv, "abdF:f:k:m:o:pv:")) != EOF)
|
||||
while ((i = getopt(argc, argv, "abdF:f:k:m:o:pv:")) != -1)
|
||||
switch(i) {
|
||||
case 'a': /* key is ASCII */
|
||||
keybase = KEY_ASCII;
|
||||
|
@ -942,7 +942,7 @@ main(int argc, char **argv)
|
||||
setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
|
||||
|
||||
while ((ch = getopt(argc, argv, "b:c:dl:m:no:p:qr:s:t:w:D:LN:OP:RS:W"))
|
||||
!= EOF)
|
||||
!= -1)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
simulatedopcount = getnum(optarg, &endp);
|
||||
|
@ -110,7 +110,7 @@ logout(int argc, char *argv[], struct ncp_conn_loginfo *li) {
|
||||
int error = 0, connid, opt;
|
||||
|
||||
connid = -1;
|
||||
while ((opt = getopt(argc, argv, STDPARAM_OPT"c:")) != EOF){
|
||||
while ((opt = getopt(argc, argv, STDPARAM_OPT"c:")) != -1){
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
connid = atoi(optarg);
|
||||
|
@ -190,7 +190,7 @@ int main (int argc, char **argv)
|
||||
|
||||
for (;;) {
|
||||
switch (getopt (argc, argv, "svhf:")) {
|
||||
case EOF:
|
||||
case -1:
|
||||
break;
|
||||
case 's':
|
||||
verbose = 0;
|
||||
|
@ -170,7 +170,7 @@ char * argv[];
|
||||
if (c == 'v')
|
||||
vflag = 1;
|
||||
else cutoff = optarg;
|
||||
if ((c != EOF && c != -1) ||
|
||||
if ((c != -1) ||
|
||||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
|
||||
usage();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user