options.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (options.h)
  4. *
  5. * It has been AutoGen-ed Sunday April 9, 2006 at 11:49:19 AM PDT
  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 1992-Y Bruce Korb
  13. *
  14. * AutoOpts is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU Lesser General Public
  16. * License as published by the Free Software Foundation; either
  17. * version 2.1 of the License, or (at your option) any later version.
  18. *
  19. * AutoOpts is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  22. * Lesser General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU Lesser General Public
  25. * License along with AutoOpts. If not, write to:
  26. * The Free Software Foundation, Inc.,
  27. * 51 Franklin Street, Fifth Floor
  28. * Boston, MA 02110-1301, USA.
  29. */
  30. #ifndef AUTOOPTS_OPTIONS_H_GUARD
  31. #define AUTOOPTS_OPTIONS_H_GUARD
  32. #include <sys/types.h>
  33. #if defined(HAVE_STDINT_H)
  34. # include <stdint.h>
  35. #elif defined(HAVE_INTTYPES_H)
  36. # include <inttypes.h>
  37. #endif /* HAVE_STDINT/INTTYPES_H */
  38. #if defined(HAVE_LIMITS_H)
  39. # include <limits.h>
  40. #elif defined(HAVE_SYS_LIMITS_H)
  41. # include <sys/limits.h>
  42. #endif /* HAVE_LIMITS/SYS_LIMITS_H */
  43. /*
  44. * PUBLIC DEFINES
  45. *
  46. * The following defines may be used in applications that need to test the
  47. * state of an option. To test against these masks and values, a pointer
  48. * to an option descriptor must be obtained. There are two ways:
  49. *
  50. * 1. inside an option processing procedure, it is the second argument,
  51. * conventionally "tOptDesc* pOD".
  52. *
  53. * 2. Outside of an option procedure (or to reference a different option
  54. * descriptor), use either "&DESC( opt_name )" or "&pfx_DESC( opt_name )".
  55. *
  56. * See the relevant generated header file to determine which and what
  57. * values for "opt_name" are available.
  58. */
  59. typedef enum {
  60. OPARG_TYPE_NONE = 0,
  61. OPARG_TYPE_STRING = 1, /* default type/ vanilla string */
  62. OPARG_TYPE_ENUMERATION = 2, /* opt arg is an enum (keyword list) */
  63. OPARG_TYPE_BOOLEAN = 3, /* opt arg is boolean-valued */
  64. OPARG_TYPE_MEMBERSHIP = 4, /* opt arg sets set membership bits */
  65. OPARG_TYPE_NUMERIC = 5, /* opt arg has numeric value */
  66. OPARG_TYPE_HIERARCHY = 6 /* option arg is hierarchical value */
  67. } teOptArgType;
  68. typedef struct optionValue {
  69. teOptArgType valType;
  70. char* pzName;
  71. union {
  72. char strVal[1]; /* OPARG_TYPE_STRING */
  73. int enumVal; /* OPARG_TYPE_ENUMERATION */
  74. int boolVal; /* OPARG_TYPE_BOOLEAN */
  75. long setVal; /* OPARG_TYPE_MEMBERSHIP */
  76. long longVal; /* OPARG_TYPE_NUMERIC */
  77. void* nestVal; /* OPARG_TYPE_HIERARCHY */
  78. } v;
  79. } tOptionValue;
  80. #define OPTST_SET_ARGTYPE(n) ((n) << 12)
  81. #define OPTST_GET_ARGTYPE(f) (((f) & OPTST_ARG_TYPE_MASK) >> 12)
  82. /*
  83. * Bits in the fOptState option descriptor field.
  84. */
  85. #define OPTST_INIT 0x0000000 /* Initial compiled value */
  86. #define OPTST_SET 0x0000001 /* Set via the "SET_OPT()" macro */
  87. #define OPTST_PRESET 0x0000002 /* Set via an RC/INI file */
  88. #define OPTST_DEFINED 0x0000004 /* Set via a command line option */
  89. #define OPTST_SET_MASK 0x0000007 /* mask of flags that show set state */
  90. #define OPTST_EQUIVALENCE 0x0000010 /* selected by equiv'ed option */
  91. #define OPTST_DISABLED 0x0000020 /* option is in disabled state */
  92. #define OPTST_NO_INIT 0x0000100 /* option cannot be preset */
  93. #define OPTST_NUMBER_OPT 0x0000200 /* opt value (flag) is any digit */
  94. #define OPTST_STACKED 0x0000400 /* opt uses optionStackArg procedure */
  95. #define OPTST_INITENABLED 0x0000800 /* option defaults to enabled */
  96. #define OPTST_ARG_TYPE_MASK 0x000F000 /* bits used to specify opt arg type */
  97. #define OPTST_ARG_OPTIONAL 0x0010000 /* the option argument not required */
  98. #define OPTST_IMM 0x0020000 /* process option on first pass */
  99. #define OPTST_DISABLE_IMM 0x0040000 /* process disablement on first pass */
  100. #define OPTST_OMITTED 0x0080000 /* compiled out of program */
  101. #define OPTST_MUST_SET 0x0100000 /* must be set or pre-set */
  102. #define OPTST_DOCUMENT 0x0200000 /* opt is for documentation only */
  103. #define OPTST_TWICE 0x0400000 /* process option twice - imm + reg */
  104. #define OPTST_DISABLE_TWICE 0x0800000 /* process disabled option twice */
  105. #define OPTST_PERSISTENT 0xFFFFF00 /* mask of flags that do not change */
  106. #define SELECTED_OPT( pod ) ( (pod)->fOptState & (OPTST_SET | OPTST_DEFINED))
  107. #define UNUSED_OPT( pod ) (((pod)->fOptState & OPTST_SET_MASK) == 0)
  108. #define DISABLED_OPT( pod ) ( (pod)->fOptState & OPTST_DISABLED)
  109. #define OPTION_STATE( pod ) ((pod)->fOptState)
  110. /*
  111. * PRIVATE INTERFACES
  112. *
  113. * The following values are used in the generated code to communicate
  114. * with the option library procedures. They are not for public use
  115. * and may be subject to change.
  116. */
  117. /*
  118. * Define any special processing flags
  119. */
  120. #define OPTPROC_NONE 0x000000
  121. #define OPTPROC_LONGOPT 0x000001 /* Process long style options */
  122. #define OPTPROC_SHORTOPT 0x000002 /* Process short style "flags" */
  123. #define OPTPROC_ERRSTOP 0x000004 /* Stop on argument errors */
  124. #define OPTPROC_DISABLEDOPT 0x000008 /* Current option is disabled */
  125. #define OPTPROC_NO_REQ_OPT 0x000010 /* no options are required */
  126. #define OPTPROC_NUM_OPT 0x000020 /* there is a number option */
  127. #define OPTPROC_INITDONE 0x000040 /* have initializations been done? */
  128. #define OPTPROC_NEGATIONS 0x000080 /* any negation options? */
  129. #define OPTPROC_ENVIRON 0x000100 /* check environment? */
  130. #define OPTPROC_NO_ARGS 0x000200 /* Disallow remaining arguments */
  131. #define OPTPROC_ARGS_REQ 0x000400 /* Require arguments after options */
  132. #define OPTPROC_REORDER 0x000800 /* reorder arguments after options */
  133. #define OPTPROC_GNUUSAGE 0x001000 /* emit usage in GNU style */
  134. #define OPTPROC_TRANSLATE 0x002000 /* Translate strings in tOptions */
  135. #define OPTPROC_HAS_IMMED 0x004000 /* program defines immed options */
  136. #define OPTPROC_PRESETTING 0x800000 /* opt processing in preset state */
  137. #define STMTS(s) do { s; } while (0)
  138. /*
  139. * The following must be #defined instead of typedef-ed
  140. * because "static const" cannot both be applied to a type,
  141. * tho each individually can...so they all are
  142. */
  143. #define tSCC static const char
  144. #define tCC const char
  145. #define tAoSC static char
  146. #define tAoUC unsigned char
  147. #define tAoUI unsigned int
  148. #define tAoUL unsigned long
  149. #define tAoUS unsigned short
  150. /*
  151. * It is so disgusting that there must be so many ways
  152. * of specifying TRUE and FALSE.
  153. */
  154. typedef enum { AG_FALSE = 0, AG_TRUE } ag_bool;
  155. /*
  156. * Define a structure that describes each option and
  157. * a pointer to the procedure that handles it.
  158. * The argument is the count of this flag previously seen.
  159. */
  160. typedef struct options tOptions;
  161. typedef struct optDesc tOptDesc;
  162. typedef struct optNames tOptNames;
  163. /*
  164. * The option procedures do the special processing for each
  165. * option flag that needs it.
  166. */
  167. typedef void (tOptProc)( tOptions* pOpts, tOptDesc* pOptDesc );
  168. typedef tOptProc* tpOptProc;
  169. /*
  170. * The usage procedure will never return. It calls "exit(2)"
  171. * with the "exitCode" argument passed to it.
  172. */
  173. typedef void (tUsageProc)( tOptions* pOpts, int exitCode );
  174. typedef tUsageProc* tpUsageProc;
  175. /*
  176. * Special definitions. "NOLIMIT" is the 'max' value to use when
  177. * a flag may appear multiple times without limit. "NO_EQUIVALENT"
  178. * is an illegal value for 'optIndex' (option description index).
  179. */
  180. #define NOLIMIT USHRT_MAX
  181. #define OPTION_LIMIT SHRT_MAX
  182. #define NO_EQUIVALENT (OPTION_LIMIT+1)
  183. /*
  184. * Special values for optValue. It must not be generatable from the
  185. * computation "optIndex +96". Since "optIndex" is limited to 100, ...
  186. */
  187. #define NUMBER_OPTION '#'
  188. typedef struct argList tArgList;
  189. #define MIN_ARG_ALLOC_CT 6
  190. #define INCR_ARG_ALLOC_CT 8
  191. struct argList {
  192. int useCt;
  193. int allocCt;
  194. tCC* apzArgs[ MIN_ARG_ALLOC_CT ];
  195. };
  196. /*
  197. * Descriptor structure for each option.
  198. * Only the fields marked "PUBLIC" are for public use.
  199. */
  200. struct optDesc {
  201. tAoUS optIndex; /* PUBLIC */
  202. tAoUS optValue; /* PUBLIC */
  203. tAoUS optActualIndex; /* PUBLIC */
  204. tAoUS optActualValue; /* PUBLIC */
  205. tAoUS optEquivIndex; /* PUBLIC */
  206. tAoUS optMinCt;
  207. tAoUS optMaxCt;
  208. tAoUS optOccCt; /* PUBLIC */
  209. tAoUI fOptState; /* PUBLIC */
  210. tAoUI reserved;
  211. tCC* pzLastArg; /* PUBLIC */
  212. void* optCookie; /* PUBLIC */
  213. const int * pOptMust;
  214. const int * pOptCant;
  215. tpOptProc pOptProc;
  216. const char* pzText;
  217. const char* pz_NAME;
  218. const char* pz_Name;
  219. const char* pz_DisableName;
  220. const char* pz_DisablePfx;
  221. };
  222. /*
  223. * Some options need special processing, so we store their
  224. * indexes in a known place:
  225. */
  226. typedef struct optSpecIndex tOptSpecIndex;
  227. struct optSpecIndex {
  228. tAoUS more_help;
  229. tAoUS save_opts;
  230. tAoUS number_option;
  231. tAoUS default_opt;
  232. };
  233. #define OPTIONS_STRUCT_VERSION 110594
  234. #define OPTIONS_VERSION_STRING "27:1:2"
  235. #define OPTIONS_MINIMUM_VERSION 102400
  236. #define OPTIONS_MIN_VER_STRING "25:0:0"
  237. /*
  238. * The procedure generated for translating option text
  239. */
  240. typedef void (tOptionXlateProc)(void);
  241. struct options {
  242. const int structVersion;
  243. int origArgCt;
  244. char** origArgVect;
  245. unsigned int fOptSet;
  246. unsigned int curOptIdx;
  247. char* pzCurOpt;
  248. const char* pzProgPath;
  249. const char* pzProgName;
  250. const char* pzPROGNAME;
  251. const char* pzRcName;
  252. const char* pzCopyright;
  253. const char* pzCopyNotice;
  254. const char* pzFullVersion;
  255. const char** papzHomeList;
  256. const char* pzUsageTitle;
  257. const char* pzExplain;
  258. const char* pzDetail;
  259. tOptDesc* pOptDesc;
  260. const char* pzBugAddr;
  261. void* pExtensions;
  262. void* pSavedState;
  263. tpUsageProc pUsageProc;
  264. tOptionXlateProc* pTransProc;
  265. tOptSpecIndex specOptIdx;
  266. const int optCt;
  267. const int presetOptCt;
  268. };
  269. /*
  270. * "token list" structure returned by "string_tokenize()"
  271. */
  272. typedef struct {
  273. unsigned long tkn_ct;
  274. unsigned char* tkn_list[1];
  275. } token_list_t;
  276. /*
  277. * Hide the interface - it pollutes a POSIX claim, but leave it for
  278. * anyone #include-ing this header
  279. */
  280. #define strneqvcmp option_strneqvcmp
  281. #define streqvcmp option_streqvcmp
  282. #define streqvmap option_streqvmap
  283. #define strequate option_strequate
  284. #define strtransform option_strtransform
  285. /*
  286. * This is an output only structure used by text_mmap and text_munmap.
  287. * Clients must not alter the contents and must provide it to both
  288. * the text_mmap and text_munmap procedures. BE ADVISED: if you are
  289. * mapping the file with PROT_WRITE the NUL byte at the end MIGHT NOT
  290. * BE WRITABLE. In any event, that byte is not be written back
  291. * to the source file. ALSO: if "txt_data" is valid and "txt_errno"
  292. * is not zero, then there *may* not be a terminating NUL.
  293. */
  294. typedef struct {
  295. void* txt_data; /* text file data */
  296. size_t txt_size; /* actual file size */
  297. size_t txt_full_size; /* mmaped mem size */
  298. int txt_fd; /* file descriptor */
  299. int txt_zero_fd; /* fd for /dev/zero */
  300. int txt_errno; /* warning code */
  301. int txt_prot; /* "prot" flags */
  302. int txt_flags; /* mapping type */
  303. int txt_alloc; /* if we malloced memory */
  304. } tmap_info_t;
  305. #define TEXT_MMAP_FAILED_ADDR(a) ((void*)(a) == (void*)MAP_FAILED)
  306. /*
  307. * When loading a line (or block) of text as an option, the value can
  308. * be processed in any of several modes:
  309. *
  310. * @table @samp
  311. * @item keep
  312. * Every part of the value between the delimiters is saved.
  313. *
  314. * @item uncooked
  315. * Even if the value begins with quote characters, do not do quote processing.
  316. *
  317. * @item cooked
  318. * If the value looks like a quoted string, then process it.
  319. * Double quoted strings are processed the way strings are in "C" programs,
  320. * except they are treated as regular characters if the following character
  321. * is not a well-established escape sequence.
  322. * Single quoted strings (quoted with apostrophies) are handled the way
  323. * strings are handled in shell scripts, *except* that backslash escapes
  324. * are honored before backslash escapes and apostrophies.
  325. * @end table
  326. */
  327. typedef enum {
  328. OPTION_LOAD_COOKED,
  329. OPTION_LOAD_UNCOOKED,
  330. OPTION_LOAD_KEEP
  331. } tOptionLoadMode;
  332. #ifdef __cplusplus
  333. extern "C" {
  334. #define CPLUSPLUS_CLOSER }
  335. #else
  336. #define CPLUSPLUS_CLOSER
  337. #endif
  338. /*
  339. * The following routines may be coded into AutoOpts client code:
  340. */
  341. /* From: tokenize.c line 115
  342. *
  343. * ao_string_tokenize - tokenize an input string
  344. *
  345. * Arguments:
  346. * string string to be tokenized
  347. *
  348. * Returns: token_list_t* - pointer to a structure that lists each token
  349. *
  350. * This function will convert one input string into a list of strings.
  351. * The list of strings is derived by separating the input based on
  352. * white space separation. However, if the input contains either single
  353. * or double quote characters, then the text after that character up to
  354. * a matching quote will become the string in the list.
  355. *
  356. * The returned pointer should be deallocated with @code{free(3C)} when
  357. * are done using the data. The data are placed in a single block of
  358. * allocated memory. Do not deallocate individual token/strings.
  359. *
  360. * The structure pointed to will contain at least these two fields:
  361. * @table @samp
  362. * @item tkn_ct
  363. * The number of tokens found in the input string.
  364. * @item tok_list
  365. * An array of @code{tkn_ct + 1} pointers to substring tokens, with
  366. * the last pointer set to NULL.
  367. * @end table
  368. *
  369. * There are two types of quoted strings: single quoted (@code{'}) and
  370. * double quoted (@code{"}). Singly quoted strings are fairly raw in that
  371. * escape characters (@code{\\}) are simply another character, except when
  372. * preceding the following characters:
  373. * @example
  374. * @code{\\} double backslashes reduce to one
  375. * @code{'} incorporates the single quote into the string
  376. * @code{\n} suppresses both the backslash and newline character
  377. * @end example
  378. *
  379. * Double quote strings are formed according to the rules of string
  380. * constants in ANSI-C programs.
  381. */
  382. extern token_list_t* ao_string_tokenize( const char* );
  383. /* From: configfile.c line 113
  384. *
  385. * configFileLoad - parse a configuration file
  386. *
  387. * Arguments:
  388. * pzFile the file to load
  389. *
  390. * Returns: const tOptionValue* - An allocated, compound value structure
  391. *
  392. * This routine will load a named configuration file and parse the
  393. * text as a hierarchically valued option. The option descriptor
  394. * created from an option definition file is not used via this interface.
  395. * The returned value is "named" with the input file name and is of
  396. * type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
  397. * @code{optionGetValue()}, @code{optionNextValue()} and
  398. * @code{optionUnloadNested()}.
  399. */
  400. extern const tOptionValue* configFileLoad( const char* );
  401. /* From: configfile.c line 869
  402. *
  403. * optionFileLoad - Load the locatable config files, in order
  404. *
  405. * Arguments:
  406. * pOpts program options descriptor
  407. * pzProg program name
  408. *
  409. * Returns: int - 0 -> SUCCESS, -1 -> FAILURE
  410. *
  411. * This function looks in all the specified directories for a configuration
  412. * file ("rc" file or "ini" file) and processes any found twice. The first
  413. * time through, they are processed in reverse order (last file first). At
  414. * that time, only "immediate action" configurables are processed. For
  415. * example, if the last named file specifies not processing any more
  416. * configuration files, then no more configuration files will be processed.
  417. * Such an option in the @strong{first} named directory will have no effect.
  418. *
  419. * Once the immediate action configurables have been handled, then the
  420. * directories are handled in normal, forward order. In that way, later
  421. * config files can override the settings of earlier config files.
  422. *
  423. * See the AutoOpts documentation for a thorough discussion of the
  424. * config file format.
  425. *
  426. * Configuration files not found or not decipherable are simply ignored.
  427. */
  428. extern int optionFileLoad( tOptions*, const char* );
  429. /* From: configfile.c line 241
  430. *
  431. * optionFindNextValue - find a hierarcicaly valued option instance
  432. *
  433. * Arguments:
  434. * pOptDesc an option with a nested arg type
  435. * pPrevVal the last entry
  436. * name name of value to find
  437. * value the matching value
  438. *
  439. * Returns: const tOptionValue* - a compound value structure
  440. *
  441. * This routine will find the next entry in a nested value option or
  442. * configurable. It will search through the list and return the next entry
  443. * that matches the criteria.
  444. */
  445. extern const tOptionValue* optionFindNextValue( const tOptDesc*, const tOptionValue*, const char*, const char* );
  446. /* From: configfile.c line 166
  447. *
  448. * optionFindValue - find a hierarcicaly valued option instance
  449. *
  450. * Arguments:
  451. * pOptDesc an option with a nested arg type
  452. * name name of value to find
  453. * value the matching value
  454. *
  455. * Returns: const tOptionValue* - a compound value structure
  456. *
  457. * This routine will find an entry in a nested value option or configurable.
  458. * It will search through the list and return a matching entry.
  459. */
  460. extern const tOptionValue* optionFindValue( const tOptDesc*, const char*, const char* );
  461. /* From: restore.c line 157
  462. *
  463. * optionFree - free allocated option processing memory
  464. *
  465. * Arguments:
  466. * pOpts program options descriptor
  467. *
  468. * AutoOpts sometimes allocates memory and puts pointers to it in the
  469. * option state structures. This routine deallocates all such memory.
  470. */
  471. extern void optionFree( tOptions* );
  472. /* From: configfile.c line 310
  473. *
  474. * optionGetValue - get a specific value from a hierarcical list
  475. *
  476. * Arguments:
  477. * pOptValue a hierarchcal value
  478. * valueName name of value to get
  479. *
  480. * Returns: const tOptionValue* - a compound value structure
  481. *
  482. * This routine will find an entry in a nested value option or configurable.
  483. * If "valueName" is NULL, then the first entry is returned. Otherwise,
  484. * the first entry with a name that exactly matches the argument will be
  485. * returned.
  486. */
  487. extern const tOptionValue* optionGetValue( const tOptionValue*, const char* );
  488. /* From: load.c line 477
  489. *
  490. * optionLoadLine - process a string for an option name and value
  491. *
  492. * Arguments:
  493. * pOpts program options descriptor
  494. * pzLine NUL-terminated text
  495. *
  496. * This is a client program callable routine for setting options from, for
  497. * example, the contents of a file that they read in. Only one option may
  498. * appear in the text. It will be treated as a normal (non-preset) option.
  499. *
  500. * When passed a pointer to the option struct and a string, it will find
  501. * the option named by the first token on the string and set the option
  502. * argument to the remainder of the string. The caller must NUL terminate
  503. * the string. Any embedded new lines will be included in the option
  504. * argument. If the input looks like one or more quoted strings, then the
  505. * input will be "cooked". The "cooking" is identical to the string
  506. * formation used in AutoGen definition files (@pxref{basic expression}),
  507. * except that you may not use backquotes.
  508. */
  509. extern void optionLoadLine( tOptions*, const char* );
  510. /* From: configfile.c line 369
  511. *
  512. * optionNextValue - get the next value from a hierarchical list
  513. *
  514. * Arguments:
  515. * pOptValue a hierarchcal list value
  516. * pOldValue a value from this list
  517. *
  518. * Returns: const tOptionValue* - a compound value structure
  519. *
  520. * This routine will return the next entry after the entry passed in. At the
  521. * end of the list, NULL will be returned. If the entry is not found on the
  522. * list, NULL will be returned and "@var{errno}" will be set to EINVAL.
  523. * The "@var{pOldValue}" must have been gotten from a prior call to this
  524. * routine or to "@code{opitonGetValue()}".
  525. */
  526. extern const tOptionValue* optionNextValue( const tOptionValue*, const tOptionValue* );
  527. /* From: usage.c line 128
  528. *
  529. * optionOnlyUsage - Print usage text for just the options
  530. *
  531. * Arguments:
  532. * pOpts program options descriptor
  533. * ex_code exit code for calling exit(3)
  534. *
  535. * This routine will print only the usage for each option.
  536. * This function may be used when the emitted usage must incorporate
  537. * information not available to AutoOpts.
  538. */
  539. extern void optionOnlyUsage( tOptions*, int );
  540. /* From: autoopts.c line 934
  541. *
  542. * optionProcess - this is the main option processing routine
  543. *
  544. * Arguments:
  545. * pOpts program options descriptor
  546. * argc program arg count
  547. * argv program arg vector
  548. *
  549. * Returns: int - the count of the arguments processed
  550. *
  551. * This is the main entry point for processing options. It is intended
  552. * that this procedure be called once at the beginning of the execution of
  553. * a program. Depending on options selected earlier, it is sometimes
  554. * necessary to stop and restart option processing, or to select completely
  555. * different sets of options. This can be done easily, but you generally
  556. * do not want to do this.
  557. *
  558. * The number of arguments processed always includes the program name.
  559. * If one of the arguments is "--", then it is counted and the processing
  560. * stops. If an error was encountered and errors are to be tolerated, then
  561. * the returned value is the index of the argument causing the error.
  562. * A hyphen by itself ("-") will also cause processing to stop and will
  563. * @emph{not} be counted among the processed arguments. A hyphen by itself
  564. * is treated as an operand. Encountering an operand stops option
  565. * processing.
  566. */
  567. extern int optionProcess( tOptions*, int, char** );
  568. /* From: restore.c line 121
  569. *
  570. * optionRestore - restore option state from memory copy
  571. *
  572. * Arguments:
  573. * pOpts program options descriptor
  574. *
  575. * Copy back the option state from saved memory.
  576. * The allocated memory is left intact, so this routine can be
  577. * called repeatedly without having to call optionSaveState again.
  578. * If you are restoring a state that was saved before the first call
  579. * to optionProcess(3AO), then you may change the contents of the
  580. * argc/argv parameters to optionProcess.
  581. */
  582. extern void optionRestore( tOptions* );
  583. /* From: save.c line 325
  584. *
  585. * optionSaveFile - saves the option state to a file
  586. *
  587. * Arguments:
  588. * pOpts program options descriptor
  589. *
  590. * This routine will save the state of option processing to a file. The name
  591. * of that file can be specified with the argument to the @code{--save-opts}
  592. * option, or by appending the @code{rcfile} attribute to the last
  593. * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it
  594. * will default to @code{.@i{programname}rc}. If you wish to specify another
  595. * file, you should invoke the @code{SET_OPT_SAVE_OPTS( @i{filename} )} macro.
  596. */
  597. extern void optionSaveFile( tOptions* );
  598. /* From: restore.c line 54
  599. *
  600. * optionSaveState - saves the option state to memory
  601. *
  602. * Arguments:
  603. * pOpts program options descriptor
  604. *
  605. * This routine will allocate enough memory to save the current
  606. * option processing state. If this routine has been called before,
  607. * that memory will be reused. You may only save one copy of the
  608. * option state. This routine may be called before optionProcess(3AO).
  609. * If you do call it before the first call to optionProcess, then
  610. * you may also change the contents of argc/argv after you call
  611. * optionRestore(3AO)
  612. */
  613. extern void optionSaveState( tOptions* );
  614. /* From: nested.c line 527
  615. *
  616. * optionUnloadNested - Deallocate the memory for a nested value
  617. *
  618. * Arguments:
  619. * pOptVal the hierarchical value
  620. *
  621. * A nested value needs to be deallocated. The pointer passed in should
  622. * have been gotten from a call to @code{configFileLoad()} (See
  623. * @pxref{libopts-configFileLoad}).
  624. */
  625. extern void optionUnloadNested( const tOptionValue* );
  626. /* From: version.c line 58
  627. *
  628. * optionVersion - return the compiled AutoOpts version number
  629. *
  630. * Returns: const char* - the version string in constant memory
  631. *
  632. * Returns the full version string compiled into the library.
  633. * The returned string cannot be modified.
  634. */
  635. extern const char* optionVersion( void );
  636. /* From: ../compat/pathfind.c line 24
  637. *
  638. * pathfind - fild a file in a list of directories
  639. *
  640. * Arguments:
  641. * path colon separated list of search directories
  642. * file the name of the file to look for
  643. * mode the mode bits that must be set to match
  644. *
  645. * Returns: char* - the path to the located file
  646. *
  647. * the pathfind function is available only if HAVE_PATHFIND is not defined
  648. *
  649. * pathfind looks for a a file with name "FILE" and "MODE" access
  650. * along colon delimited "PATH", and returns the full pathname as a
  651. * string, or NULL if not found. If "FILE" contains a slash, then
  652. * it is treated as a relative or absolute path and "PATH" is ignored.
  653. *
  654. * @strong{NOTE}: this function is compiled into @file{libopts} only if
  655. * it is not natively supplied.
  656. *
  657. * The "MODE" argument is a string of option letters chosen from the
  658. * list below:
  659. * @example
  660. * Letter Meaning
  661. * r readable
  662. * w writable
  663. * x executable
  664. * f normal file (NOT IMPLEMENTED)
  665. * b block special (NOT IMPLEMENTED)
  666. * c character special (NOT IMPLEMENTED)
  667. * d directory (NOT IMPLEMENTED)
  668. * p FIFO (pipe) (NOT IMPLEMENTED)
  669. * u set user ID bit (NOT IMPLEMENTED)
  670. * g set group ID bit (NOT IMPLEMENTED)
  671. * k sticky bit (NOT IMPLEMENTED)
  672. * s size nonzero (NOT IMPLEMENTED)
  673. * @end example
  674. */
  675. #ifndef HAVE_PATHFIND
  676. extern char* pathfind( const char*, const char*, const char* );
  677. #endif /* HAVE_PATHFIND */
  678. /* From: streqvcmp.c line 233
  679. *
  680. * strequate - map a list of characters to the same value
  681. *
  682. * Arguments:
  683. * ch_list characters to equivalence
  684. *
  685. * Each character in the input string get mapped to the first character
  686. * in the string.
  687. * This function name is mapped to option_strequate so as to not conflict
  688. * with the POSIX name space.
  689. */
  690. extern void strequate( const char* );
  691. /* From: streqvcmp.c line 143
  692. *
  693. * streqvcmp - compare two strings with an equivalence mapping
  694. *
  695. * Arguments:
  696. * str1 first string
  697. * str2 second string
  698. *
  699. * Returns: int - the difference between two differing characters
  700. *
  701. * Using a character mapping, two strings are compared for "equivalence".
  702. * Each input character is mapped to a comparison character and the
  703. * mapped-to characters are compared for the two NUL terminated input strings.
  704. * This function name is mapped to option_streqvcmp so as to not conflict
  705. * with the POSIX name space.
  706. */
  707. extern int streqvcmp( const char*, const char* );
  708. /* From: streqvcmp.c line 180
  709. *
  710. * streqvmap - Set the character mappings for the streqv functions
  711. *
  712. * Arguments:
  713. * From Input character
  714. * To Mapped-to character
  715. * ct compare length
  716. *
  717. * Set the character mapping. If the count (@code{ct}) is set to zero, then
  718. * the map is cleared by setting all entries in the map to their index
  719. * value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
  720. * character. If @code{ct} is greater than 1, then @code{From} and @code{To}
  721. * are incremented and the process repeated until @code{ct} entries have been
  722. * set. For example,
  723. * @example
  724. * streqvmap( 'a', 'A', 26 );
  725. * @end example
  726. * @noindent
  727. * will alter the mapping so that all English lower case letters
  728. * will map to upper case.
  729. *
  730. * This function name is mapped to option_streqvmap so as to not conflict
  731. * with the POSIX name space.
  732. */
  733. extern void streqvmap( char, char, int );
  734. /* From: streqvcmp.c line 102
  735. *
  736. * strneqvcmp - compare two strings with an equivalence mapping
  737. *
  738. * Arguments:
  739. * str1 first string
  740. * str2 second string
  741. * ct compare length
  742. *
  743. * Returns: int - the difference between two differing characters
  744. *
  745. * Using a character mapping, two strings are compared for "equivalence".
  746. * Each input character is mapped to a comparison character and the
  747. * mapped-to characters are compared for the two NUL terminated input strings.
  748. * The comparison is limited to @code{ct} bytes.
  749. * This function name is mapped to option_strneqvcmp so as to not conflict
  750. * with the POSIX name space.
  751. */
  752. extern int strneqvcmp( const char*, const char*, int );
  753. /* From: streqvcmp.c line 259
  754. *
  755. * strtransform - convert a string into its mapped-to value
  756. *
  757. * Arguments:
  758. * dest output string
  759. * src input string
  760. *
  761. * Each character in the input string is mapped and the mapped-to
  762. * character is put into the output.
  763. * This function name is mapped to option_strtransform so as to not conflict
  764. * with the POSIX name space.
  765. */
  766. extern void strtransform( char*, const char* );
  767. /* AutoOpts PRIVATE FUNCTIONS: */
  768. tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal;
  769. extern char* ao_string_cook( char*, int* );
  770. extern unsigned int ao_string_cook_escape_char( const char*, char*, char );
  771. extern void genshelloptUsage( tOptions*, int );
  772. extern void optionBooleanVal( tOptions*, tOptDesc* );
  773. extern char* optionEnumerationVal( tOptions*, tOptDesc*, const char**, unsigned int );
  774. extern const char* optionKeywordName( tOptDesc*, unsigned int );
  775. extern tOptionValue* optionLoadNested( const char*, const char*, size_t, tOptionLoadMode );
  776. extern void optionLoadOpt( tOptions*, tOptDesc* );
  777. extern ag_bool optionMakePath( char*, int, const char*, const char* );
  778. extern void optionNestedVal( tOptions*, tOptDesc* );
  779. extern void optionNumericVal( tOptions*, tOptDesc* );
  780. extern void optionPagedUsage( tOptions*, tOptDesc* );
  781. extern void optionParseShell( tOptions* );
  782. extern void optionPrintVersion( tOptions*, tOptDesc* );
  783. extern void optionPutShell( tOptions* );
  784. extern void optionSetMembers( tOptions*, tOptDesc*, const char**, unsigned int );
  785. extern void optionStackArg( tOptions*, tOptDesc* );
  786. extern void optionUnstackArg( tOptions*, tOptDesc* );
  787. extern void optionUsage( tOptions*, int );
  788. extern void optionVersionStderr( tOptions*, tOptDesc* );
  789. extern void* text_mmap( const char*, int, int, tmap_info_t* );
  790. extern int text_munmap( tmap_info_t* );
  791. CPLUSPLUS_CLOSER
  792. #endif /* AUTOOPTS_OPTIONS_H_GUARD */
  793. /*
  794. * Local Variables:
  795. * c-file-style: "stroustrup"
  796. * indent-tabs-mode: nil
  797. * End:
  798. * options.h ends here */