(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:
@@ -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 != ':') {
|
||||
|
Reference in New Issue
Block a user