Lines Matching defs:opts

39 opt_ambiguities(tOptions * opts, char const * name, int nm_len);
42 opt_match_ct(tOptions * opts, char const * name, int nm_len,
46 opt_set(tOptions * opts, char * arg, int idx, bool disable, tOptState * st);
49 opt_unknown(tOptions * opts, char const * name, char * arg, tOptState * st);
52 opt_ambiguous(tOptions * opts, char const * name, int match_ct);
55 get_opt_arg_must(tOptions * opts, tOptState * o_st);
100 opt_ambiguities(tOptions * opts, char const * name, int nm_len)
103 NAMED_OPTS(opts) ? "" : LONG_OPT_MARKER;
105 tOptDesc * pOD = opts->pOptDesc;
120 } while (pOD++, (++idx < opts->optCt));
134 opt_match_ct(tOptions * opts, char const * name, int nm_len,
139 int idxLim = opts->optCt;
140 tOptDesc * pOD = opts->pOptDesc;
202 * @param opts option data
209 opt_set(tOptions * opts, char * arg, int idx, bool disable, tOptState * st)
211 tOptDesc * pOD = opts->pOptDesc + idx;
214 if ((opts->fOptSet & OPTPROC_ERRSTOP) == 0)
217 fprintf(stderr, zDisabledErr, opts->pzProgName, pOD->pz_Name);
221 (*opts->pUsageProc)(opts, EXIT_FAILURE);
244 * @param opts option data
252 opt_unknown(tOptions * opts, char const * name, char * arg, tOptState * st)
261 && NAMED_OPTS(opts)
262 && (opts->specOptIdx.default_opt != NO_EQUIVALENT)) {
264 st->pOD = opts->pOptDesc + opts->specOptIdx.default_opt;
270 if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) {
271 fprintf(stderr, zIllOptStr, opts->pzProgPath, name);
272 (*opts->pUsageProc)(opts, EXIT_FAILURE);
283 * @param opts option data
290 opt_ambiguous(tOptions * opts, char const * name, int match_ct)
292 if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) {
293 fprintf(stderr, zambig_opt_fmt, opts->pzProgPath, name, match_ct);
295 opt_ambiguities(opts, name, (int)strlen(name));
296 (*opts->pUsageProc)(opts, EXIT_FAILURE);
364 * @param opts option data
371 opt_find_long(tOptions * opts, char const * opt_name, tOptState * state)
382 if ((opts->fOptSet & OPTPROC_ERRSTOP) == 0)
385 fprintf(stderr, zInvalOptName, opts->pzProgName, opt_name);
386 (*opts->pUsageProc)(opts, EXIT_FAILURE);
391 ct = opt_match_ct(opts, opt_name, nm_len, &idx, &disable);
397 case 1: return opt_set(opts, opt_arg, idx, disable, state);
398 case 0: return opt_unknown(opts, opt_name, opt_arg, state);
399 default: return opt_ambiguous(opts, opt_name, ct);
483 * @param[in,out] opts the program option descriptor
488 get_opt_arg_must(tOptions * opts, tOptState * o_st)
495 if (*++(opts->pzCurOpt) == NUL)
496 opts->pzCurOpt = opts->origArgVect[ opts->curOptIdx++ ];
497 o_st->pzOptArg = opts->pzCurOpt;
506 o_st->pzOptArg = opts->origArgVect[ opts->curOptIdx++ ];
526 if (opts->curOptIdx > opts->origArgCt) {
527 fprintf(stderr, zMisArg, opts->pzProgPath, o_st->pOD->pz_Name);
531 opts->pzCurOpt = NULL; /* next time advance to next arg */
614 * @param[in,out] opts the program option descriptor
647 * @param[in,out] opts the program option descriptor
652 get_opt_arg(tOptions * opts, tOptState * o_st)
663 return get_opt_arg_none(opts, o_st);
666 return get_opt_arg_may( opts, o_st);
668 return get_opt_arg_must(opts, o_st);
674 * @param[in,out] opts the program option descriptor
679 find_opt(tOptions * opts, tOptState * o_st)
686 if ((opts->pzCurOpt != NULL) && (*opts->pzCurOpt != NUL))
687 return opt_find_short(opts, (uint8_t)*(opts->pzCurOpt), o_st);
689 if (opts->curOptIdx >= opts->origArgCt)
692 opts->pzCurOpt = opts->origArgVect[ opts->curOptIdx ];
697 if (NAMED_OPTS(opts)) {
698 char * pz = opts->pzCurOpt;
703 opts->curOptIdx++;
706 return opt_find_long(opts, pz, o_st);
714 def_opt = VOIDP(&(opts->specOptIdx.default_opt));
717 res = opt_find_long(opts, pz, o_st);
725 if (*((opts->pzCurOpt)++) != '-')
731 if (*(opts->pzCurOpt) == NUL)
737 opts->curOptIdx++;
743 if (opts->pzCurOpt[0] == '-') {
744 if (*++(opts->pzCurOpt) == NUL)
754 if ((opts->fOptSet & OPTPROC_LONGOPT) == 0) {
755 fprintf(stderr, zIllOptStr, opts->pzProgPath, opts->pzCurOpt-2);
759 return opt_find_long(opts, opts->pzCurOpt, o_st);
767 if ((opts->fOptSet & OPTPROC_SHORTOPT) != 0)
768 return opt_find_short(opts, (uint8_t)*(opts->pzCurOpt), o_st);
770 return opt_find_long(opts, opts->pzCurOpt, o_st);