Make egetopt() return -1 not EOF, as getopt(3) do.

Reviewed by:markm
This commit is contained in:
Philippe Charnier 2002-06-23 20:42:30 +00:00
parent 4b571b192a
commit a228302fca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98698

View File

@ -93,7 +93,7 @@ egetopt(int nargc, char * const *nargv, const char *ostr)
if ((eoptind >= nargc) ||
((*(place = nargv[eoptind]) != '-') && (*place != '+'))) {
place = emsg;
return (EOF);
return (-1);
}
delim = (int)*place;
@ -103,7 +103,7 @@ egetopt(int nargc, char * const *nargv, const char *ostr)
*/
++eoptind;
place = emsg;
return (EOF);
return (-1);
}
}
@ -114,10 +114,10 @@ egetopt(int nargc, char * const *nargv, const char *ostr)
!(oli = strchr(ostr, eoptopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF when by itself.
* assume it means -1 when by itself.
*/
if ((eoptopt == (int)'-') && !*place)
return (EOF);
return (-1);
if (strchr(ostr, '#') && (isdigit(eoptopt) ||
(((eoptopt == (int)'-') || (eoptopt == (int)'+')) &&
isdigit(*place)))) {