Home | History | Annotate | Download | only in libpopt

Lines Matching refs:opt

64 static void invokeCallbacksPRE(poptContext con, const struct poptOption * opt)
68 if (opt != NULL)
69 for (; opt->longName || opt->shortName || opt->arg; opt++) {
70 if (opt->arg == NULL) continue; /* XXX program error. */
71 if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
72 void * arg = opt->arg;
79 } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
80 (opt->argInfo & POPT_CBFLAG_PRE))
82 poptCallbackType cb = (poptCallbackType)opt->arg;
86 cb(con, POPT_CALLBACK_REASON_PRE, NULL, NULL, opt->descrip);
92 static void invokeCallbacksPOST(poptContext con, const struct poptOption * opt)
96 if (opt != NULL)
97 for (; opt->longName || opt->shortName || opt->arg; opt++) {
98 if (opt->arg == NULL) continue; /* XXX program error. */
99 if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
100 void * arg = opt->arg;
107 } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
108 (opt->argInfo & POPT_CBFLAG_POST))
110 poptCallbackType cb = (poptCallbackType)opt->arg;
114 cb(con, POPT_CALLBACK_REASON_POST, NULL, NULL, opt->descrip);
121 const struct poptOption * opt,
129 if (opt != NULL)
130 for (; opt->longName || opt->shortName || opt->arg; opt++) {
131 if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
132 void * arg = opt->arg;
138 if (opt->arg != NULL) /* XXX program error */
139 invokeCallbacksOPTION(con, opt->arg, myOpt, myData, shorty);
140 } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
141 !(opt->argInfo & POPT_CBFLAG_SKIPOPTION)) {
143 cbopt = opt;
145 ((myOpt->shortName && opt->shortName && shorty &&
146 myOpt->shortName == opt->shortName) ||
147 (myOpt->longName && opt->longName &&
148 /*@-nullpass@*/ /* LCL: opt->longName != NULL */
149 !strcmp(myOpt->longName, opt->longName)))
472 findOption(const struct poptOption * opt, /*@null@*/ const char * longName,
485 for (; opt->longName || opt->shortName || opt->arg; opt++) {
487 if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
489 void * arg = opt->arg;
504 *callbackData = opt->descrip;
507 } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK) {
508 cb = opt;
509 } else if (longName && opt->longName &&
510 (!singleDash || (opt->argInfo & POPT_ARGFLAG_ONEDASH)) &&
511 /*@-nullpass@*/ /* LCL: opt->longName != NULL */
512 !strcmp(longName, opt->longName))
516 } else if (shortName && shortName == opt->shortName) {
521 if (!opt->longName && !opt->shortName)
540 return opt;
708 const struct poptOption * opt = NULL;
801 opt = findOption(con->options, optString, '\0', &cb, &cbData,
803 if (!opt && !singleDash)
807 if (!opt) {
811 opt->argInfo & POPT_ARGFLAG_STRIP)
838 opt = findOption(con->options, NULL, *origOptString, &cb,
840 if (!opt)
850 if (opt == NULL) return POPT_ERROR_BADOPT; /* XXX can't happen */
851 if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) {
852 if (poptSaveInt((int *)opt->arg, opt->argInfo, 1L))
854 } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) {
855 if (opt->arg) {
856 if (poptSaveInt((int *)opt->arg, opt->argInfo, (long)opt->val))
859 } else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
876 if (!(opt->argInfo & POPT_ARGFLAG_OPTIONAL))
888 (opt->argInfo & POPT_ARGFLAG_STRIP) &&
903 if (opt->arg) {
904 switch (opt->argInfo & POPT_ARG_MASK) {
907 *((const char **) opt->arg) = (con->os->nextArg)
922 if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) {
925 if (poptSaveLong((long *)opt->arg, opt->argInfo, aLong))
930 if (poptSaveInt((int *)opt->arg, opt->argInfo, aLong))
953 if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_DOUBLE) {
954 *((double *) opt->arg) = aDouble;
961 *((float *) opt->arg) = aDouble;
967 (opt->argInfo & POPT_ARG_MASK));
976 invokeCallbacksOPTION(con, con->options, opt, cbData, shorty);
978 } else if (opt->val && ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL))
988 { char *s = malloc((opt->longName ? strlen(opt->longName) : 0) + 3);
990 if (opt->longName)
992 ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"),
993 opt->longName);
995 sprintf(s, "-%c", opt->shortName);
1001 if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE)
1003 else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL)
1005 else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
1014 return (opt ? opt->val : -1); /* XXX can't happen */
1192 return POPT_("opt->arg should not be NULL");