(getopt): return -1 instead of EOF. From <art@stacken.kth.se>

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7430 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-11-25 05:30:24 +00:00
parent 8a5f0eae1f
commit 0d8e93ee05

View File

@@ -69,22 +69,22 @@ getopt(nargc, nargv, ostr)
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return(EOF);
return(-1);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return(EOF);
return(-1);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
!(oli = strchr(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
* assume it means -1 (EOF).
*/
if (optopt == (int)'-')
return(EOF);
return(-1);
if (!*place)
++optind;
if (opterr && *ostr != ':') {