1optionProcess(3) Programmer's Manual optionProcess(3)
2
3
4
6 optionProcess - this is the main option processing routine
7
8
10 #include <your-opts.h>
11 cc [...] -o outfile infile.c -lopts [...]
12
13 int optionProcess(tOptions* pOpts, int argc, char** argv);
14
15
17 This is the main entry point for processing options. It is intended
18 that this procedure be called once at the beginning of the execution of
19 a program. Depending on options selected earlier, it is sometimes nec‐
20 essary to stop and restart option processing, or to select completely
21 different sets of options. This can be done easily, but you generally
22 do not want to do this.
23
24 The number of arguments processed always includes the program name. If
25 one of the arguments is "--", then it is counted and the processing
26 stops. If an error was encountered and errors are to be tolerated,
27 then the returned value is the index of the argument causing the error.
28 A hyphen by itself ("-") will also cause processing to stop and will
29 not be counted among the processed arguments. A hyphen by itself is
30 treated as an operand. Encountering an operand stops option process‐
31 ing.
32
33 pOpts program options descriptor
34
35 argc program arg count
36
37 argv program arg vector
38
39
41 the count of the arguments processed
42
43
45 Errors will cause diagnostics to be printed. exit(3) may or may not be
46 called. It depends upon whether or not the options were generated with
47 the "allow-errors" attribute, or if the ERRSKIP_OPTERR or
48 ERRSTOP_OPTERR macros were invoked.
49
51 The info documentation for the -lopts library.
52 ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), option‐
53 FindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3),
54 optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionRe‐
55 store(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3),
56 optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), stre‐
57 qvmap(3), strneqvcmp(3), strtransform(3),
58
59
60
61 2008-02-27 optionProcess(3)