fixed POPT_OPTION_DEPTH checking
authorewt <devnull@localhost>
Tue, 4 Mar 1997 02:23:04 +0000 (02:23 +0000)
committerewt <devnull@localhost>
Tue, 4 Mar 1997 02:23:04 +0000 (02:23 +0000)
CVS patchset: 1474
CVS date: 1997/03/04 02:23:04

popt/popt.c

index d7005bf..143c2e7 100644 (file)
@@ -117,7 +117,8 @@ int poptGetNextOpt(poptContext con) {
                        strcmp(con->aliases[i].longName, optString))) i--;
 
                    if (i >= 0) {
-                       if ((con->os - con->optionStack) == POPT_OPTION_DEPTH)
+                       if ((con->os - con->optionStack + 1) 
+                               == POPT_OPTION_DEPTH)
                            return POPT_ERROR_OPTSTOODEEP;
 
                        con->os++;
@@ -162,7 +163,7 @@ int poptGetNextOpt(poptContext con) {
                    con->aliases[i].shortName != *origOptString) i--;
 
                if (i >= 0) {
-                   if ((con->os - con->optionStack) == POPT_OPTION_DEPTH)
+                   if ((con->os - con->optionStack + 1) == POPT_OPTION_DEPTH)
                        return POPT_ERROR_OPTSTOODEEP;
 
                    /* We'll need this on the way out */