options.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (options.h)
  4. *
  5. * It has been AutoGen-ed
  6. * From the definitions funcs.def
  7. * and the template file options_h
  8. *
  9. * This file defines all the global structures and special values
  10. * used in the automated option processing library.
  11. *
  12. * Automated Options Copyright (C) 1992-2016 by Bruce Korb
  13. *
  14. * This file is part of AutoOpts, a companion to AutoGen.
  15. * AutoOpts is free software.
  16. * AutoOpts is Copyright (C) 1992-2016 by Bruce Korb - all rights reserved
  17. *
  18. * AutoOpts is available under any one of two licenses. The license
  19. * in use must be one of these two and the choice is under the control
  20. * of the user of the license.
  21. *
  22. * The GNU Lesser General Public License, version 3 or later
  23. * See the files "COPYING.lgplv3" and "COPYING.gplv3"
  24. *
  25. * The Modified Berkeley Software Distribution License
  26. * See the file "COPYING.mbsd"
  27. *
  28. * These files have the following sha256 sums:
  29. *
  30. * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3
  31. * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3
  32. * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
  33. */
  34. #ifndef AUTOOPTS_OPTIONS_H_GUARD
  35. #define AUTOOPTS_OPTIONS_H_GUARD 1
  36. /** \file options.h
  37. *
  38. * @addtogroup autoopts
  39. * @{
  40. */
  41. #include <sys/types.h>
  42. #include <stdio.h>
  43. #include <stdint.h>
  44. #include <limits.h>
  45. #include <stdbool.h>
  46. /**
  47. * Defined to abnormal value of EX_USAGE. Used to indicate that paged usage
  48. * was requested. It is used to distinguish a --usage from a --help request.
  49. * --usage is abbreviated and --help gives as much help as possible.
  50. */
  51. #define AO_EXIT_REQ_USAGE 10064
  52. #undef VOIDP
  53. /**
  54. * Coerce a value into a void pointer with no const or volatile attributes.
  55. * Somewhere along the line, the above set of includes need to set up
  56. * the "uintptr_t" type.
  57. */
  58. #define VOIDP(_a) ((void *)(uintptr_t)(_a))
  59. /**
  60. * PUBLIC DEFINES
  61. *
  62. * The following defines may be used in applications that need to test the
  63. * state of an option. To test against these masks and values, a pointer
  64. * to an option descriptor must be obtained. There are two ways:
  65. *
  66. * 1. inside an option processing procedure, it is the second argument,
  67. * conventionally "tOptDesc * pOD".
  68. *
  69. * 2. Outside of an option procedure (or to reference a different option
  70. * descriptor), use either "&DESC( opt_name )" or "&pfx_DESC( opt_name )".
  71. *
  72. * See the relevant generated header file to determine which and what
  73. * values for "opt_name" are available.
  74. * @group version
  75. * @{
  76. */
  77. /// autoopts structure version
  78. #define OPTIONS_STRUCT_VERSION 167937
  79. /// autoopts structure version string
  80. #define OPTIONS_VERSION_STRING "41:1:16"
  81. /// minimum version the autoopts library supports
  82. #define OPTIONS_MINIMUM_VERSION 102400
  83. /// minimum version the autoopts library supports as a string
  84. #define OPTIONS_MIN_VER_STRING "25:0:0"
  85. /// the display version of the autoopts library, as a string
  86. #define OPTIONS_DOTTED_VERSION "41.1"
  87. /// convert a version/release number pair to an integer value
  88. #define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
  89. /// @}
  90. /**
  91. * Option argument types. This must fit in the OPTST_ARG_TYPE_MASK
  92. * field of the fOptState field of an option descriptor (tOptDesc).
  93. * It will be a problem to extend beyond 4 bits.
  94. */
  95. typedef enum {
  96. OPARG_TYPE_NONE = 0, ///< does not take an argument
  97. OPARG_TYPE_STRING = 1, ///< default type/ vanilla string
  98. OPARG_TYPE_ENUMERATION = 2, ///< opt arg is an enum (keyword list)
  99. OPARG_TYPE_BOOLEAN = 3, ///< opt arg is boolean-valued
  100. OPARG_TYPE_MEMBERSHIP = 4, ///< opt arg sets set membership bits
  101. OPARG_TYPE_NUMERIC = 5, ///< opt arg is a long int
  102. OPARG_TYPE_HIERARCHY = 6, ///< option arg is hierarchical value
  103. OPARG_TYPE_FILE = 7, ///< option arg names a file
  104. OPARG_TYPE_TIME = 8, ///< opt arg is a time duration
  105. OPARG_TYPE_FLOAT = 9, ///< opt arg is a floating point num
  106. OPARG_TYPE_DOUBLE = 10, ///< opt arg is a double prec. float
  107. OPARG_TYPE_LONG_DOUBLE = 11, ///< opt arg is a long double prec.
  108. OPARG_TYPE_LONG_LONG = 12 ///< opt arg is a long long int
  109. } teOptArgType;
  110. /**
  111. * value descriptor for sub options
  112. */
  113. typedef struct optionValue {
  114. teOptArgType valType; ///< which argument type
  115. char * pzName; ///< name of the sub-option
  116. union {
  117. char strVal[1]; ///< OPARG_TYPE_STRING
  118. unsigned int enumVal; ///< OPARG_TYPE_ENUMERATION
  119. unsigned int boolVal; ///< OPARG_TYPE_BOOLEAN
  120. unsigned long setVal; ///< OPARG_TYPE_MEMBERSHIP
  121. long longVal; ///< OPARG_TYPE_NUMERIC
  122. void * nestVal; ///< OPARG_TYPE_HIERARCHY
  123. } v;
  124. } tOptionValue;
  125. /**
  126. * file argument state and handling.
  127. */
  128. typedef enum {
  129. FTYPE_MODE_MAY_EXIST = 0x00, ///< may or may not exist
  130. FTYPE_MODE_MUST_EXIST = 0x01, ///< must pre-exist
  131. FTYPE_MODE_MUST_NOT_EXIST = 0x02, ///< must *not* pre-exist
  132. FTYPE_MODE_EXIST_MASK = 0x03, ///< mask for these bits
  133. FTYPE_MODE_NO_OPEN = 0x00, ///< leave file closed
  134. FTYPE_MODE_OPEN_FD = 0x10, ///< call open(2)
  135. FTYPE_MODE_FOPEN_FP = 0x20, ///< call fopen(3)
  136. FTYPE_MODE_OPEN_MASK = 0x30 ///< open/fopen/not open
  137. } teOptFileType;
  138. /**
  139. * the open flag bits or the mode string, depending on the open type.
  140. */
  141. typedef union {
  142. int file_flags; ///< open(2) flag bits
  143. char const * file_mode; ///< fopen(3) mode string
  144. } tuFileMode;
  145. /// initial number of option argument holders to allocate
  146. #define MIN_ARG_ALLOC_CT 6
  147. /// amount by which to increment the argument holder allocation.
  148. #define INCR_ARG_ALLOC_CT 8
  149. /**
  150. * an argument list. When an option appears multiple times and
  151. * the values get "stacked". \a apzArgs holds 8 pointers initially
  152. * and is incremented by \a INCR_ARG_ALLOC_CT as needed.
  153. */
  154. typedef struct {
  155. int useCt; ///< elements in use
  156. /// allocated elements, mininum \a MIN_ARG_ALLOC_CT
  157. /// steps by \a INCR_ARG_ALLOC_CT
  158. int allocCt;
  159. char const * apzArgs[MIN_ARG_ALLOC_CT]; ///< element array
  160. } tArgList;
  161. /**
  162. * Bits in the fOptState option descriptor field.
  163. * @{
  164. */
  165. /** integral type for holding opt_state masks */
  166. typedef uint32_t opt_state_mask_t;
  167. #define OPTST_ARG_TYPE_SHIFT 12
  168. /** bits defined for opt_state_mask_t */
  169. /** Set via the "SET_OPT()" macro */
  170. #define OPTST_SET 0x0000001U
  171. /** Set via an RC/INI file */
  172. #define OPTST_PRESET 0x0000002U
  173. /** Set via a command line option */
  174. #define OPTST_DEFINED 0x0000004U
  175. /** Reset via command line option */
  176. #define OPTST_RESET 0x0000008U
  177. /** selected by equiv'ed option */
  178. #define OPTST_EQUIVALENCE 0x0000010U
  179. /** option is in disabled state */
  180. #define OPTST_DISABLED 0x0000020U
  181. /** pzOptArg was allocated */
  182. #define OPTST_ALLOC_ARG 0x0000040U
  183. /** option cannot be preset */
  184. #define OPTST_NO_INIT 0x0000100U
  185. /** opt value (flag) is any digit */
  186. #define OPTST_NUMBER_OPT 0x0000200U
  187. /** opt uses optionStackArg proc */
  188. #define OPTST_STACKED 0x0000400U
  189. /** option defaults to enabled */
  190. #define OPTST_INITENABLED 0x0000800U
  191. /** bit 1 of arg type enum */
  192. #define OPTST_ARG_TYPE_1 0x0001000U
  193. /** bit 2 of arg type enum */
  194. #define OPTST_ARG_TYPE_2 0x0002000U
  195. /** bit 3 of arg type enum */
  196. #define OPTST_ARG_TYPE_3 0x0004000U
  197. /** bit 4 of arg type enum */
  198. #define OPTST_ARG_TYPE_4 0x0008000U
  199. /** the option arg not required */
  200. #define OPTST_ARG_OPTIONAL 0x0010000U
  201. /** process opt on first pass */
  202. #define OPTST_IMM 0x0020000U
  203. /** process disablement immed. */
  204. #define OPTST_DISABLE_IMM 0x0040000U
  205. /** compiled out of program */
  206. #define OPTST_OMITTED 0x0080000U
  207. /** must be set or pre-set */
  208. #define OPTST_MUST_SET 0x0100000U
  209. /** opt is for doc only */
  210. #define OPTST_DOCUMENT 0x0200000U
  211. /** process opt twice - imm + reg */
  212. #define OPTST_TWICE 0x0400000U
  213. /** process disabled option twice */
  214. #define OPTST_DISABLE_TWICE 0x0800000U
  215. /** scaled integer value */
  216. #define OPTST_SCALED_NUM 0x1000000U
  217. /** disable from cmd line */
  218. #define OPTST_NO_COMMAND 0x2000000U
  219. /** support is being removed */
  220. #define OPTST_DEPRECATED 0x4000000U
  221. /** alias for other option */
  222. #define OPTST_ALIAS 0x8000000U
  223. /** bits in SET mask:
  224. * set preset reset defined */
  225. #define OPTST_SET_MASK 0x000000FU
  226. /** bits in MUTABLE mask:
  227. * set preset reset defined equivalence disabled
  228. * alloc_arg */
  229. #define OPTST_MUTABLE_MASK 0x000007FU
  230. /** bits omitted from PERSISTENT mask:
  231. * mutable_mask */
  232. #define OPTST_PERSISTENT_MASK 0xFFFFF00U
  233. /** bits in SELECTED mask:
  234. * set defined */
  235. #define OPTST_SELECTED_MASK 0x0000005U
  236. /** bits in ARG_TYPE mask:
  237. * arg_type_1 arg_type_2 arg_type_3 arg_type_4 */
  238. #define OPTST_ARG_TYPE_MASK 0x000F000U
  239. /** bits in NO_USAGE mask:
  240. * omitted no_command deprecated */
  241. #define OPTST_NO_USAGE_MASK 0x6080000U
  242. /** bits in IMMUTABLE mask:
  243. * document omitted */
  244. #define OPTST_IMMUTABLE_MASK 0x0280000U
  245. /** bits in DO_NOT_SAVE mask:
  246. * document omitted no_init */
  247. #define OPTST_DO_NOT_SAVE_MASK 0x0280100U
  248. /** bits in NO_OUTPUT mask:
  249. * document omitted alias */
  250. #define OPTST_NO_OUTPUT_MASK 0x8280000U
  251. /** all bits in opt_state_mask_t masks */
  252. #define OPTST_MASK_ALL 0xFFFFF7FU
  253. /** no bits in opt_state_mask_t */
  254. #define OPTST_INIT 0x0000000U
  255. /** @} */
  256. #ifdef NO_OPTIONAL_OPT_ARGS
  257. # undef OPTST_ARG_OPTIONAL
  258. # define OPTST_ARG_OPTIONAL 0
  259. #endif
  260. #define VENDOR_OPTION_VALUE 'W'
  261. #define SELECTED_OPT(_od) ((_od)->fOptState & OPTST_SELECTED_MASK)
  262. #define UNUSED_OPT( _od) (((_od)->fOptState & OPTST_SET_MASK) == 0)
  263. #define DISABLED_OPT(_od) ((_od)->fOptState & OPTST_DISABLED)
  264. #define OPTION_STATE(_od) ((_od)->fOptState)
  265. #define OPTST_SET_ARGTYPE(_n) ((_n) << OPTST_ARG_TYPE_SHIFT)
  266. #define OPTST_GET_ARGTYPE(_f) \
  267. (((_f)&OPTST_ARG_TYPE_MASK) >> OPTST_ARG_TYPE_SHIFT)
  268. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  269. *
  270. * PRIVATE INTERFACES
  271. *
  272. * The following values are used in the generated code to communicate
  273. * with the option library procedures. They are not for public use
  274. * and may be subject to change.
  275. */
  276. /**
  277. * Define the processing state flags
  278. * @{
  279. */
  280. /** integral type for holding proc_state masks */
  281. typedef uint32_t proc_state_mask_t;
  282. /** bits defined for proc_state_mask_t */
  283. /** Process long style options */
  284. #define OPTPROC_LONGOPT 0x000001U
  285. /** Process short style "flags" */
  286. #define OPTPROC_SHORTOPT 0x000002U
  287. /** Stop on argument errors */
  288. #define OPTPROC_ERRSTOP 0x000004U
  289. /** Current option is disabled */
  290. #define OPTPROC_DISABLEDOPT 0x000008U
  291. /** no options are required */
  292. #define OPTPROC_NO_REQ_OPT 0x000010U
  293. /** there is a number option */
  294. #define OPTPROC_NUM_OPT 0x000020U
  295. /** have inits been done? */
  296. #define OPTPROC_INITDONE 0x000040U
  297. /** any negation options? */
  298. #define OPTPROC_NEGATIONS 0x000080U
  299. /** check environment? */
  300. #define OPTPROC_ENVIRON 0x000100U
  301. /** Disallow remaining arguments */
  302. #define OPTPROC_NO_ARGS 0x000200U
  303. /** Require args after options */
  304. #define OPTPROC_ARGS_REQ 0x000400U
  305. /** reorder operands after opts */
  306. #define OPTPROC_REORDER 0x000800U
  307. /** emit usage in GNU style */
  308. #define OPTPROC_GNUUSAGE 0x001000U
  309. /** Translate strings in tOptions */
  310. #define OPTPROC_TRANSLATE 0x002000U
  311. /** no usage on usage error */
  312. #define OPTPROC_MISUSE 0x004000U
  313. /** immediate options active */
  314. #define OPTPROC_IMMEDIATE 0x008000U
  315. /** suppress for config only */
  316. #define OPTPROC_NXLAT_OPT_CFG 0x010000U
  317. /** suppress xlation always */
  318. #define OPTPROC_NXLAT_OPT 0x020000U
  319. /** vendor options active */
  320. #define OPTPROC_VENDOR_OPT 0x040000U
  321. /** opt processing in preset state */
  322. #define OPTPROC_PRESETTING 0x080000U
  323. /** Ignore pzFullUsage, compute usage text */
  324. #define OPTPROC_COMPUTE 0x100000U
  325. /** Program outputs digested option state for shell scripts. Usage text
  326. * always written to stderr */
  327. #define OPTPROC_SHELL_OUTPUT 0x200000U
  328. /** bits in NO_XLAT mask:
  329. * nxlat_opt_cfg nxlat_opt */
  330. #define OPTPROC_NO_XLAT_MASK 0x030000U
  331. /** all bits in proc_state_mask_t masks */
  332. #define OPTPROC_MASK_ALL 0x3FFFFFU
  333. /** no bits in proc_state_mask_t */
  334. #define OPTPROC_NONE 0x000000U
  335. /** @} */
  336. #define STMTS(s) do { s; } while (false)
  337. /**
  338. * Abbreviation for const memory character.
  339. */
  340. #define tCC char const
  341. /**
  342. * Magical values for the program's option pointer
  343. * @{
  344. */
  345. typedef enum {
  346. OP_VAL_EMIT_USAGE = 1, ///< request for usage
  347. OP_VAL_EMIT_SHELL = 2, ///< emit value for Bourne shell evaluation
  348. OP_VAL_RETURN_VALNAME = 3, ///< return the value as a string
  349. OP_VAL_EMIT_LIMIT = 15 ///< limit for magic values
  350. } opt_proc_vals_t;
  351. /// \a OPT_VAL_EMIT_USAGE cast as a pointer
  352. #define OPTPROC_EMIT_USAGE ((tOptions *)OP_VAL_EMIT_USAGE)
  353. /// \a OPT_VAL_EMIT_SHELL cast as a pointer
  354. #define OPTPROC_EMIT_SHELL ((tOptions *)OP_VAL_EMIT_SHELL)
  355. /// \a OPT_VAL_RETURN_VALNAME cast as a pointer
  356. #define OPTPROC_RETURN_VALNAME ((tOptions *)OP_VAL_RETURN_VALNAME)
  357. /// \a OPT_VAL_EMIT_LIMIT cast as a pointer
  358. #define OPTPROC_EMIT_LIMIT ((tOptions *)OP_VAL_EMIT_LIMIT)
  359. /** @} */
  360. /** group option processing procedure types
  361. * @{
  362. */
  363. /** forward declaration for tOptDesc */
  364. typedef struct opt_desc tOptDesc;
  365. /** forward declaration for tOptiond */
  366. typedef struct options tOptions;
  367. /**
  368. * The option procedures do the special processing for each
  369. * option flag that needs it.
  370. */
  371. typedef void (tOptProc)(tOptions * pOpts, tOptDesc * pOptDesc);
  372. /**
  373. * a pointer to an option processing procedure
  374. */
  375. typedef tOptProc * tpOptProc;
  376. /**
  377. * The usage procedure will never return. It calls "exit(2)"
  378. * with the "exitCode" argument passed to it.
  379. */
  380. // coverity[+kill]
  381. typedef void (tUsageProc)(tOptions * pOpts, int exitCode);
  382. /**
  383. * a pointer to a procedure that prints usage and exits.
  384. */
  385. typedef tUsageProc * tpUsageProc;
  386. /** @} */
  387. /**
  388. * Special definitions. "NOLIMIT" is the 'max' value to use when
  389. * a flag may appear multiple times without limit. "NO_EQUIVALENT"
  390. * is an illegal value for 'optIndex' (option description index).
  391. * @{
  392. */
  393. #define NOLIMIT USHRT_MAX ///< no occurrance count limit
  394. #define OPTION_LIMIT SHRT_MAX ///< maximum number of option types
  395. /// option index to indicate no equivalance or alias
  396. #define NO_EQUIVALENT (OPTION_LIMIT+1)
  397. /** @} */
  398. /**
  399. * Option argument value. Which is valid is determined by:
  400. * (fOptState & OPTST_ARG_TYPE_MASK) >> OPTST_ARG_TYPE_SHIFT
  401. * which will yield one of the teOptArgType values.
  402. */
  403. typedef union {
  404. char const * argString; ///< as a string
  405. uintptr_t argEnum; ///< as an enumeration value
  406. uintptr_t argIntptr; ///< as an integer big enough to hold pointer
  407. long argInt; ///< as a long integer
  408. unsigned long argUint; ///< as an unsigned long ingeger
  409. unsigned int argBool; ///< as a boolean value
  410. FILE * argFp; ///< as a FILE * pointer
  411. int argFd; ///< as a file descriptor (int)
  412. } opt_arg_union_t;
  413. /// Compatibility define: \a pzLastArg is now \a optArg.argString
  414. #define pzLastArg optArg.argString
  415. /// The old amorphous argument bucket is now the opt_arg_union_t union.
  416. #define optArgBucket_t opt_arg_union_t
  417. /**
  418. * Enumeration of AutoOpts defined options. The enumeration is used in
  419. * marking each option that is defined by AutoOpts so libopts can find
  420. * the correct descriptor. This renders \a option_spec_idx_t redundant.
  421. */
  422. typedef enum {
  423. AOUSE_USER_DEFINED = 0, ///< user specified option
  424. AOUSE_RESET_OPTION, ///< reset option state option
  425. AOUSE_VERSION, ///< request version
  426. AOUSE_HELP, ///< request usage help
  427. AOUSE_MORE_HELP, ///< request paged usage
  428. AOUSE_USAGE, ///< request short usage
  429. AOUSE_SAVE_OPTS, ///< save option state
  430. AOUSE_LOAD_OPTS, ///< load options from file
  431. AOUSE_VENDOR_OPT ///< specify a vendor option
  432. } opt_usage_t;
  433. /**
  434. * Descriptor structure for each option.
  435. * Only the fields marked "PUBLIC" are for public use.
  436. */
  437. struct opt_desc {
  438. /// Public, the index of this descriptor
  439. uint16_t const optIndex;
  440. /// Public, the flag character (value)
  441. uint16_t const optValue;
  442. /// Public, the index of the option used to activate option
  443. uint16_t optActualIndex;
  444. /// Public, the flag character of the activating option
  445. uint16_t optActualValue;
  446. /// Public, the index of the equivalenced-to option.
  447. /// This is NO_EQUIVALENT unless activated.
  448. uint16_t const optEquivIndex;
  449. /// Private, the minimum occurrance count
  450. uint16_t const optMinCt;
  451. /// Private, the maximum occurrance count (NOLIMIT, if unlimited)
  452. uint16_t const optMaxCt;
  453. /// Public, the actual occurrance count
  454. uint16_t optOccCt;
  455. /// Public, the option processing state
  456. opt_state_mask_t fOptState;
  457. /// Private, how the option is used (opt_usage_t)
  458. uint32_t optUsage;
  459. /// Public, The current option argument value
  460. opt_arg_union_t optArg;
  461. /// Public, data that is actually private to the code that handles
  462. /// this particular option. It is public IFF you have your own
  463. /// handling function.
  464. void * optCookie;
  465. /// Private, a list of options that must be specified when this option
  466. /// has been specified
  467. int const * const pOptMust;
  468. /// Private, a list of options that cannot be specified when this option
  469. /// has been specified
  470. int const * const pOptCant;
  471. /// Private, the function to call for handling this option
  472. tpOptProc const pOptProc;
  473. /// Private, usage information about this option
  474. char const * const pzText;
  475. /// Public, the UPPER CASE, shell variable name syntax name of the option
  476. char const * const pz_NAME;
  477. /// the unmodified name of the option
  478. char const * const pz_Name;
  479. /// the option name to use to disable the option. Long options names
  480. /// must be active.
  481. char const * const pz_DisableName;
  482. /// the special prefix that makes the normal option name become the
  483. /// disablement name.
  484. char const * const pz_DisablePfx;
  485. };
  486. /**
  487. * Some options need special processing, so we store their
  488. * indexes in a known place.
  489. */
  490. typedef struct {
  491. uint16_t const more_help; ///< passes help text through pager
  492. uint16_t const save_opts; ///< stores option state to a file
  493. uint16_t const number_option; ///< the option "name" is an integer
  494. /// all arguments are options, this is the default option that must
  495. /// take an argument. That argument is the unrecognized option.
  496. uint16_t const default_opt;
  497. } option_spec_idx_t;
  498. /**
  499. * The procedure generated for translating option text
  500. */
  501. typedef void (tOptionXlateProc)(void);
  502. /**
  503. * Everything marked "PUBLIC" is also marked "const". Public access is not
  504. * a license to modify. Other fields are used and modified by the library.
  505. * They are also subject to change without any notice.
  506. * Do not even look at these outside of libopts.
  507. */
  508. struct options {
  509. int const structVersion; ///< The version of this struct
  510. unsigned int origArgCt; ///< program argument count
  511. char ** origArgVect; ///< program argument vector
  512. proc_state_mask_t fOptSet; ///< option proc. state flags
  513. unsigned int curOptIdx; ///< current option index
  514. char * pzCurOpt; ///< current option text
  515. /// Public, the full path of the program
  516. char const * const pzProgPath;
  517. /// Public, the name of the executable, without any path
  518. char const * const pzProgName;
  519. /// Public, the upper-cased, shell variable syntax-ed program name
  520. char const * const pzPROGNAME;
  521. /// the name of the "rc file" (configuration file)
  522. char const * const pzRcName;
  523. /// the copyright text
  524. char const * const pzCopyright;
  525. /// the full copyright notice
  526. char const * const pzCopyNotice;
  527. /// a string with the program name, project name and version
  528. char const * const pzFullVersion;
  529. /// a list of pointers to directories to search for the config file
  530. char const * const * const papzHomeList;
  531. /// the title line for usage
  532. char const * const pzUsageTitle;
  533. /// some added explanation for what this program is trying to do
  534. char const * const pzExplain;
  535. /// a detailed explanation of the program's purpose, for use when
  536. /// full help has been requested
  537. char const * const pzDetail;
  538. /// The public array of option descriptors
  539. tOptDesc * const pOptDesc;
  540. /// the email address for reporting bugs
  541. char const * const pzBugAddr;
  542. /// Reserved for future use
  543. void * pExtensions;
  544. /// A copy of the option state when optionSaveState was called.
  545. void * pSavedState;
  546. /// The procedure to call to print usage text
  547. // coverity[+kill]
  548. tpUsageProc pUsageProc;
  549. /// The procedure to call to translate translatable option messages
  550. tOptionXlateProc * pTransProc;
  551. /// Special option indexes.
  552. option_spec_idx_t specOptIdx;
  553. /// the total number of options for the program
  554. int const optCt;
  555. /// The number of "presettable" options, though some may be marked
  556. /// "no-preset". Includes all user specified options, plus a few
  557. /// that are specified by AutoOpts.
  558. int const presetOptCt;
  559. /// user specified full usage text
  560. char const * pzFullUsage;
  561. /// user specifed short usage (usage error triggered) message
  562. char const * pzShortUsage;
  563. /// The option argument settings active when optionSaveState was called
  564. opt_arg_union_t const * const originalOptArgArray;
  565. /// any saved cookie value
  566. void * const * const originalOptArgCookie;
  567. /// the package data directory (e.g. global configuration files)
  568. char const * const pzPkgDataDir;
  569. /// email address of the project packager
  570. char const * const pzPackager;
  571. };
  572. /*
  573. * Versions where in various fields first appear:
  574. * ($AO_CURRENT * 4096 + $AO_REVISION, but $AO_REVISION must be zero)
  575. */
  576. /**
  577. * The version that first stored the original argument vector
  578. */
  579. #define originalOptArgArray_STRUCT_VERSION 0x20000 /* AO_CURRENT = 32 */
  580. #define HAS_originalOptArgArray(_opt) \
  581. ((_opt)->structVersion >= originalOptArgArray_STRUCT_VERSION)
  582. /**
  583. * The version that first stored the package data directory
  584. */
  585. #define pzPkgDataDir_STRUCT_VERSION 0x22000 /* AO_CURRENT = 34 */
  586. #define HAS_pzPkgDataDir(_opt) \
  587. ((_opt)->structVersion >= pzPkgDataDir_STRUCT_VERSION)
  588. /**
  589. * The version that first stored the option usage in each option descriptor
  590. */
  591. #define opt_usage_t_STRUCT_VERSION 0x26000 /* AO_CURRENT = 38 */
  592. #define HAS_opt_usage_t(_opt) \
  593. ((_opt)->structVersion >= opt_usage_t_STRUCT_VERSION)
  594. /**
  595. * "token list" structure returned by "string_tokenize()"
  596. */
  597. typedef struct {
  598. unsigned long tkn_ct; ///< number of tokens found
  599. unsigned char * tkn_list[1]; ///< array of pointers to tokens
  600. } token_list_t;
  601. /*
  602. * Hide the interface - it pollutes a POSIX claim, but leave it for
  603. * anyone #include-ing this header
  604. */
  605. #define strneqvcmp option_strneqvcmp
  606. #define streqvcmp option_streqvcmp
  607. #define streqvmap option_streqvmap
  608. #define strequate option_strequate
  609. #define strtransform option_strtransform
  610. /**
  611. * Everything needed to be known about an mmap-ed file.
  612. *
  613. * This is an output only structure used by text_mmap and text_munmap.
  614. * Clients must not alter the contents and must provide it to both
  615. * the text_mmap and text_munmap procedures. BE ADVISED: if you are
  616. * mapping the file with PROT_WRITE the NUL byte at the end MIGHT NOT
  617. * BE WRITABLE. In any event, that byte is not be written back
  618. * to the source file. ALSO: if "txt_data" is valid and "txt_errno"
  619. * is not zero, then there *may* not be a terminating NUL.
  620. */
  621. typedef struct {
  622. void * txt_data; ///< text file data
  623. size_t txt_size; ///< actual file size
  624. size_t txt_full_size; ///< mmaped mem size
  625. int txt_fd; ///< file descriptor
  626. int txt_zero_fd; ///< fd for /dev/zero
  627. int txt_errno; ///< warning code
  628. int txt_prot; ///< "prot" flags
  629. int txt_flags; ///< mapping type
  630. } tmap_info_t;
  631. /**
  632. * mmap result wrapper that yields "true" when mmap has failed.
  633. */
  634. #define TEXT_MMAP_FAILED_ADDR(a) (VOIDP(a) == VOIDP(MAP_FAILED))
  635. #ifdef __cplusplus
  636. #define CPLUSPLUS_OPENER extern "C" {
  637. CPLUSPLUS_OPENER
  638. #define CPLUSPLUS_CLOSER }
  639. #else
  640. #define CPLUSPLUS_CLOSER
  641. #endif
  642. /**
  643. * The following routines may be coded into AutoOpts client code:
  644. */
  645. /**
  646. * ao_string_tokenize - tokenize an input string
  647. *
  648. * This function will convert one input string into a list of strings.
  649. * The list of strings is derived by separating the input based on
  650. * white space separation. However, if the input contains either single
  651. * or double quote characters, then the text after that character up to
  652. * a matching quote will become the string in the list.
  653. *
  654. * The returned pointer should be deallocated with @code{free(3C)} when
  655. * are done using the data. The data are placed in a single block of
  656. * allocated memory. Do not deallocate individual token/strings.
  657. *
  658. * The structure pointed to will contain at least these two fields:
  659. * @table @samp
  660. * @item tkn_ct
  661. * The number of tokens found in the input string.
  662. * @item tok_list
  663. * An array of @code{tkn_ct + 1} pointers to substring tokens, with
  664. * the last pointer set to NULL.
  665. * @end table
  666. *
  667. * There are two types of quoted strings: single quoted (@code{'}) and
  668. * double quoted (@code{"}). Singly quoted strings are fairly raw in that
  669. * escape characters (@code{\\}) are simply another character, except when
  670. * preceding the following characters:
  671. * @example
  672. * @code{\\} double backslashes reduce to one
  673. * @code{'} incorporates the single quote into the string
  674. * @code{\n} suppresses both the backslash and newline character
  675. * @end example
  676. *
  677. * Double quote strings are formed according to the rules of string
  678. * constants in ANSI-C programs.
  679. *
  680. * @param string string to be tokenized
  681. *
  682. * @return token_list_t * - pointer to a structure that lists each token
  683. */
  684. extern token_list_t * ao_string_tokenize(char const *);
  685. /**
  686. * configFileLoad - parse a configuration file
  687. *
  688. * This routine will load a named configuration file and parse the
  689. * text as a hierarchically valued option. The option descriptor
  690. * created from an option definition file is not used via this interface.
  691. * The returned value is "named" with the input file name and is of
  692. * type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
  693. * @code{optionGetValue()}, @code{optionNextValue()} and
  694. * @code{optionUnloadNested()}.
  695. *
  696. * @param fname the file to load
  697. *
  698. * @return const tOptionValue * - An allocated, compound value structure
  699. */
  700. extern const tOptionValue * configFileLoad(char const *);
  701. /**
  702. * optionFileLoad - Load the locatable config files, in order
  703. *
  704. * This function looks in all the specified directories for a configuration
  705. * file ("rc" file or "ini" file) and processes any found twice. The first
  706. * time through, they are processed in reverse order (last file first). At
  707. * that time, only "immediate action" configurables are processed. For
  708. * example, if the last named file specifies not processing any more
  709. * configuration files, then no more configuration files will be processed.
  710. * Such an option in the @strong{first} named directory will have no effect.
  711. *
  712. * Once the immediate action configurables have been handled, then the
  713. * directories are handled in normal, forward order. In that way, later
  714. * config files can override the settings of earlier config files.
  715. *
  716. * See the AutoOpts documentation for a thorough discussion of the
  717. * config file format.
  718. *
  719. * Configuration files not found or not decipherable are simply ignored.
  720. *
  721. * @param opts program options descriptor
  722. * @param prog program name
  723. *
  724. * @return int - 0 -> SUCCESS, -1 -> FAILURE
  725. */
  726. extern int optionFileLoad(tOptions *, char const *);
  727. /**
  728. * optionFindNextValue - find a hierarchically valued option instance
  729. *
  730. * This routine will find the next entry in a nested value option or
  731. * configurable. It will search through the list and return the next entry
  732. * that matches the criteria.
  733. *
  734. * @param odesc an option with a nested arg type
  735. * @param pPrevVal the last entry
  736. * @param name name of value to find
  737. * @param value the matching value
  738. *
  739. * @return const tOptionValue * - a compound value structure
  740. */
  741. extern const tOptionValue * optionFindNextValue(const tOptDesc *, const tOptionValue *, char const *, char const *);
  742. /**
  743. * optionFindValue - find a hierarchically valued option instance
  744. *
  745. * This routine will find an entry in a nested value option or configurable.
  746. * It will search through the list and return a matching entry.
  747. *
  748. * @param odesc an option with a nested arg type
  749. * @param name name of value to find
  750. * @param val the matching value
  751. *
  752. * @return const tOptionValue * - a compound value structure
  753. */
  754. extern const tOptionValue * optionFindValue(const tOptDesc *, char const *, char const *);
  755. /**
  756. * optionFree - free allocated option processing memory
  757. *
  758. * AutoOpts sometimes allocates memory and puts pointers to it in the
  759. * option state structures. This routine deallocates all such memory.
  760. *
  761. * @param pOpts program options descriptor
  762. */
  763. extern void optionFree(tOptions *);
  764. /**
  765. * optionGetValue - get a specific value from a hierarcical list
  766. *
  767. * This routine will find an entry in a nested value option or configurable.
  768. * If "valueName" is NULL, then the first entry is returned. Otherwise,
  769. * the first entry with a name that exactly matches the argument will be
  770. * returned. If there is no matching value, NULL is returned and errno is
  771. * set to ENOENT. If the provided option value is not a hierarchical value,
  772. * NULL is also returned and errno is set to EINVAL.
  773. *
  774. * @param pOptValue a hierarchcal value
  775. * @param valueName name of value to get
  776. *
  777. * @return const tOptionValue * - a compound value structure
  778. */
  779. extern const tOptionValue * optionGetValue(const tOptionValue *, char const *);
  780. /**
  781. * optionLoadLine - process a string for an option name and value
  782. *
  783. * This is a client program callable routine for setting options from, for
  784. * example, the contents of a file that they read in. Only one option may
  785. * appear in the text. It will be treated as a normal (non-preset) option.
  786. *
  787. * When passed a pointer to the option struct and a string, it will find
  788. * the option named by the first token on the string and set the option
  789. * argument to the remainder of the string. The caller must NUL terminate
  790. * the string. The caller need not skip over any introductory hyphens.
  791. * Any embedded new lines will be included in the option
  792. * argument. If the input looks like one or more quoted strings, then the
  793. * input will be "cooked". The "cooking" is identical to the string
  794. * formation used in AutoGen definition files (@pxref{basic expression}),
  795. * except that you may not use backquotes.
  796. *
  797. * @param opts program options descriptor
  798. * @param line NUL-terminated text
  799. */
  800. extern void optionLoadLine(tOptions *, char const *);
  801. /**
  802. * optionMemberList - Get the list of members of a bit mask set
  803. *
  804. * This converts the OPT_VALUE_name mask value to a allocated string.
  805. * It is the caller's responsibility to free the string.
  806. *
  807. * @param od the set membership option description
  808. *
  809. * @return char * - the names of the set bits
  810. */
  811. extern char * optionMemberList(tOptDesc *);
  812. /**
  813. * optionNextValue - get the next value from a hierarchical list
  814. *
  815. * This routine will return the next entry after the entry passed in. At the
  816. * end of the list, NULL will be returned. If the entry is not found on the
  817. * list, NULL will be returned and "@var{errno}" will be set to EINVAL.
  818. * The "@var{pOldValue}" must have been gotten from a prior call to this
  819. * routine or to "@code{opitonGetValue()}".
  820. *
  821. * @param pOptValue a hierarchcal list value
  822. * @param pOldValue a value from this list
  823. *
  824. * @return const tOptionValue * - a compound value structure
  825. */
  826. extern const tOptionValue * optionNextValue(const tOptionValue *, const tOptionValue *);
  827. /**
  828. * optionOnlyUsage - Print usage text for just the options
  829. *
  830. * This routine will print only the usage for each option.
  831. * This function may be used when the emitted usage must incorporate
  832. * information not available to AutoOpts.
  833. *
  834. * @param pOpts program options descriptor
  835. * @param ex_code exit code for calling exit(3)
  836. */
  837. extern void optionOnlyUsage(tOptions *, int);
  838. /**
  839. * optionPrintVersion - Print the program version
  840. *
  841. * This routine will print the version to stdout.
  842. *
  843. * @param opts program options descriptor
  844. * @param od the descriptor for this arg
  845. */
  846. extern void optionPrintVersion(tOptions *, tOptDesc *);
  847. /**
  848. * optionPrintVersionAndReturn - Print the program version
  849. *
  850. * This routine will print the version to stdout and return
  851. * instead of exiting. Please see the source for the
  852. * @code{print_ver} funtion for details on selecting how
  853. * verbose to be after this function returns.
  854. *
  855. * @param opts program options descriptor
  856. * @param od the descriptor for this arg
  857. */
  858. extern void optionPrintVersionAndReturn(tOptions *, tOptDesc *);
  859. /**
  860. * optionProcess - this is the main option processing routine
  861. *
  862. * This is the main entry point for processing options. It is intended
  863. * that this procedure be called once at the beginning of the execution of
  864. * a program. Depending on options selected earlier, it is sometimes
  865. * necessary to stop and restart option processing, or to select completely
  866. * different sets of options. This can be done easily, but you generally
  867. * do not want to do this.
  868. *
  869. * The number of arguments processed always includes the program name.
  870. * If one of the arguments is "--", then it is counted and the processing
  871. * stops. If an error was encountered and errors are to be tolerated, then
  872. * the returned value is the index of the argument causing the error.
  873. * A hyphen by itself ("-") will also cause processing to stop and will
  874. * @emph{not} be counted among the processed arguments. A hyphen by itself
  875. * is treated as an operand. Encountering an operand stops option
  876. * processing.
  877. *
  878. * @param opts program options descriptor
  879. * @param a_ct program arg count
  880. * @param a_v program arg vector
  881. *
  882. * @return int - the count of the arguments processed
  883. */
  884. extern int optionProcess(tOptions *, int, char **);
  885. /**
  886. * optionRestore - restore option state from memory copy
  887. *
  888. * Copy back the option state from saved memory.
  889. * The allocated memory is left intact, so this routine can be
  890. * called repeatedly without having to call optionSaveState again.
  891. * If you are restoring a state that was saved before the first call
  892. * to optionProcess(3AO), then you may change the contents of the
  893. * argc/argv parameters to optionProcess.
  894. *
  895. * @param pOpts program options descriptor
  896. */
  897. extern void optionRestore(tOptions *);
  898. /**
  899. * optionSaveFile - saves the option state to a file
  900. *
  901. * This routine will save the state of option processing to a file. The name
  902. * of that file can be specified with the argument to the @code{--save-opts}
  903. * option, or by appending the @code{rcfile} attribute to the last
  904. * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it
  905. * will default to @code{.@i{programname}rc}. If you wish to specify another
  906. * file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro.
  907. *
  908. * The recommend usage is as follows:
  909. * @example
  910. * optionProcess(&progOptions, argc, argv);
  911. * if (i_want_a_non_standard_place_for_this)
  912. * SET_OPT_SAVE_OPTS("myfilename");
  913. * optionSaveFile(&progOptions);
  914. * @end example
  915. *
  916. * @param opts program options descriptor
  917. */
  918. extern void optionSaveFile(tOptions *);
  919. /**
  920. * optionSaveState - saves the option state to memory
  921. *
  922. * This routine will allocate enough memory to save the current option
  923. * processing state. If this routine has been called before, that memory
  924. * will be reused. You may only save one copy of the option state. This
  925. * routine may be called before optionProcess(3AO). If you do call it
  926. * before the first call to optionProcess, then you may also change the
  927. * contents of argc/argv after you call optionRestore(3AO)
  928. *
  929. * In fact, more strongly put: it is safest to only use this function
  930. * before having processed any options. In particular, the saving and
  931. * restoring of stacked string arguments and hierarchical values is
  932. * disabled. The values are not saved.
  933. *
  934. * @param pOpts program options descriptor
  935. */
  936. extern void optionSaveState(tOptions *);
  937. /**
  938. * optionUnloadNested - Deallocate the memory for a nested value
  939. *
  940. * A nested value needs to be deallocated. The pointer passed in should
  941. * have been gotten from a call to @code{configFileLoad()} (See
  942. * @pxref{libopts-configFileLoad}).
  943. *
  944. * @param pOptVal the hierarchical value
  945. */
  946. extern void optionUnloadNested(tOptionValue const *);
  947. /**
  948. * optionVersion - return the compiled AutoOpts version number
  949. *
  950. * Returns the full version string compiled into the library.
  951. * The returned string cannot be modified.
  952. *
  953. * @return char const * - the version string in constant memory
  954. */
  955. extern char const * optionVersion(void);
  956. /**
  957. * strequate - map a list of characters to the same value
  958. *
  959. * Each character in the input string get mapped to the first character
  960. * in the string.
  961. * This function name is mapped to option_strequate so as to not conflict
  962. * with the POSIX name space.
  963. *
  964. * @param ch_list characters to equivalence
  965. */
  966. extern void strequate(char const *);
  967. /**
  968. * streqvcmp - compare two strings with an equivalence mapping
  969. *
  970. * Using a character mapping, two strings are compared for "equivalence".
  971. * Each input character is mapped to a comparison character and the
  972. * mapped-to characters are compared for the two NUL terminated input strings.
  973. * This function name is mapped to option_streqvcmp so as to not conflict
  974. * with the POSIX name space.
  975. *
  976. * @param str1 first string
  977. * @param str2 second string
  978. *
  979. * @return int - the difference between two differing characters
  980. */
  981. extern int streqvcmp(char const *, char const *);
  982. /**
  983. * streqvmap - Set the character mappings for the streqv functions
  984. *
  985. * Set the character mapping. If the count (@code{ct}) is set to zero, then
  986. * the map is cleared by setting all entries in the map to their index
  987. * value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
  988. * character. If @code{ct} is greater than 1, then @code{From} and @code{To}
  989. * are incremented and the process repeated until @code{ct} entries have been
  990. * set. For example,
  991. * @example
  992. * streqvmap('a', 'A', 26);
  993. * @end example
  994. * @noindent
  995. * will alter the mapping so that all English lower case letters
  996. * will map to upper case.
  997. *
  998. * This function name is mapped to option_streqvmap so as to not conflict
  999. * with the POSIX name space.
  1000. *
  1001. * @param from Input character
  1002. * @param to Mapped-to character
  1003. * @param ct compare length
  1004. */
  1005. extern void streqvmap(char, char, int);
  1006. /**
  1007. * strneqvcmp - compare two strings with an equivalence mapping
  1008. *
  1009. * Using a character mapping, two strings are compared for "equivalence".
  1010. * Each input character is mapped to a comparison character and the
  1011. * mapped-to characters are compared for the two NUL terminated input strings.
  1012. * The comparison is limited to @code{ct} bytes.
  1013. * This function name is mapped to option_strneqvcmp so as to not conflict
  1014. * with the POSIX name space.
  1015. *
  1016. * @param str1 first string
  1017. * @param str2 second string
  1018. * @param ct compare length
  1019. *
  1020. * @return int - the difference between two differing characters
  1021. */
  1022. extern int strneqvcmp(char const *, char const *, int);
  1023. /**
  1024. * strtransform - convert a string into its mapped-to value
  1025. *
  1026. * Each character in the input string is mapped and the mapped-to
  1027. * character is put into the output.
  1028. * This function name is mapped to option_strtransform so as to not conflict
  1029. * with the POSIX name space.
  1030. *
  1031. * The source and destination may be the same.
  1032. *
  1033. * @param dest output string
  1034. * @param src input string
  1035. */
  1036. extern void strtransform(char *, char const *);
  1037. /* AutoOpts PRIVATE FUNCTIONS: */
  1038. tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal;
  1039. extern char * ao_string_cook(char *, int *);
  1040. extern unsigned int ao_string_cook_escape_char(char const *, char *, unsigned int);
  1041. extern void genshelloptUsage(tOptions *, int);
  1042. extern int optionAlias(tOptions *, tOptDesc *, unsigned int);
  1043. extern void optionBooleanVal(tOptions *, tOptDesc *);
  1044. extern uintptr_t optionEnumerationVal(tOptions *, tOptDesc *, char const * const *, unsigned int);
  1045. extern void optionFileCheck(tOptions *, tOptDesc *, teOptFileType, tuFileMode);
  1046. extern char const * optionKeywordName(tOptDesc *, unsigned int);
  1047. extern void optionLoadOpt(tOptions *, tOptDesc *);
  1048. extern bool optionMakePath(char *, int, char const *, char const *);
  1049. extern void optionNestedVal(tOptions *, tOptDesc *);
  1050. extern void optionNumericVal(tOptions *, tOptDesc *);
  1051. extern void optionPagedUsage(tOptions *, tOptDesc *);
  1052. extern void optionParseShell(tOptions *);
  1053. extern void optionPrintParagraphs(char const *, bool, FILE *);
  1054. extern void optionPutShell(tOptions *);
  1055. extern char const * optionQuoteString(char const *, char const *);
  1056. extern void optionResetOpt(tOptions *, tOptDesc *);
  1057. extern void optionSetMembers(tOptions *, tOptDesc *, char const * const *, unsigned int);
  1058. extern void optionShowRange(tOptions *, tOptDesc *, void *, int);
  1059. extern void optionStackArg(tOptions *, tOptDesc *);
  1060. extern void optionTimeDate(tOptions *, tOptDesc *);
  1061. extern void optionTimeVal(tOptions *, tOptDesc *);
  1062. extern void optionUnstackArg(tOptions *, tOptDesc *);
  1063. extern void optionUsage(tOptions *, int);
  1064. extern void optionVendorOption(tOptions *, tOptDesc *);
  1065. extern void optionVersionStderr(tOptions *, tOptDesc *);
  1066. extern void * text_mmap(char const *, int, int, tmap_info_t *);
  1067. extern int text_munmap(tmap_info_t *);
  1068. CPLUSPLUS_CLOSER
  1069. #endif /* AUTOOPTS_OPTIONS_H_GUARD */
  1070. /** @}
  1071. *
  1072. * Local Variables:
  1073. * c-file-style: "stroustrup"
  1074. * indent-tabs-mode: nil
  1075. * End:
  1076. * options.h ends here */