summaryrefslogtreecommitdiff
path: root/popt
diff options
context:
space:
mode:
authorjohnsonm <devnull@localhost>1998-12-01 19:05:36 +0000
committerjohnsonm <devnull@localhost>1998-12-01 19:05:36 +0000
commitef96e432ede7b490d3256dcd6ef6fe4ce054cb71 (patch)
tree338e134fca7f7dbd17ad012ffd58f269adf9f77c /popt
parent234db2e2f68fe57220371d2d46f9c68897223eff (diff)
downloadlibrpm-tizen-ef96e432ede7b490d3256dcd6ef6fe4ce054cb71.tar.gz
librpm-tizen-ef96e432ede7b490d3256dcd6ef6fe4ce054cb71.tar.bz2
librpm-tizen-ef96e432ede7b490d3256dcd6ef6fe4ce054cb71.zip
POPT_ARG_VAL appears to work, now that I have a finished test case...
CVS patchset: 2569 CVS date: 1998/12/01 19:05:36
Diffstat (limited to 'popt')
-rw-r--r--popt/popt.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/popt/popt.c b/popt/popt.c
index f9e615388..7dd453d0c 100644
--- a/popt/popt.c
+++ b/popt/popt.c
@@ -368,9 +368,11 @@ int poptGetNextOpt(poptContext con) {
con->os->nextCharArg = origOptString;
}
- if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE)
+ if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) {
*((int *)opt->arg) = 1;
- else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
+ } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) {
+ if (opt->arg) *((int *) opt->arg) = opt->val;
+ } else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
if (longArg) {
con->os->nextArg = longArg;
} else if (con->os->nextCharArg) {
@@ -392,10 +394,6 @@ int poptGetNextOpt(poptContext con) {
*((char **) opt->arg) = con->os->nextArg;
break;
- case POPT_ARG_VAL:
- *((int *) opt->arg) = opt->val;
- break;
-
case POPT_ARG_INT:
case POPT_ARG_LONG:
aLong = strtol(con->os->nextArg, &end, 0);
@@ -440,7 +438,8 @@ int poptGetNextOpt(poptContext con) {
else
sprintf(con->finalArgv[i], "-%c", opt->shortName);
- if (opt->arg && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE)
+ if (opt->arg && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE
+ && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL)
con->finalArgv[con->finalArgvCount++] = strdup(con->os->nextArg);
}