1 This is autogen.info, produced by makeinfo version 6.5 from
4 This manual is for GNU AutoGen version 5.18, updated August 2018.
6 Copyright (C) 1992-2018 by Bruce Korb.
8 Permission is granted to copy, distribute and/or modify this
9 document under the terms of the GNU Free Documentation License,
10 Version 1.2 or any later version published by the Free Software
11 Foundation; with no Invariant Sections, no Front-Cover Texts, and
13 INFO-DIR-SECTION GNU programming tools
15 * AutoGen: (autogen). The Automated Program Generator
18 This file documents GNU AutoGen Version 5.18.
20 AutoGen copyright (C) 1992-2018 Bruce Korb AutoOpts copyright (C)
21 1992-2018 Bruce Korb snprintfv copyright (C) 1999-2000 Gary V. Vaughan
23 AutoGen is free software: you can redistribute it and/or modify it
24 under the terms of the GNU General Public License as published by the
25 Free Software Foundation, either version 3 of the License, or (at your
26 option) any later version.
28 AutoGen is distributed in the hope that it will be useful, but
29 WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
31 Public License for more details.
33 You should have received a copy of the GNU General Public License
34 along with this program. If not, see <http://www.gnu.org/licenses/>.
37 File: autogen.info, Node: Common Attributes, Next: Immediate Action, Prev: Required Attributes, Up: option attributes
39 7.5.5.2 Common Option Attributes
40 ................................
42 These option attributes are optional. Any that do appear in the
43 definition of a flag, may appear only once.
46 The flag character to specify for traditional option flags, e.g.,
50 Maximum occurrence count (invalid if DISABLE present). The default
51 maximum is 1. 'NOLIMIT' can be used for the value, otherwise it
52 must be a number or a '#define' that evaluates to a number.
55 Minimum occurrence count. If present, then the option *must*
56 appear on the command line. Do not define it with the value zero
60 If an option must be specified, but it need not be specified on the
61 command line, then specify this attribute for the option.
64 There are two effects to this attribute: the usage text will not
65 show the option, and the generated documentation will mark it with:
66 _NOTE: THIS OPTION IS DEPRECATED_.
69 Prefix for disabling (inverting sense of) the option. Only useful
70 if long option names are being processed. When an option has this
71 attribute, the test 'ENABLED_OPT(OPTNAME)' is false when either of
72 the following is true:
73 * The option has not been specified and the 'enable' attribute
74 has not been specified.
75 * The option has been specified with this disabling prefix.
76 To detect that the option has been specified with the disabling
78 HAVE_OPT(OPTNAME) && ! ENABLED_OPT(OPTNAME)
81 Long-name prefix for enabling the option (invalid if DISABLE *not*
82 present). Only useful if long option names are being processed.
85 If default is for option being enabled. (Otherwise, the
86 OPTST_DISABLED bit is set at compile time.) Only useful if the
87 option can be disabled.
92 If an option is relevant on certain platforms or when certain
93 features are enabled or disabled, you can specify the compile time
94 flag used to indicate when the option should be compiled in or out.
95 For example, if you have a configurable feature, 'mumble' that is
96 indicated with the compile time define, 'WITH_MUMBLING', then add:
98 ifdef = WITH_MUMBLING;
100 Take care when using these. There are several caveats:
102 * The case and spelling must match whatever is specified.
103 * Do not confuse these attributes with the AutoGen directives of
104 the same names, *Note Directives::. These cause C
105 preprocessing directives to be inserted into the generated C
107 * Only one of 'ifdef' and 'ifndef' may apply to any one option.
108 * The 'VALUE_OPT_' values are '#define'-d. If 'WITH_MUMBLING'
109 is not defined, then the associated 'VALUE_OPT_' value will
110 not be '#define'-d either. So, if you have an option named,
111 'MUMBLING' that is active only if 'WITH_MUMBLING' is
112 '#define'-d, then 'VALUE_OPT_MUMBLING' will be '#define'-d iff
113 'WITH_MUMBLING' is '#define'-d. Watch those switch
115 * If you specify 'omitted-usage', then the option will be
116 recognized as disabled when it is configured out of the build,
117 but will yield the message, "This option has been disabled."
118 You may specify an alternate message by giving 'omitted-usage'
119 a string value. e.g.:
120 omitted-usage = 'you cannot do this';
123 This option specifies that the option is not allowed on the command
124 line. Such an option may not take a 'value' (flag character)
125 attribute. The program must have the 'homerc' (*note program
126 attributes::) option set.
129 File: autogen.info, Node: Immediate Action, Next: Option Conflict Attributes, Prev: Common Attributes, Up: option attributes
131 7.5.5.3 Immediate Action Attributes
132 ...................................
134 Certain options may need to be processed early. For example, in order
135 to suppress the processing of configuration files, it is necessary to
136 process the command line option '--no-load-opts' *before* the config
137 files are processed. To accommodate this, certain options may have
138 their enabled or disabled forms marked for immediate processing. The
139 consequence of this is that they are processed ahead of all other
140 options in the reverse of normal order.
142 Normally, the first options processed are the options specified in
143 the first 'homerc' file, followed by then next 'homerc' file through to
144 the end of config file processing. Next, environment variables are
145 processed and finally, the command line options. The later options
146 override settings processed earlier. That actually gives them higher
147 priority. Command line immediate action options actually have the
148 lowest priority of all. They would be used only if they are to have an
149 effect on the processing of subsequent options.
152 Use this option attribute to specify that the enabled form of the
153 option is to be processed immediately. The 'help' and 'more-help'
154 options are so specified. They will also call 'exit()' upon
155 completion, so they *do* have an effect on the processing of the
156 remaining options :-).
159 Use this option attribute to specify that the disabled form of the
160 option is to be processed immediately. The 'load-opts' option is
161 so specified. The '--no-load-opts' command line option will
162 suppress the processing of config files and environment variables.
163 Contrariwise, the '--load-opts' command line option is processed
164 normally. That means that the options specified in that file will
165 be processed after all the 'homerc' files and, in fact, after
166 options that precede it on the command line.
169 If either the 'immediate' or the 'immed-disable' attributes are set
170 to the string, 'also', then the option will actually be processed
171 twice: first at the immediate processing phase and again at the
175 File: autogen.info, Node: Option Conflict Attributes, Next: opt-attr settable, Prev: Immediate Action, Up: option attributes
177 7.5.5.4 Option Conflict Attributes
178 ..................................
180 These attributes may be used as many times as you need. They are used
181 at the end of the option processing to verify that the context within
182 which each option is found does not conflict with the presence or
183 absence of other options.
185 This is not a complete cover of all possible conflicts and
186 requirements, but it simple to implement and covers the more common
190 one entry for every option that *must* be present when this option
194 one entry for every option that *cannot* be present when this
198 File: autogen.info, Node: opt-attr settable, Next: opt-attr no-preset, Prev: Option Conflict Attributes, Up: option attributes
200 7.5.5.5 Program may set option
201 ..............................
203 If the option can be set outside of option processing, specify
204 'settable'. If this attribute is defined, special macros for setting
205 this particular option will be inserted into the interface file. For
206 example, 'TEMPL_DIRS' is a settable option for AutoGen, so a macro named
207 'SET_OPT_TEMPL_DIRS(a)' appears in the interface file. This attribute
208 interacts with the DOCUMENTATION attribute.
211 File: autogen.info, Node: opt-attr no-preset, Next: opt-attr equivalence, Prev: opt-attr settable, Up: option attributes
213 7.5.5.6 Option cannot be pre-configured
214 .......................................
216 If presetting this option is not allowed, specify 'no-preset'. (Thus,
217 environment variables and values set in configuration files will be
221 File: autogen.info, Node: opt-attr equivalence, Next: opt-attr aliases, Prev: opt-attr no-preset, Up: option attributes
223 7.5.5.7 Option Equivalence Class
224 ................................
226 Generally, when several options are mutually exclusive and basically
227 serve the purpose of selecting one of several processing modes, specify
228 the 'equivalence' attribute. These options will be considered an
229 equivalence class. Sometimes, it is just easier to deal with them as
230 such. All members of the equivalence class must contain the same
231 equivalenced-to option, including the equivalenced-to option itself.
232 Thus, it must be a class member.
234 For an option equivalence class, there is a single occurrence counter
235 for the class. It can be referenced with the interface macro,
236 'COUNT_OPT(BASE_OPTION)', where BASE_OPTION is the equivalenced-to
239 Also, please take careful note: since the options are mapped to the
240 equivalenced-to option descriptor, any option argument values are mapped
241 to that descriptor also. Be sure you know which "equivalent option" was
242 selected before getting an option argument value!
244 During the presetting phase of option processing (*note Presetting
245 Options::), equivalenced options may be specified. However, if
246 different equivalenced members are specified, only the last instance
247 will be recognized and the others will be discarded. A conflict error
248 is indicated only when multiple different members appear on the command
251 As an example of where equivalenced options might be useful,
252 'cpio(1)' has three options '-o', '-i', and '-p' that define the
253 operational mode of the program ('create', 'extract' and 'pass-through',
254 respectively). They form an equivalence class from which one and only
255 one member must appear on the command line. If 'cpio' were an
256 AutoOpt-ed program, then each of these option definitions would contain:
258 equivalence = create;
260 and the program would be able to determine the operating mode with
261 code that worked something like this:
263 switch (WHICH_IDX_CREATE) {
264 case INDEX_OPT_CREATE: ...
265 case INDEX_OPT_EXTRACT: ...
266 case INDEX_OPT_PASS_THROUGH: ...
267 default: /* cannot happen */
271 File: autogen.info, Node: opt-attr aliases, Next: opt-attr default option, Prev: opt-attr equivalence, Up: option attributes
273 7.5.5.8 Option Aliasing
274 .......................
276 Sometimes, for backwards compatibility or tradition or just plain
277 convenience, it works better to define one option as a pure alias for
278 another option. For such situations, provide the following pieces of
281 name = aliasing-option-name;
282 value = aliasing-flag-char; // optional !
283 aliases = aliased-to-option;
285 Do not provide anything else. The usage text for such an option will
287 This is an alias for aliased-to-option
290 File: autogen.info, Node: opt-attr default option, Next: opt-attr documentation, Prev: opt-attr aliases, Up: option attributes
292 7.5.5.9 Default Option
293 ......................
295 If your program processes its arguments in named option mode (See
296 'long-opts' in *note program attributes::), then you may select *one* of
297 your options to be the default option. Do so by using attribute
298 'default' with one of the options. The option so specified must have an
299 'arg-type' (*note Option Arguments::) specified, but not the
300 'arg-optional' (*note arg-optional::) attribute. That is to say, the
301 option argument must be required.
303 If you have done this, then any arguments that do not match an option
304 name and do not contain an equal sign ('=') will be interpreted as an
305 option argument to the default option.
308 File: autogen.info, Node: opt-attr documentation, Next: opt-attr translators, Prev: opt-attr default option, Up: option attributes
310 7.5.5.10 Option Sectioning Comment
311 ..................................
313 This attribute means the option exists for the purpose of separating
314 option description text in the usage output and texi documentation.
315 Without this attribute, every option is a separate node in the texi
316 docs. With this attribute, the documentation options become texi doc
317 nodes and the options are collected under them. Choose the name
318 attribute carefully because it will appear in the texi documentation.
320 Libraries may also choose to make it settable so that the library can
321 determine which command line option is the first one that pertains to
324 If the 'documentation' attribute is present, then all other
325 attributes are disabled except 'settable', 'call-proc' and 'flag-code'.
326 'settable' must be and is only specified if 'call-proc', 'extract-code'
327 or 'flag-code' has been specified. When present, the 'descrip'
328 attribute will be displayed only when the '--help' option has been
329 specified. It will be displayed flush to the left hand margin and may
330 consist of one or more lines of text, filled to 72 columns.
332 The name of the option will not be printed in the help text. It
333 will, however, be printed as section headers in the texi documentation.
334 If the attribute is given a non-empty value, this text will be
335 reproduced in the man page and texi doc immediately after the 'descrip'
339 File: autogen.info, Node: opt-attr translators, Prev: opt-attr documentation, Up: option attributes
341 7.5.5.11 Translator Notes
342 .........................
344 If you need to give the translators a special note about a particular
345 option, please use the 'translators' attribute. The attribute text will
346 be emitted into the generated '.c' text where the option related strings
347 get defined. To make a general comment about all of the option code,
348 add comments to an 'include' attribute (*note program attributes::). Do
349 *not* use this attribute globally, or it will get emitted into every
350 option definition block.
353 File: autogen.info, Node: Option Arguments, Next: Option Argument Handling, Prev: option attributes, Up: Option Definitions
355 7.5.6 Option Argument Specification
356 -----------------------------------
358 Command line options come in three flavors: options that do not take
359 arguments, those that do and those that may. Without an "arg-type"
360 attribute, AutoOpts will not process an argument to an option. If
361 "arg-type" is specified and "arg-optional" is also specified, then the
362 next command line token will be taken to be an argument, unless it looks
363 like the name of another option.
365 If the argument type is specified to be anything other than
366 "str[ing]", then AutoOpts will specify a callback procedure to handle
367 the argument. Some of these procedures will be created and inserted
368 into the generated '.c' file, and others are already built into the
369 'libopts' library. Therefore, if you write your own callback procedure
370 (*note Option Argument Handling::), then you must either not specify an
371 "arg-type" attribute, or else specify it to be of type "str[ing]". Your
372 callback function will be able to place its own restrictions on what
373 that string may contain or represent.
375 Option argument handling attributes depend upon the value set for the
376 'arg-type' attribute. It specifies the type of argument the option will
377 take. If not present, the option cannot take an argument. If present,
378 it must be an entry in the following table. The first three letters is
383 * arg-type string:: Arg Type String
384 * arg-type number:: Arg Type Number
385 * arg-type boolean:: Arg Type Boolean
386 * arg-type keyword:: Arg Type Keyword
387 * arg-type set membership:: Arg Type Set Membership
388 * arg-type hierarchy:: Arg Type Hierarchical
389 * arg-type file name:: Arg Type File Name
390 * arg-type time-duration:: Arg Type Time Duration
391 * arg-type time-date:: Arg Type Time and Date
393 Supporting attributes for particular argument types:
395 * arg-keyword:: Keyword list
396 * arg-optional:: Option Argument Optional
397 * arg-default:: Default Option Argument Value
400 File: autogen.info, Node: arg-type string, Next: arg-type number, Up: Option Arguments
402 7.5.6.1 Arg Type String
403 .......................
407 The argument may be any arbitrary string, though your program or
408 option callback procedure may place additional constraints upon it.
411 File: autogen.info, Node: arg-type number, Next: arg-type boolean, Prev: arg-type string, Up: Option Arguments
413 7.5.6.2 Arg Type Number
414 .......................
418 The argument must be a correctly formed integer, without any trailing
419 U's or L's. AutoOpts contains a library procedure to convert the string
420 to a number. If you specify range checking with 'arg-range' (see
421 below), then AutoOpts produces a special purpose procedure for this
425 'scaled' marks the option so that suffixes of 'k', 'K', 'm', 'M',
426 'g', 'G', 't', and 'T' will multiply the given number by a power of
427 1000 or 1024. Lower case letters scale by a power of 1000 and
428 upper case scale by a power of 1024.
431 'arg-range' is used to create a callback procedure for validating
432 the range of the option argument. It must match one of the range
433 entries. Each 'arg-range' should consist of either an integer by
434 itself or an integer range. The integer range is specified by one
435 or two integers separated by the two character sequence, '->'. Be
436 sure to quote the entire range string. The definitions parser will
437 not accept the range syntax as a single string token.
439 The generated procedure imposes the range constraints as follows:
440 * A number by itself will match that one value.
441 * The high end of the range may not be 'INT_MIN', both for
442 obvious reasons and because that value is used to indicate a
444 * An omitted lower value implies a lower bound of INT_MIN.
445 * An omitted upper value implies a upper bound of INT_MAX.
446 * The argument value is required. It may not be optional.
447 * The value must match one of the entries. If it can match more
448 than one, then you have redundancies, but no harm will come of
452 File: autogen.info, Node: arg-type boolean, Next: arg-type keyword, Prev: arg-type number, Up: Option Arguments
454 7.5.6.3 Arg Type Boolean
455 ........................
457 'arg-type = boolean;'
459 The argument will be interpreted and always yield either AG_TRUE or
460 AG_FALSE. False values are the empty string, the number zero, or a
461 string that starts with 'f', 'F', 'n' or 'N' (representing False or No).
462 Anything else will be interpreted as True.
465 File: autogen.info, Node: arg-type keyword, Next: arg-type set membership, Prev: arg-type boolean, Up: Option Arguments
467 7.5.6.4 Arg Type Keyword
468 ........................
470 'arg-type = keyword;'
472 The argument must match a specified list of strings (*note
473 arg-keyword::). Assuming you have named the option, 'optn-name', the
474 strings will be converted into an enumeration of type 'te_Optn_Name'
475 with the values 'OPTN_NAME_KEYWORD'.* If you have *not* specified a
476 default value, the value 'OPTN_NAME_UNDEFINED' will be inserted with the
477 value zero. The option will be initialized to that value. You may now
478 use this in your code as follows:
480 te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
482 case OPTN_NAME_UNDEFINED: /* undefined things */ break;
483 case OPTN_NAME_KEYWORD: /* `keyword' things */ break;
484 default: /* utterly impossible */ ;
487 AutoOpts produces a special purpose procedure for this option. You
488 may not specify an alternate handling procedure.
490 If you have need for the string name of the selected keyword, you may
491 obtain this with the macro, 'OPT_OPTN_NAME_VAL2STR(val)'. The value you
492 pass would normally be 'OPT_VALUE_OPTN_NAME', but anything with numeric
493 value that is legal for 'te_Optn_Name' may be passed. Anything out of
494 range will result in the string, '"*INVALID*"' being returned. The
495 strings are read only. It may be used as in:
497 te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
498 printf( "you selected the %s keyword\n",
499 OPT_OPTN_NAME_VAL2STR(opt) );
501 * Note: you may replace the 'OPTN_NAME' enumeration prefix with
502 another prefix by specifying a 'prefix-enum' attribute.
504 Finally, users may specify the argument either by name or by number.
505 Since the numeric equivalents change by having new entries inserted into
506 the keyword list, this would not be a recommended practice. However,
507 either '-1' or '~0' will always be equivalent to specifying the last
511 File: autogen.info, Node: arg-type set membership, Next: arg-type hierarchy, Prev: arg-type keyword, Up: Option Arguments
513 7.5.6.5 Arg Type Set Membership
514 ...............................
518 The argument must be a list of names each of which must match the
519 strings "'all'", "'none'" or one of the keywords (*note arg-keyword::)
520 specified for this option. 'all' will turn on all membership bits and
521 'none' will turn them all off. Specifying one of the keywords will set
522 the corresponding set membership bit on (or off, if negated) . Literal
523 numbers may also be used and may, thereby, set or clear more than one
526 The membership result starts with the previous (or initialized)
527 result. To clear previous results, either start the membership string
528 with 'none +' or with the equals character ('='). To invert (bit flip)
529 the final result (regardless of whether the previous result is carried
530 over or not), start the string with a carat character ('^'). If you
531 wish to invert the result and start without a carried over value, use
532 one of the following: '=^' or '^none+'. These are equivalent.
534 The list of names or numbers must be separated by one of the
535 following characters: '+-|!,' or whitespace. The comma is equivalent to
536 whitespace, except that only one may appear between two entries and it
537 may not appear in conjunction with the OR bar ('|'). The '+|' leading
538 characters or unadorned name signify adding the next named bit to the
539 mask, and the '-!' leading characters indicate removing it.
541 The number of keywords allowed is constrained by the number of bits
542 in a pointer, as the bit set is kept in a 'void *' pointer.
544 If, for example, you specified 'first' in your list of keywords, then
545 you can use the following code to test to see if either 'first' or 'all'
548 uintptr_t opt = OPT_VALUE_OPTN_NAME;
549 if (opt & OPTN_NAME_FIRST)
550 /* OPTN_NAME_FIRST bit was set */ ;
552 AutoOpts produces a special purpose procedure for this option. To
553 set multiple bits as the default (initial) value, you must specify an
554 initial numeric value (which might become inaccurate over time), or else
555 specify 'arg-default' multiple times. Do not specify a series of names
556 conjoined with '+' symbols as the value for any of the 'arg-default'
557 attributes. That works for option parsing, but not for the option code
561 File: autogen.info, Node: arg-type hierarchy, Next: arg-type file name, Prev: arg-type set membership, Up: Option Arguments
563 7.5.6.6 Arg Type Hierarchical
564 .............................
566 'arg-type = hierarchy;'
569 This denotes an option with a structure-valued argument, a.k.a.
570 'subopts' in 'getopts' terminology. The argument is parsed and the
571 values made available to the program via the find and find next calls
572 (*Note libopts-optionFindValue::, *Note libopts-optionGetValue::, and
573 *note libopts-optionFindNextValue::).
575 tOptionValue * val = optionGetValue(VALUE_OPT_OPTN_NAME, "name");
576 while (val != NULL) {
578 val = optionNextValue(VALUE_OPT_OPTN_NAME, val);
579 if (wrong_name(val, "name"))
584 File: autogen.info, Node: arg-type file name, Next: arg-type time-duration, Prev: arg-type hierarchy, Up: Option Arguments
586 7.5.6.7 Arg Type File Name
587 ..........................
591 This argument type will have some validations on the argument and,
592 optionally, actually open the file. You must specify several additonal
593 attributes for the option:
596 If not specified or empty, then the directory portion of the name
597 is checked. The directory must exist or the argument is rejected
598 and the usage procedure is invoked.
600 Otherwise, both the directory as above and the full name is tested
601 for existence. If the value begins with the two letters 'no', then
602 the file must not pre-exist. Otherwise, the file is expected to
606 If not specified or empty, the file is left alone. If the value
607 begins with the four letters 'desc'[riptor], then 'open(2)' is used
608 and 'optArg.argFd' is set. Otherwise, the file is opened with
609 'fopen' and 'optArg.argFp' is set.
612 If 'open-file' is set and not empty, then you must specify the open
613 mode. Set the value to the flag bits or mode string as appropriate
617 File: autogen.info, Node: arg-type time-duration, Next: arg-type time-date, Prev: arg-type file name, Up: Option Arguments
619 7.5.6.8 Arg Type Time Duration
620 ..............................
622 'arg-type = time-duration;'
624 The argument will be converted into a number of seconds. It may be a
625 multi-part number with different parts being multiplied into a seconds
626 value and added into the final result. Valid forms are in the table
627 below. Upper cased letters represent numbers that must be used in the
631 'HH' is multiplied by '3600' and 'MM' multiplied by '60' before
632 they are added to 'SS'. This time specification may not be
633 followed by any other time specs. 'HH' and 'MM' are both optional,
634 though 'HH' cannot be specified without 'MM'.
637 'DAYS' is multiplied by the number of seconds in a day. This value
638 may be followed by (and added to) values specified by 'HH:MM:SS' or
639 the suffixed values below. If present, it must always be first.
642 'HRS' is multiplied by the number of seconds in an hour. This
643 value may be followed by (and added to) values specified by 'MM:SS'
644 or the suffixed values below.
647 'MINS' is multiplied by the number of seconds in a minute. This
648 value may be followed by (and added to) a count of seconds.
651 This value can only be the last value in a time specification. The
652 's' suffix is optional.
654 5 d 1:10:05 ==> 5 days + 1 hour 10 minutes and 5 seconds
655 5 d 1 h 10 m 5 ==> yields: 436205 seconds
656 5d1h10m5s ==> same result -- spaces are optional.
658 When saved into a config file, the value will be stored as a simple
659 count of seconds. There are actually more (many) accepted time duration
660 strings. The full documentation can be found with ISO-8601
661 documentation and the more extedded documentation when
662 'parse_duration()' becomes more widely available.
665 File: autogen.info, Node: arg-type time-date, Next: arg-keyword, Prev: arg-type time-duration, Up: Option Arguments
667 7.5.6.9 Arg Type Time and Date
668 ..............................
670 'arg-type = time-date;'
672 The argument will be converted into the number of seconds since the
673 epoch. The conversion rules are very complicated, please see the
674 'getdate_r(3GNU)' man page. There are some additional restrictions:
676 1. Your project must be compiled with 'PKGDATADIR' defined and naming
678 2. The 'DATEMSK' environment variable will be set to the 'datemsk'
679 file within that directory.
681 If that file is not accessible for any reason, the string will be
682 parsed as a time duration (*note arg-type time-duration::) instead of a
683 specific date and time.
686 File: autogen.info, Node: arg-keyword, Next: arg-optional, Prev: arg-type time-date, Up: Option Arguments
688 7.5.6.10 Keyword list
689 .....................
691 If the 'arg-type' is 'keyword' (*note arg-type keyword::) or
692 'set-membership' (*note arg-type set membership::), then you must
693 specify the list of keywords by a series of 'keyword' entries. The
694 interface file will contain values for '<OPTN_NAME>_<KEYWORD>' for each
695 keyword entry. 'keyword' option types will have an enumeration and
696 'set-membership' option types will have a set of unsigned bits
699 If the 'arg-type' is specifically 'keyword', you may also add special
700 handling code with a 'extra-code' attribute. After
701 'optionEnumerationVal' has converted the input string into an
702 enumeration, you may insert code to process this enumeration value
703 ('pOptDesc->optArg.argEnum').
706 File: autogen.info, Node: arg-optional, Next: arg-default, Prev: arg-keyword, Up: Option Arguments
708 7.5.6.11 Option Argument Optional
709 .................................
711 The 'arg-optional' attribute indicates that the argument to the option
712 is optional (need not be specified on the command line). This is only
713 valid if the ARG-TYPE is 'string' (*note arg-type string::) or 'keyword'
714 (*note arg-type keyword::). If it is 'keyword', then this attribute may
715 also specify the default keyword to assume when the argument is not
716 supplied. If left empty, ARG-DEFAULT (*note arg-default::) or the
717 zero-valued keyword will be used.
719 The syntax rules for identifying the option argument are:
720 * If the option is specified with a flag character and there is a
721 character following the flag character, then string following that
722 flag character is the option argument.
723 * If the flag character is the last character in an argument, then
724 the first character of the next argument is examined. If it is a
725 hyphen, then the option is presumed to not have an argument.
726 Otherwise, the entire next argument is the argument for the option.
727 * If the option is specified with a long option name and that name is
728 ended with an equal sign character ('='), then everything after
729 that character is the option argument.
730 * If the long name is ended by the end of the argument, then the
731 first character of the next argument is examined, just as with the
732 flag character ending an argument string.
734 This is overridden and the options are required if the libopts
735 library gets configured with '--disable-optional-args'.
738 File: autogen.info, Node: arg-default, Prev: arg-optional, Up: Option Arguments
740 7.5.6.12 Default Option Argument Value
741 ......................................
743 This specifies the default option argument value to be used when the
744 option is not specified or preset. You may specify multiple
745 'arg-default' values if the argument type is 'set membership'.
748 File: autogen.info, Node: Option Argument Handling, Next: Internationalizing Options, Prev: Option Arguments, Up: Option Definitions
750 7.5.7 Option Argument Handling
751 ------------------------------
753 AutoOpts will either specify or automatically generate callback
754 procedures for options that take specialized arguments. The only option
755 argument types that are not specialized are plain string arguments and
756 no argument at all. For options that fall into one of those two
757 categories, you may specify your own callback function, as specified
758 below. If you do this and if you specify that options are resettable
759 (*note automatic options::), then your option handling code *must* look
760 for the 'OPTST_RESET' bit in the 'fOptState' field of the option
763 If the option takes a string argument, then the 'stack-arg' attribute
764 can be used to specify that the option is to be handled by the 'libopts'
765 'stackOptArg()' and 'unstackOptArg()' library procedures (see below).
766 In this case, you may not provide option handling code.
768 Finally, 'documentation' options (*note opt-attr documentation::) may
769 also be marked as 'settable' (*note opt-attr settable::) and have
770 special callback functions (either 'flag-code', 'extract-code', or
774 statements to execute when the option is encountered. This may be
775 used in conjunction with option argument types that cause AutoOpts
776 to emit handler code. If you do this, the 'flag-code' with index
777 zero (0) is emitted into the handler code _before_ the argument is
778 handled, and the entry with index one (1) is handled afterward.
780 The generated procedure will be laid out something like this:
783 doOpt<name>(tOptions* pOptions, tOptDesc* pOptDesc)
786 <AutoOpts defined handler code>
790 Only certain fields within the 'tOptions' and 'tOptDesc' structures
791 may be accessed. *Note Option Processing Data::. When writing
792 this code, you must be very careful with the 'pOptions' pointer.
793 The handler code is called with this pointer set to special values
794 for handling special situations. Your code must handle them. As
795 an example, look at 'optionEnumerationVal' in 'enum.c'.
798 This is effectively identical to 'flag-code', except that the
799 source is kept in the output file instead of the definitions file
800 and you cannot use this in conjunction with options with arguments,
801 other than string arguments.
803 A long comment is used to demarcate the code. You must not modify
804 that marker. Before regenerating the option code file, the old
805 file is renamed from MUMBLE.c to MUMBLE.c.save. The template will
806 be looking there for the text to copy into the new output file.
809 external procedure to call when option is encountered. The calling
810 sequence must conform to the sequence defined above for the
811 generated procedure, 'doOpt<name>'. It has the same restrictions
812 regarding the fields within the structures passed in as arguments.
813 *Note Option Processing Data::.
816 Name of another option whose 'flag-code' can be executed when this
817 option is encountered.
820 Call a special library routine to stack the option's arguments.
821 Special macros in the interface file are provided for determining
822 how many of the options were found ('STACKCT_OPT(NAME)') and to
823 obtain a pointer to a list of pointers to the argument values
824 ('STACKLST_OPT(NAME)'). Obviously, for a stackable argument, the
825 'max' attribute (*note Common Attributes::) needs to be set higher
828 If this stacked argument option has a disablement prefix, then the
829 entire stack of arguments will be cleared by specifying the option
830 with that disablement prefix.
833 Call a special library routine to remove ('unstack') strings from a
834 'stack-arg' option stack. This attribute must name the option that
835 is to be 'unstacked'. Neither this option nor the stacked argument
836 option it references may be equivalenced to another option.
839 File: autogen.info, Node: Internationalizing Options, Next: documentation attributes, Prev: Option Argument Handling, Up: Option Definitions
841 7.5.8 Internationalizing Options
842 --------------------------------
844 Normally, AutoOpts produces usage text that is difficult to translate.
845 It is pieced together on the fly using words and phrases scattered
846 around here and there, piecing together toe document. This does not
849 Incorporated into this package are some ways around the problem.
850 First, you should specify the 'full-usage' and 'short-usage' program
851 attributes (*note program attributes::). This will enable your
852 translators to translate the usage text as a whole.
854 Your translators will also be able to translate long option names.
855 The option name translations will then become the names searched for
856 both on the command line and in configuration files. However, it will
857 not affect the names of environment variable names used to configure
860 If it is considered desireable to keep configuration files in the 'C'
861 locale, then several macros are available to suppress or delay the
862 translations of option names at run time. These are all disabled if
863 'ENABLE_NLS' is not defined at compile time or if 'no-xlate' has been
864 set to the value _anything_. These macros *must* be invoked before the
865 first invocation of 'optionProcess'.
867 'OPT_NO_XLAT_CFG_NAMES;'
868 'OPT_XLAT_CFG_NAMES;'
869 Disable (or enable) the translations of option names for
870 configuration files. If you enable translation for config files,
871 then they will be translated for command line options.
873 'OPT_NO_XLAT_OPT_NAMES;'
874 'OPT_XLAT_OPT_NAMES;'
875 Disable (or enable) the translations of option names for command
876 line processing. If you disable the translation for command line
877 processing, you will also disable it for configuration file
878 processing. Once translated, the option names will remain
882 File: autogen.info, Node: documentation attributes, Next: automatic options, Prev: Internationalizing Options, Up: Option Definitions
884 7.5.9 Man and Info doc Attributes
885 ---------------------------------
887 AutoOpts includes AutoGen templates for producing abbreviated man pages
888 and for producing the invoking section of an info document. To take
889 advantage of these templates, you must add several attributes to your
894 * per option attributes:: Per option documentation attributes
895 * global option attributes:: Global documentation attributes
898 File: autogen.info, Node: per option attributes, Next: global option attributes, Up: documentation attributes
900 7.5.9.1 Per option documentation attributes
901 ...........................................
903 These attributes are sub-attributes (sub-stanzas) of the 'flag' stanzas.
906 If an option has an argument, the argument should have a name for
907 documentation purposes. It will default to 'arg-type', but it will
908 likely be clearer with something else like, 'file-name' instead of
912 First, every 'flag' definition _other than_ 'documentation'
913 definitions, must have a 'doc' attribute defined. If the option
914 takes an argument, then it will need an 'arg-name' attribute as
915 well. The 'doc' text should be in plain sentences with minimal
916 formatting. The Texinfo commands '@code', and '@var' will have its
917 enclosed text made into *\fB* entries in the man page, and the
918 '@file' text will be made into *\fI* entries. The 'arg-name'
919 attribute is used to display the option's argument in the man page.
921 Options marked with the 'documentation' attribute are for
922 documenting the usage text. All other options should have the
923 'doc' attribute in order to document the usage of the option in the
926 Since these blocks of text are inserted into all output forms, any
927 markup text included in these blocks must be massaged for each
928 output format. By default, it is presumed to be 'texi' format.
931 File: autogen.info, Node: global option attributes, Prev: per option attributes, Up: documentation attributes
933 7.5.9.2 Global documentation attributes
934 .......................................
937 If your command is a game or a system management command, specify
938 this attribute with the value '5' or '8', respectively. The
939 default is a user command (section 1).
942 This attribute is used to add a very short explanation about what a
943 program is used for when the 'title' attribute is insufficient. If
944 there is no 'doc-section' stanza of type 'DESCRIPTION', then this
945 text is used for the man page DESCRIPTION section, too.
948 This attribute tells the template that the generated code should be
949 surrounded with the following doxygen comments:
950 /** @file <header-or-code-file-name>
951 * @addtogroup <value-of-addtogroup>
958 Specify the default markup style for the 'doc' stanzas. By
959 default, it is 'texi', but 'man' and 'mdoc' may also be selected.
960 There are nine converter programs that do a partial job of
961 converting one form of markup into another. 'texi2texi', 'man2man'
962 and 'mdoc2mdoc' work pretty well.
964 You may also post process the document by using 'doc-sub' stanzas,
968 This text will be inserted as a lead-in paragraph in the 'OPTIONS'
969 section of the generated man page.
972 This is a compound attribute that requires three subattributes:
975 This describes the format of the associated 'ds-text' section.
976 'man', 'mdoc' and 'texi' formats are supported. Regardless of
977 the chosen format, the formatting tags in the output text will
978 be converted to 'man' macros for 'man' pages, 'mdoc' macros
979 for 'mdoc' pages, and 'texi' macros for 'texinfo' pages.
982 This is the descriptive text, written according to the rules
983 for 'ds-format' documents.
986 This describes the section type. Basically, the title of the
987 section that will be added to all output documentation. There
988 may be only one 'doc-section' for any given 'ds-type'. If
989 there are duplicates, the results are undefined (it might
992 There are five categories of 'ds-type' sections. They are
993 those that the documentation templates would otherwise:
994 1. always create itself, ignoring any 'ds-type's by this
995 name. These are marked, below, as 'ao-only'.
996 2. create, if none was provided. These are marked,
998 3. create, but augment if the 'doc-section' was provided.
999 These are marked, 'augments'.
1000 4. do nothing, but inserts them into the output in a
1001 prescribed order. These are marked, 'known'
1002 5. knows nothing about them. They will be alphabetized and
1003 inserted after the list of leading sections and before
1004 the list of trailing sections. These are not marked
1005 because I don't know their names.
1007 Some of these are emitted by the documentation templates only
1008 if certain conditions are met. If there are conditions, they
1009 are explained below. If there are no conditions, then you
1010 will always see the named section in the output.
1012 The output sections will appear in this order:
1022 'ao-only', if environment presets or configuration file
1023 processing has been specified.
1025 At this point, the unknown, alphabetized sections are
1027 'IMPLEMENTATION NOTES'
1030 'augments', if environment presets have been specified.
1032 'augments', if configuration file processing has been
1049 'alternate', if the 'copyright' stanza has either an
1050 'author' or an 'owner' attribute.
1052 'alternate', if there is a 'copyright' stanza.
1054 'augments', if the 'copyright' stanza has an 'eaddr'
1059 Here is an example of a 'doc-section' for a 'SEE ALSO' type.
1062 ds-type = 'SEE ALSO'; // or anything else
1063 ds-format = 'man'; // or texi or mdoc format
1064 ds-text = <<-_EOText_
1065 text relevant to this section type,
1066 in the chosen format
1071 This attribute will cause the resulting documentation to be
1072 post-processed. This is normally with 'sed', see 'doc-sub-cmd'
1073 below. This attribute has several sub-attributes:
1076 This is the name of an autogen text definition value, like
1077 'prog-name' or 'version'. In the 'sub-text' field,
1078 occurrences of this name preceded by two less than characters
1079 and followed by two greater than characters will be replaced
1080 by the text value of the definition, e.g. '<<prog-name>>'.
1083 The text that gets added to the command file for the post
1087 If this command only applies to certain types of output,
1088 specify this with a regular expression that will match one of
1089 the valid output format types, e.g. 'man|mdoc' will match
1090 those two kinds, but not 'texi' output. If omitted, it will
1093 For example, if you want to reference the program name in the 'doc'
1094 text for an option common to two programs, put '#PROG#' into the
1095 text. The following will replace all occrrences of '#PROG#' with
1096 the current value for 'prog':
1098 sub-name = prog-name;
1099 sub-text = 's/#PROG#/<<prog-name>>/g';
1103 A formatting string for constructing the post-processing command.
1104 The first parameter is the name of the file with editing commands
1105 in it, and the second is the file containing the unprocessed
1106 document. The default value is:
1110 File: autogen.info, Node: automatic options, Next: standard options, Prev: documentation attributes, Up: Option Definitions
1112 7.5.10 Automatically Supported Options
1113 --------------------------------------
1115 AutoOpts provides automated support for several options. 'help' and
1116 'more-help' are always provided. The others are conditional upon
1117 various global program attributes being defined *Note program
1120 Below are the option names and default flag values. The flags are
1121 activated if and only if at least one user-defined option also uses a
1122 flag value. The long names are supported as option names if 'long-opts'
1123 has been specified. These option flags may be deleted or changed to
1124 characters of your choosing by specifying 'xxx-value = "y";', where
1125 'xxx' is one of the option names below and 'y' is either empty or the
1126 character of your choice. For example, to change the help flag from '?'
1127 to 'h', specify 'help-value = "h";'; and to require that 'save-opts' be
1128 specified only with its long option name, specify 'save-opts-value =
1131 Additionally, the procedure that prints out the program version may
1132 be replaced by specifying 'version-proc'. This procedure must be
1133 defined to be of external scope (non-static). By default, the AutoOpts
1134 library provides 'optionPrintVersion' and it will be the specified
1135 callback function in the option definition structure.
1137 With the exception of the 'load-opts' option, none of these
1138 automatically supported options will be recognized in configuration
1139 files or environment variables.
1142 This option will immediately invoke the 'USAGE()' procedure and
1143 display the usage line, a description of each option with its
1144 description and option usage information. This is followed by the
1145 contents of the definition of the 'detail' text macro.
1148 This option is identical to the 'help' option, except that the
1149 output is passed through a pager program. ('more' by default, or
1150 the program identified by the 'PAGER' environment variable.)
1153 This option must be requested by specifying, 'usage-opt' in the
1154 option definition file. It will produce abbreviated help text to
1155 'stdout' and exit with zero status ('EXIT_SUCCESS').
1159 This will print the program name, title and version. If it is not
1160 followed by anything or is followed by the letter 'v', just the
1161 program name and version will be printed. If followed by the
1162 letter 'c' and a value for 'copyright' and 'owner' have been
1163 provided, then the copyright will be printed, too. If it is
1164 followed by the letter 'n', then the full copyright notice (if
1165 available) will be printed. The 'version' attribute must be
1166 specified in the option definition file.
1168 Because some target platforms discourage optional arguments to
1169 options, the autoopts library can be compiled with
1170 'NO_OPTIONAL_OPT_ARGS' defined. Alternatively, the 'version-type'
1171 attribute can be added to the option definitions and it can specify
1172 which flavor is preferred. In either case, an argument to the
1173 '--version' option will then be disallowed.
1176 This option will load options from the named file. They will be
1177 treated exactly as if they were loaded from the normally found
1178 configuration files, but will not be loaded until the option is
1179 actually processed. This can also be used within another
1180 configuration file, causing them to nest. This is the *only*
1181 automatically supported option that can be activated inside of
1182 config files or with environment variables.
1184 Specifying the negated form of the option ('--no-load-opts') will
1185 suppress the processing of configuration files and environment
1188 This option is activated by specifying one or more 'homerc'
1192 This option will cause the option state to be printed in the
1193 configuration file format when option processing is done but not
1194 yet verified for consistency. The program will terminate
1195 successfully without running when this has completed. Note that
1196 for most shells you will have to quote or escape the flag character
1197 to restrict special meanings to the shell.
1199 The output file will be the configuration file name (default or
1200 provided by 'rcfile') in the last directory named in a 'homerc'
1203 This option may be set from within your program by invoking the
1204 "'SET_OPT_SAVE_OPTS(filename)'" macro (*note SET_OPT_name::).
1205 Invoking this macro will set the file name for saving the option
1206 processing state, but the state will *not* actually be saved. You
1207 must call 'optionSaveFile' to do that (*note
1208 libopts-optionSaveFile::). *CAVEAT:* if, after invoking this
1209 macro, you call 'optionProcess', the option processing state will
1210 be saved to this file and 'optionProcess' will not return. You may
1211 wish to invoke 'CLEAR_OPT( SAVE_OPTS )' (*note CLEAR_OPT::)
1212 beforehand if you do need to reinvoke 'optionProcess'.
1214 This option is activated by specifying one or more 'homerc'
1217 The method of saving the state may be altered by specifying flags
1218 before the output file name. "Flags" are specified by placing a
1219 list of them before the file name and separating them from the name
1220 with one or two greater-than characters (">"). There are three
1221 flags currently supported:
1224 If an option has a default value (has not been set), then the
1225 default value is inserted as a comment.
1228 Every option that can be processed from the configuration file
1229 will have a comment that contains the usage string that gets
1230 printed with the '--help' text
1233 Instead of removing the old file and writing a new one, the
1234 output file is kept, but any pre-existing segment labeled with
1235 '<?program prog-name>' is removed. The new program segment is
1236 placed at the end of the file. This flag is implied if the
1237 flags are separated from the file name with doubled
1238 greater-than characters. In other words, 'update,usage >
1239 file-name' and 'usage >> file-name' are identical.
1242 This option takes the name of an option for the current program and
1243 resets its state such that it is set back to its original,
1244 compile-time initialized value. If the option state is
1245 subsequently stored (via '--save-opts'), the named option will not
1246 appear in that file.
1248 This option is activated by specifying the 'resettable' attribute.
1250 *BEWARE*: If the 'resettable' attribute is specified, all option
1251 callbacks *must* look for the 'OPTST_RESET' bit in the 'fOptState'
1252 field of the option descriptor. If set, the 'optCookie' and
1253 'optArg' fields will be unchanged from their last setting. When
1254 the callback returns, these fields will be set to their original
1255 values. If you use this feature and you have allocated data
1256 hanging off of the cookie, you need to deallocate it.
1259 File: autogen.info, Node: standard options, Prev: automatic options, Up: Option Definitions
1261 7.5.11 Library of Standard Options
1262 ----------------------------------
1264 AutoOpts has developed a set of standardized options. You may
1265 incorporate these options in your program simply by _first_ adding a
1266 '#define' for the options you want, and then the line,
1268 #include stdoptions.def
1270 in your option definitions. The supported options are specified thus:
1285 By default, only the long form of the option will be available. To
1286 specify the short (flag) form, suffix these names with '_FLAG'. e.g.,
1290 '--silent', '--quiet', '--brief' and '--verbose' are related in that
1291 they all indicate some level of diagnostic output. These options are
1292 all designed to conflict with each other. Instead of four different
1293 options, however, several levels can be incorporated by '#define'-ing
1294 'VERBOSE_ENUM'. In conjunction with 'VERBOSE', it incorporates the
1295 notion of 5 levels in an enumeration: 'silent', 'quiet', 'brief',
1296 'informative' and 'verbose'; with the default being 'brief'.
1298 Here is an example program that uses the following set of
1301 AutoGen Definitions options;
1303 prog-name = default-test;
1304 prog-title = 'Default Option Example';
1305 homerc = '$$/../share/default-test', '$HOME', '.';
1312 main-type = shell-process;
1317 #define VERBOSE_FLAG
1318 #define VERBOSE_ENUM
1319 #define DRY_RUN_FLAG
1322 #define DIRECTORY_FLAG
1323 #define INTERACTIVE_FLAG
1324 #include stdoptions.def
1326 Running a few simple commands on that definition file:
1328 autogen default-test.def
1329 copts="-DTEST_DEFAULT_TEST_OPTS `autoopts-config cflags`"
1330 lopts="`autoopts-config ldflags`"
1331 cc -o default-test ${copts} default-test.c ${lopts}
1333 Yields a program which, when run with '--help', prints out:
1339 File: autogen.info, Node: AutoOpts API, Next: Multi-Threading, Prev: Option Definitions, Up: AutoOpts
1341 7.6 Programmatic Interface
1342 ==========================
1344 The user interface for access to the argument information is completely
1345 defined in the generated header file and in the portions of the
1346 distributed file "options.h" that are marked "public".
1348 In the following macros, text marked <NAME> or NAME is the name of
1349 the option *in upper case* and *segmented with underscores '_'*. The
1350 macros and enumerations defined in the options header (interface) file
1351 are used as follows:
1353 To see how these '#define' macros are used in a program, the reader
1354 is referred to the several 'opts.h' files included with the AutoGen
1359 * Option Processing Data:: Data for Option Processing
1360 * CLEAR_OPT:: CLEAR_OPT( <NAME> ) - Clear Option Markings
1361 * COUNT_OPT:: COUNT_OPT( <NAME> ) - Definition Count
1362 * DESC:: DESC( <NAME> ) - Option Descriptor
1363 * DISABLE_OPT_name:: DISABLE_OPT_name - Disable an option
1364 * ENABLED_OPT:: ENABLED_OPT( <NAME> ) - Is Option Enabled?
1365 * ERRSKIP_OPTERR:: ERRSKIP_OPTERR - Ignore Option Errors
1366 * ERRSTOP_OPTERR:: ERRSTOP_OPTERR - Stop on Errors
1367 * HAVE_OPT:: HAVE_OPT( <NAME> ) - Have this option?
1368 * ISSEL_OPT:: ISSEL_OPT( <NAME> ) - Is Option Selected?
1369 * ISUNUSED_OPT:: ISUNUSED_OPT( <NAME> ) - Never Specified?
1370 * OPTION_CT:: OPTION_CT - Full Count of Options
1371 * OPT_ARG:: OPT_ARG( <NAME> ) - Option Argument String
1372 * OPT_NO_XLAT_CFG_NAMES:: OPT_NO_XLAT_CFG_NAMES - option name xlation
1373 * OPT_NO_XLAT_OPT_NAMES:: OPT_NO_XLAT_OPT_NAMES - option name xlation
1374 * OPT_VALUE_name:: OPT_VALUE_name - Option Argument Value
1375 * OPT_XLAT_CFG_NAMES:: OPT_XLAT_CFG_NAMES - option name xlation
1376 * OPT_XLAT_OPT_NAMES:: OPT_XLAT_OPT_NAMES - option name xlation
1377 * RESTART_OPT:: RESTART_OPT( n ) - Resume Option Processing
1378 * SET_OPT_name:: SET_OPT_name - Force an option to be set
1379 * STACKCT_OPT:: STACKCT_OPT( <NAME> ) - Stacked Arg Count
1380 * STACKLST_OPT:: STACKLST_OPT( <NAME> ) - Argument Stack
1381 * START_OPT:: START_OPT - Restart Option Processing
1382 * STATE_OPT:: STATE_OPT( <NAME> ) - Option State
1383 * USAGE:: USAGE( exit-code ) - Usage invocation macro
1384 * VALUE_OPT_name:: VALUE_OPT_name - Option Flag Value
1385 * VERSION:: VERSION - Version and Full Version
1386 * WHICH_IDX_name:: WHICH_IDX_name - Which Equivalenced Index
1387 * WHICH_OPT_name:: WHICH_OPT_name - Which Equivalenced Option
1388 * teOptIndex:: teOptIndex - Option Index and Enumeration
1389 * OPTIONS_STRUCT_VERSION:: OPTIONS_STRUCT_VERSION - active version
1390 * libopts procedures:: libopts External Procedures
1393 File: autogen.info, Node: Option Processing Data, Next: CLEAR_OPT, Up: AutoOpts API
1395 7.6.1 Data for Option Processing
1396 --------------------------------
1398 This section describes the data that may be accessed from within the
1399 option processing callback routines. The following fields may be used
1400 in the following ways and may be used for read only. The first set is
1401 addressed from the 'tOptDesc*' pointer:
1405 These may be used by option procedures to determine which option
1406 they are working on (in case they handle several options).
1410 These may be used by option procedures to determine which option
1411 was used to set the current option. This may be different from the
1412 above if the options are members of an equivalence class.
1415 If AutoOpts is processing command line arguments, then this value
1416 will contain the current occurrence count. During the option
1417 preset phase (reading configuration files and examining environment
1418 variables), the value is zero.
1421 The field may be tested for the following bit values (prefix each
1422 name with 'OPTST_', e.g. 'OPTST_INIT'):
1425 Initial compiled value. As a bit test, it will always yield
1429 The option was set via the 'SET_OPT()' macro.
1432 The option was set via a configuration file.
1435 The option was set via a command line option.
1438 This is a mask of flags that show the set state, one of the
1442 This bit is set when the option was selected by an
1443 equivalenced option.
1446 This bit is set if the option is to be disabled. (Meaning it
1447 was a long option prefixed by the disablement prefix, or the
1448 option has not been specified yet and initializes as
1451 As an example of how this might be used, in AutoGen I want to allow
1452 template writers to specify that the template output can be left in
1453 a writable or read-only state. To support this, there is a Guile
1454 function named 'set-writable' (*note SCM set-writable::). Also, I
1455 provide for command options '--writable' and '--not-writable'. I
1456 give precedence to command line and RC file options, thus:
1458 switch (STATE_OPT( WRITABLE )) {
1461 fprintf(stderr, zOverrideWarn, pCurTemplate->pzFileName,
1466 if (gh_boolean_p( set ) && (set == SCM_BOOL_F))
1467 CLEAR_OPT( WRITABLE );
1473 Pointer to the latest argument string. BEWARE If the argument type
1474 is numeric, an enumeration or a bit mask, then this will be the
1475 argument *value* and not a pointer to a string.
1477 The following two fields are addressed from the 'tOptions*' pointer:
1480 Points to a NUL-terminated string containing the current program
1481 name, as retrieved from the argument vector.
1484 Points to a NUL-terminated string containing the full path of the
1485 current program, as retrieved from the argument vector. (If
1486 available on your system.)
1488 Note these fields get filled in during the first call to
1489 'optionProcess()'. All other fields are private, for the exclusive use
1490 of AutoOpts code and are subject to change.
1493 File: autogen.info, Node: CLEAR_OPT, Next: COUNT_OPT, Prev: Option Processing Data, Up: AutoOpts API
1495 7.6.2 CLEAR_OPT( <NAME> ) - Clear Option Markings
1496 -------------------------------------------------
1498 Make as if the option had never been specified. 'HAVE_OPT(<NAME>)' will
1499 yield 'FALSE' after invoking this macro.
1502 File: autogen.info, Node: COUNT_OPT, Next: DESC, Prev: CLEAR_OPT, Up: AutoOpts API
1504 7.6.3 COUNT_OPT( <NAME> ) - Definition Count
1505 --------------------------------------------
1507 This macro will tell you how many times the option was specified on the
1508 command line. It does not include counts of preset options.
1510 if (COUNT_OPT( NAME ) != desired-count) {
1511 make-an-undesirable-message.
1515 File: autogen.info, Node: DESC, Next: DISABLE_OPT_name, Prev: COUNT_OPT, Up: AutoOpts API
1517 7.6.4 DESC( <NAME> ) - Option Descriptor
1518 ----------------------------------------
1520 This macro is used internally by other AutoOpt macros. It is not for
1521 general use. It is used to obtain the option description corresponding
1522 to its *UPPER CASED* option name argument. This is primarily used in
1523 other macro definitions.
1526 File: autogen.info, Node: DISABLE_OPT_name, Next: ENABLED_OPT, Prev: DESC, Up: AutoOpts API
1528 7.6.5 DISABLE_OPT_name - Disable an option
1529 ------------------------------------------
1531 This macro is emitted if it is both settable and it can be disabled. If
1532 it cannot be disabled, it may always be CLEAR-ed (see above).
1534 The form of the macro will actually depend on whether the option is
1535 equivalenced to another, and/or has an assigned handler procedure.
1536 Unlike the 'SET_OPT' macro, this macro does not allow an option
1542 File: autogen.info, Node: ENABLED_OPT, Next: ERRSKIP_OPTERR, Prev: DISABLE_OPT_name, Up: AutoOpts API
1544 7.6.6 ENABLED_OPT( <NAME> ) - Is Option Enabled?
1545 ------------------------------------------------
1547 Yields true if the option defaults to disabled and 'ISUNUSED_OPT()'
1548 would yield true. It also yields true if the option has been specified
1549 with a disablement prefix, disablement value or the 'DISABLE_OPT_NAME'
1553 File: autogen.info, Node: ERRSKIP_OPTERR, Next: ERRSTOP_OPTERR, Prev: ENABLED_OPT, Up: AutoOpts API
1555 7.6.7 ERRSKIP_OPTERR - Ignore Option Errors
1556 -------------------------------------------
1558 When it is necessary to continue (return to caller) on option errors,
1559 invoke this option. It is reversible. *Note ERRSTOP_OPTERR::.
1562 File: autogen.info, Node: ERRSTOP_OPTERR, Next: HAVE_OPT, Prev: ERRSKIP_OPTERR, Up: AutoOpts API
1564 7.6.8 ERRSTOP_OPTERR - Stop on Errors
1565 -------------------------------------
1567 After invoking this macro, if 'optionProcess()' encounters an error, it
1568 will call 'exit(1)' rather than return. This is the default processing
1569 mode. It can be overridden by specifying 'allow-errors' in the
1570 definitions file, or invoking the macro *Note ERRSKIP_OPTERR::.
1573 File: autogen.info, Node: HAVE_OPT, Next: ISSEL_OPT, Prev: ERRSTOP_OPTERR, Up: AutoOpts API
1575 7.6.9 HAVE_OPT( <NAME> ) - Have this option?
1576 --------------------------------------------
1578 This macro yields true if the option has been specified in any fashion
1579 at all. It is used thus:
1581 if (HAVE_OPT( NAME )) {
1582 <do-things-associated-with-opt-name>;
1586 File: autogen.info, Node: ISSEL_OPT, Next: ISUNUSED_OPT, Prev: HAVE_OPT, Up: AutoOpts API
1588 7.6.10 ISSEL_OPT( <NAME> ) - Is Option Selected?
1589 ------------------------------------------------
1591 This macro yields true if the option has been specified either on the
1592 command line or via a SET/DISABLE macro.
1595 File: autogen.info, Node: ISUNUSED_OPT, Next: OPTION_CT, Prev: ISSEL_OPT, Up: AutoOpts API
1597 7.6.11 ISUNUSED_OPT( <NAME> ) - Never Specified?
1598 ------------------------------------------------
1600 This macro yields true if the option has never been specified, or has
1601 been cleared via the 'CLEAR_OPT()' macro.
1604 File: autogen.info, Node: OPTION_CT, Next: OPT_ARG, Prev: ISUNUSED_OPT, Up: AutoOpts API
1606 7.6.12 OPTION_CT - Full Count of Options
1607 ----------------------------------------
1609 The full count of all options, both those defined and those generated
1610 automatically by AutoOpts. This is primarily used to initialize the
1611 program option descriptor structure.
1614 File: autogen.info, Node: OPT_ARG, Next: OPT_NO_XLAT_CFG_NAMES, Prev: OPTION_CT, Up: AutoOpts API
1616 7.6.13 OPT_ARG( <NAME> ) - Option Argument String
1617 -------------------------------------------------
1619 The option argument value as a pointer to string. Note that argument
1620 values that have been specified as numbers are stored as numbers or
1621 keywords. For such options, use instead the 'OPT_VALUE_name' define.
1624 if (HAVE_OPT( NAME )) {
1625 char* p = OPT_ARG( NAME );
1626 <do-things-with-opt-name-argument-string>;
1630 File: autogen.info, Node: OPT_NO_XLAT_CFG_NAMES, Next: OPT_NO_XLAT_OPT_NAMES, Prev: OPT_ARG, Up: AutoOpts API
1632 7.6.14 OPT_NO_XLAT_CFG_NAMES - option name xlation
1633 --------------------------------------------------
1635 Invoking this macro will disable the translation of option names only
1636 while processing configuration files and environment variables. This
1637 must be invoked before the first call to 'optionProcess'.. You need not
1638 invoke this if your option definition file contains the attribute
1639 assignment, 'no-xlate = opt-cfg;'.
1642 File: autogen.info, Node: OPT_NO_XLAT_OPT_NAMES, Next: OPT_VALUE_name, Prev: OPT_NO_XLAT_CFG_NAMES, Up: AutoOpts API
1644 7.6.15 OPT_NO_XLAT_OPT_NAMES - option name xlation
1645 --------------------------------------------------
1647 Invoking this macro will completely disable the translation of option
1648 names. This must be invoked before the first call to 'optionProcess'.
1649 You need not invoke this if your option definition file contains the
1650 attribute assignment, 'no-xlate = opt;'.
1653 File: autogen.info, Node: OPT_VALUE_name, Next: OPT_XLAT_CFG_NAMES, Prev: OPT_NO_XLAT_OPT_NAMES, Up: AutoOpts API
1655 7.6.16 OPT_VALUE_name - Option Argument Value
1656 ---------------------------------------------
1658 This macro gets emitted only for options that take numeric, keyword or
1659 set membership arguments. The macro yields a word-sized integer
1660 containing the enumeration, bit set or numeric value for the option
1663 int opt_val = OPT_VALUE_name;
1666 File: autogen.info, Node: OPT_XLAT_CFG_NAMES, Next: OPT_XLAT_OPT_NAMES, Prev: OPT_VALUE_name, Up: AutoOpts API
1668 7.6.17 OPT_XLAT_CFG_NAMES - option name xlation
1669 -----------------------------------------------
1671 If 'ENABLE_NLS' is defined and 'no-xlate' has been not set to the value
1672 _anything_, this macro will cause the translation of option names to
1673 happen before starting the processing of configuration files and
1674 environment variables. This will change the recognition of options
1675 within the '$PROGRAMNAME' environment variable, but will not alter the
1676 names used for setting options via '$PROGRAMNAME_name' environment
1679 This must be invoked before the first call to 'optionProcess'. You
1680 might need to use this macro if your option definition file contains the
1681 attribute assignment, 'no-xlate = opt;' or 'no-xlate = opt-cfg;', and
1682 you have determined in some way that you wish to override that.
1685 File: autogen.info, Node: OPT_XLAT_OPT_NAMES, Next: RESTART_OPT, Prev: OPT_XLAT_CFG_NAMES, Up: AutoOpts API
1687 7.6.18 OPT_XLAT_OPT_NAMES - option name xlation
1688 -----------------------------------------------
1690 If 'ENABLE_NLS' is defined and 'no-xlate' has been not set to the value
1691 _anything_, translate the option names before processing the command
1692 line options. Long option names may thus be localized. (If the names
1693 were translated before configuration processing, they will not be
1696 This must be invoked before the first call to 'optionProcess'. You
1697 might need to use this macro if your option definition file contains the
1698 attribute assignment, 'no-xlate = opt;' and you have determined in some
1699 way that you wish to override that.
1702 File: autogen.info, Node: RESTART_OPT, Next: SET_OPT_name, Prev: OPT_XLAT_OPT_NAMES, Up: AutoOpts API
1704 7.6.19 RESTART_OPT( n ) - Resume Option Processing
1705 --------------------------------------------------
1707 If option processing has stopped (either because of an error or
1708 something was encountered that looked like a program argument), it can
1709 be resumed by providing this macro with the index 'n' of the next option
1710 to process and calling 'optionProcess()' again.
1712 int main(int argc, char ** argv) {
1713 for (int ai = 0; ai < argc ;) {
1715 ai = optionProcess(&progOptions, argc, argv);
1716 for (; ai < argc; ai++) {
1717 char * arg = arg[ai];
1727 If you want a program to operate this way, you might consider
1728 specifying a 'for-each' main function (*note for-each main procedure:
1729 main for-each.) with the 'interleaved' attribute. It will allow you to
1730 process interleaved operands and options from either the command line or
1731 when reading them from standard input.
1734 File: autogen.info, Node: SET_OPT_name, Next: STACKCT_OPT, Prev: RESTART_OPT, Up: AutoOpts API
1736 7.6.20 SET_OPT_name - Force an option to be set
1737 -----------------------------------------------
1739 This macro gets emitted only when the given option has the 'settable'
1740 attribute specified.
1742 The form of the macro will actually depend on whether the option is
1743 equivalenced to another, has an option argument and/or has an assigned
1744 handler procedure. If the option has an argument, then this macro will
1745 too. Beware that the argument is not reallocated, so the value must not
1746 be on the stack or deallocated in any other way for as long as the value
1747 might get referenced.
1749 If you have supplied at least one 'homerc' file (*note program
1750 attributes::), this macro will be emitted for the '--save-opts' option.
1752 SET_OPT_SAVE_OPTS( "filename" );
1754 *Note automatic options::, for a discussion of the implications of using
1755 this particular example.
1758 File: autogen.info, Node: STACKCT_OPT, Next: STACKLST_OPT, Prev: SET_OPT_name, Up: AutoOpts API
1760 7.6.21 STACKCT_OPT( <NAME> ) - Stacked Arg Count
1761 ------------------------------------------------
1763 When the option handling attribute is specified as 'stack_arg', this
1764 macro may be used to determine how many of them actually got stacked.
1766 Do not use this on options that have not been stacked or has not been
1767 specified (the 'stack_arg' attribute must have been specified, and
1768 'HAVE_OPT(<NAME>)' must yield TRUE). Otherwise, you will likely seg
1771 if (HAVE_OPT( NAME )) {
1772 int ct = STACKCT_OPT( NAME );
1773 char** pp = STACKLST_OPT( NAME );
1782 File: autogen.info, Node: STACKLST_OPT, Next: START_OPT, Prev: STACKCT_OPT, Up: AutoOpts API
1784 7.6.22 STACKLST_OPT( <NAME> ) - Argument Stack
1785 ----------------------------------------------
1787 The address of the list of pointers to the option arguments. The
1788 pointers are ordered by the order in which they were encountered in the
1789 option presets and command line processing.
1791 Do not use this on options that have not been stacked or has not been
1792 specified (the 'stack_arg' attribute must have been specified, and
1793 'HAVE_OPT(<OPTION>)' must yield TRUE). Otherwise, you will likely seg
1796 if (HAVE_OPT( NAME )) {
1797 int ct = STACKCT_OPT( NAME );
1798 char** pp = STACKLST_OPT( NAME );
1807 File: autogen.info, Node: START_OPT, Next: STATE_OPT, Prev: STACKLST_OPT, Up: AutoOpts API
1809 7.6.23 START_OPT - Restart Option Processing
1810 --------------------------------------------
1812 This is just a shortcut for RESTART_OPT(1) (*Note RESTART_OPT::.)
1815 File: autogen.info, Node: STATE_OPT, Next: USAGE, Prev: START_OPT, Up: AutoOpts API
1817 7.6.24 STATE_OPT( <NAME> ) - Option State
1818 -----------------------------------------
1820 If you need to know if an option was set because of presetting actions
1821 (configuration file processing or environment variables), versus a
1822 command line entry versus one of the SET/DISABLE macros, then use this
1823 macro. It will yield one of four values: 'OPTST_INIT', 'OPTST_SET',
1824 'OPTST_PRESET' or 'OPTST_DEFINED'. It is used thus:
1826 switch (STATE_OPT( NAME )) {
1828 not-preset, set or on the command line. (unless CLEAR-ed)
1831 option set via the SET_OPT_NAME() macro.
1834 option set via an configuration file or environment variable
1837 option set via a command line option.
1844 File: autogen.info, Node: USAGE, Next: VALUE_OPT_name, Prev: STATE_OPT, Up: AutoOpts API
1846 7.6.25 USAGE( exit-code ) - Usage invocation macro
1847 --------------------------------------------------
1849 This macro invokes the procedure registered to display the usage text.
1850 Normally, this will be 'optionUsage' from the AutoOpts library, but you
1851 may select another procedure by specifying 'usage = "proc_name"' program
1852 attribute. This procedure must take two arguments first, a pointer to
1853 the option descriptor, and second the exit code. The macro supplies the
1854 option descriptor automatically. This routine is expected to call
1855 'exit(3)' with the provided exit code.
1857 The 'optionUsage' routine also behaves differently depending on the
1860 'EXIT_SUCCESS (the value zero)'
1861 It is assumed that full usage help has been requested.
1862 Consequently, more information is provided than when displaying
1863 usage and exiting with a non-zero exit code. Output will be sent
1864 to 'stdout' and the program will exit with a zero status code.
1867 The abbreviated usage will be printed to 'stdout' and the program
1868 will exit with a zero status code. 'EX_USAGE' may or may not be
1869 64. If your system provides '/usr/include/sysexits.h' that has a
1870 different value, then that value will be used.
1873 The abbreviated usage will be printed to stderr and the program
1874 will exit with the provided status code.
1877 File: autogen.info, Node: VALUE_OPT_name, Next: VERSION, Prev: USAGE, Up: AutoOpts API
1879 7.6.26 VALUE_OPT_name - Option Flag Value
1880 -----------------------------------------
1882 This is a #define for the flag character used to specify an option on
1883 the command line. If 'value' was not specified for the option, then it
1884 is a unique number associated with the option. 'option value' refers to
1885 this value, 'option argument' refers to the (optional) argument to the
1888 switch (WHICH_OPT_OTHER_OPT) {
1889 case VALUE_OPT_NAME:
1890 this-option-was-really-opt-name;
1891 case VALUE_OPT_OTHER_OPT:
1892 this-option-was-really-other-opt;
1896 File: autogen.info, Node: VERSION, Next: WHICH_IDX_name, Prev: VALUE_OPT_name, Up: AutoOpts API
1898 7.6.27 VERSION - Version and Full Version
1899 -----------------------------------------
1901 If the 'version' attribute is defined for the program, then a
1902 stringified version will be #defined as PROGRAM_VERSION and
1903 PROGRAM_FULL_VERSION. PROGRAM_FULL_VERSION is used for printing the
1904 program version in response to the version option. The version option
1905 is automatically supplied in response to this attribute, too.
1907 You may access PROGRAM_VERSION via 'programOptions.pzFullVersion'.
1910 File: autogen.info, Node: WHICH_IDX_name, Next: WHICH_OPT_name, Prev: VERSION, Up: AutoOpts API
1912 7.6.28 WHICH_IDX_name - Which Equivalenced Index
1913 ------------------------------------------------
1915 This macro gets emitted only for equivalenced-to options. It is used to
1916 obtain the index for the one of the several equivalence class members
1917 set the equivalenced-to option.
1919 switch (WHICH_IDX_OTHER_OPT) {
1920 case INDEX_OPT_NAME:
1921 this-option-was-really-opt-name;
1922 case INDEX_OPT_OTHER_OPT:
1923 this-option-was-really-other-opt;
1927 File: autogen.info, Node: WHICH_OPT_name, Next: teOptIndex, Prev: WHICH_IDX_name, Up: AutoOpts API
1929 7.6.29 WHICH_OPT_name - Which Equivalenced Option
1930 -------------------------------------------------
1932 This macro gets emitted only for equivalenced-to options. It is used to
1933 obtain the value code for the one of the several equivalence class
1934 members set the equivalenced-to option.
1936 switch (WHICH_OPT_OTHER_OPT) {
1937 case VALUE_OPT_NAME:
1938 this-option-was-really-opt-name;
1939 case VALUE_OPT_OTHER_OPT:
1940 this-option-was-really-other-opt;
1944 File: autogen.info, Node: teOptIndex, Next: OPTIONS_STRUCT_VERSION, Prev: WHICH_OPT_name, Up: AutoOpts API
1946 7.6.30 teOptIndex - Option Index and Enumeration
1947 ------------------------------------------------
1949 This enum defines the complete set of options, both user specified and
1950 automatically provided. This can be used, for example, to distinguish
1951 which of the equivalenced options was actually used.
1953 switch (pOptDesc->optActualIndex) {
1954 case INDEX_OPT_FIRST:
1956 case INDEX_OPT_DIFFERENT:
1963 File: autogen.info, Node: OPTIONS_STRUCT_VERSION, Next: libopts procedures, Prev: teOptIndex, Up: AutoOpts API
1965 7.6.31 OPTIONS_STRUCT_VERSION - active version
1966 ----------------------------------------------
1968 You will not actually need to reference this value, but you need to be
1969 aware that it is there. It is the first value in the option descriptor
1970 that you pass to 'optionProcess'. It contains a magic number and
1971 version information. Normally, you should be able to work with a more
1972 recent option library than the one you compiled with. However, if the
1973 library is changed incompatibly, then the library will detect the out of
1974 date magic marker, explain the difficulty and exit. You will then need
1975 to rebuild and recompile your option definitions. This has rarely been
1979 File: autogen.info, Node: libopts procedures, Prev: OPTIONS_STRUCT_VERSION, Up: AutoOpts API
1981 7.6.32 libopts External Procedures
1982 ----------------------------------
1984 These are the routines that libopts users may call directly from their
1985 code. There are several other routines that can be called by code
1986 generated by the libopts option templates, but they are not to be called
1987 from any other user code. The 'options.h' header is fairly clear about
1992 * libopts-ao_string_tokenize:: ao_string_tokenize
1993 * libopts-configFileLoad:: configFileLoad
1994 * libopts-optionFileLoad:: optionFileLoad
1995 * libopts-optionFindNextValue:: optionFindNextValue
1996 * libopts-optionFindValue:: optionFindValue
1997 * libopts-optionFree:: optionFree
1998 * libopts-optionGetValue:: optionGetValue
1999 * libopts-optionLoadLine:: optionLoadLine
2000 * libopts-optionMemberList:: optionMemberList
2001 * libopts-optionNextValue:: optionNextValue
2002 * libopts-optionOnlyUsage:: optionOnlyUsage
2003 * libopts-optionPrintVersion:: optionPrintVersion
2004 * libopts-optionPrintVersionAndReturn:: optionPrintVersionAndReturn
2005 * libopts-optionProcess:: optionProcess
2006 * libopts-optionRestore:: optionRestore
2007 * libopts-optionSaveFile:: optionSaveFile
2008 * libopts-optionSaveState:: optionSaveState
2009 * libopts-optionUnloadNested:: optionUnloadNested
2010 * libopts-optionVersion:: optionVersion
2011 * libopts-strequate:: strequate
2012 * libopts-streqvcmp:: streqvcmp
2013 * libopts-streqvmap:: streqvmap
2014 * libopts-strneqvcmp:: strneqvcmp
2015 * libopts-strtransform:: strtransform
2017 This subsection was automatically generated by AutoGen using
2018 extracted information and the aginfo3.tpl template.
2021 File: autogen.info, Node: libopts-ao_string_tokenize, Next: libopts-configFileLoad, Up: libopts procedures
2023 7.6.32.1 ao_string_tokenize
2024 ...........................
2026 tokenize an input string
2029 token_list_t * res = ao_string_tokenize( string );
2030 Where the arguments are:
2031 Name Type Description
2033 string 'char const string to be tokenized
2035 returns token_list_t pointer to a structure that lists each
2038 This function will convert one input string into a list of strings.
2039 The list of strings is derived by separating the input based on white
2040 space separation. However, if the input contains either single or
2041 double quote characters, then the text after that character up to a
2042 matching quote will become the string in the list.
2044 The returned pointer should be deallocated with 'free(3C)' when are
2045 done using the data. The data are placed in a single block of allocated
2046 memory. Do not deallocate individual token/strings.
2048 The structure pointed to will contain at least these two fields:
2050 The number of tokens found in the input string.
2052 An array of 'tkn_ct + 1' pointers to substring tokens, with the
2053 last pointer set to NULL.
2055 There are two types of quoted strings: single quoted (''') and double
2056 quoted ('"'). Singly quoted strings are fairly raw in that escape
2057 characters ('\\') are simply another character, except when preceding
2058 the following characters:
2059 \\ double backslashes reduce to one
2060 ' incorporates the single quote into the string
2061 \n suppresses both the backslash and newline character
2063 Double quote strings are formed according to the rules of string
2064 constants in ANSI-C programs.
2066 NULL is returned and 'errno' will be set to indicate the problem:
2067 * 'EINVAL' - There was an unterminated quoted string.
2068 * 'ENOENT' - The input string was empty.
2069 * 'ENOMEM' - There is not enough memory.
2072 File: autogen.info, Node: libopts-configFileLoad, Next: libopts-optionFileLoad, Prev: libopts-ao_string_tokenize, Up: libopts procedures
2074 7.6.32.2 configFileLoad
2075 .......................
2077 parse a configuration file
2080 const tOptionValue * res = configFileLoad( fname );
2081 Where the arguments are:
2082 Name Type Description
2084 fname 'char const the file to load
2086 returns const An allocated, compound value structure
2090 This routine will load a named configuration file and parse the text
2091 as a hierarchically valued option. The option descriptor created from
2092 an option definition file is not used via this interface. The returned
2093 value is "named" with the input file name and is of type
2094 "'OPARG_TYPE_HIERARCHY'". It may be used in calls to
2095 'optionGetValue()', 'optionNextValue()' and 'optionUnloadNested()'.
2097 If the file cannot be loaded or processed, 'NULL' is returned and
2098 ERRNO is set. It may be set by a call to either 'open(2)' 'mmap(2)' or
2099 other file system calls, or it may be:
2100 * 'ENOENT' - the file was not found.
2101 * 'ENOMSG' - the file was empty.
2102 * 'EINVAL' - the file contents are invalid - not properly formed.
2103 * 'ENOMEM' - not enough memory to allocate the needed structures.
2106 File: autogen.info, Node: libopts-optionFileLoad, Next: libopts-optionFindNextValue, Prev: libopts-configFileLoad, Up: libopts procedures
2108 7.6.32.3 optionFileLoad
2109 .......................
2111 Load the locatable config files, in order
2114 int res = optionFileLoad( opts, prog );
2115 Where the arguments are:
2116 Name Type Description
2118 opts 'tOptions *' program options descriptor
2120 prog 'char const program name
2122 returns int 0 -> SUCCESS, -1 -> FAILURE
2124 This function looks in all the specified directories for a
2125 configuration file ("rc" file or "ini" file) and processes any found
2126 twice. The first time through, they are processed in reverse order
2127 (last file first). At that time, only "immediate action" configurables
2128 are processed. For example, if the last named file specifies not
2129 processing any more configuration files, then no more configuration
2130 files will be processed. Such an option in the *first* named directory
2131 will have no effect.
2133 Once the immediate action configurables have been handled, then the
2134 directories are handled in normal, forward order. In that way, later
2135 config files can override the settings of earlier config files.
2137 See the AutoOpts documentation for a thorough discussion of the
2140 Configuration files not found or not decipherable are simply ignored.
2142 Returns the value, "-1" if the program options descriptor is out of
2143 date or indecipherable. Otherwise, the value "0" will always be
2147 File: autogen.info, Node: libopts-optionFindNextValue, Next: libopts-optionFindValue, Prev: libopts-optionFileLoad, Up: libopts procedures
2149 7.6.32.4 optionFindNextValue
2150 ............................
2152 find a hierarcicaly valued option instance
2155 const tOptionValue * res = optionFindNextValue( odesc, pPrevVal, name, value );
2156 Where the arguments are:
2157 Name Type Description
2159 odesc 'const an option with a nested arg type
2161 pPrevVal 'const the last entry
2164 name 'char const name of value to find
2166 value 'char const the matching value
2168 returns const a compound value structure
2172 This routine will find the next entry in a nested value option or
2173 configurable. It will search through the list and return the next entry
2174 that matches the criteria.
2176 The returned result is NULL and errno is set:
2177 * 'EINVAL' - the 'pOptValue' does not point to a valid hierarchical
2179 * 'ENOENT' - no entry matched the given name.
2182 File: autogen.info, Node: libopts-optionFindValue, Next: libopts-optionFree, Prev: libopts-optionFindNextValue, Up: libopts procedures
2184 7.6.32.5 optionFindValue
2185 ........................
2187 find a hierarcicaly valued option instance
2190 const tOptionValue * res = optionFindValue( odesc, name, val );
2191 Where the arguments are:
2192 Name Type Description
2194 odesc 'const an option with a nested arg type
2196 name 'char const name of value to find
2198 val 'char const the matching value
2200 returns const a compound value structure
2204 This routine will find an entry in a nested value option or
2205 configurable. It will search through the list and return a matching
2208 The returned result is NULL and errno is set:
2209 * 'EINVAL' - the 'pOptValue' does not point to a valid hierarchical
2211 * 'ENOENT' - no entry matched the given name.
2214 File: autogen.info, Node: libopts-optionFree, Next: libopts-optionGetValue, Prev: libopts-optionFindValue, Up: libopts procedures
2219 free allocated option processing memory
2222 optionFree( pOpts );
2223 Where the arguments are:
2224 Name Type Description
2226 pOpts 'tOptions *' program options descriptor
2228 AutoOpts sometimes allocates memory and puts pointers to it in the
2229 option state structures. This routine deallocates all such memory.
2231 As long as memory has not been corrupted, this routine is always
2235 File: autogen.info, Node: libopts-optionGetValue, Next: libopts-optionLoadLine, Prev: libopts-optionFree, Up: libopts procedures
2237 7.6.32.7 optionGetValue
2238 .......................
2240 get a specific value from a hierarcical list
2243 const tOptionValue * res = optionGetValue( pOptValue, valueName );
2244 Where the arguments are:
2245 Name Type Description
2247 pOptValue 'const a hierarchcal value
2250 valueName 'char const name of value to get
2252 returns const a compound value structure
2256 This routine will find an entry in a nested value option or
2257 configurable. If "valueName" is NULL, then the first entry is returned.
2258 Otherwise, the first entry with a name that exactly matches the argument
2259 will be returned. If there is no matching value, NULL is returned and
2260 errno is set to ENOENT. If the provided option value is not a
2261 hierarchical value, NULL is also returned and errno is set to EINVAL.
2263 The returned result is NULL and errno is set:
2264 * 'EINVAL' - the 'pOptValue' does not point to a valid hierarchical
2266 * 'ENOENT' - no entry matched the given name.
2269 File: autogen.info, Node: libopts-optionLoadLine, Next: libopts-optionMemberList, Prev: libopts-optionGetValue, Up: libopts procedures
2271 7.6.32.8 optionLoadLine
2272 .......................
2274 process a string for an option name and value
2277 optionLoadLine( opts, line );
2278 Where the arguments are:
2279 Name Type Description
2281 opts 'tOptions *' program options descriptor
2283 line 'char const NUL-terminated text
2286 This is a client program callable routine for setting options from,
2287 for example, the contents of a file that they read in. Only one option
2288 may appear in the text. It will be treated as a normal (non-preset)
2291 When passed a pointer to the option struct and a string, it will find
2292 the option named by the first token on the string and set the option
2293 argument to the remainder of the string. The caller must NUL terminate
2294 the string. The caller need not skip over any introductory hyphens.
2295 Any embedded new lines will be included in the option argument. If the
2296 input looks like one or more quoted strings, then the input will be
2297 "cooked". The "cooking" is identical to the string formation used in
2298 AutoGen definition files (*note basic expression::), except that you may
2301 Invalid options are silently ignored. Invalid option arguments will
2302 cause a warning to print, but the function should return.
2305 File: autogen.info, Node: libopts-optionMemberList, Next: libopts-optionNextValue, Prev: libopts-optionLoadLine, Up: libopts procedures
2307 7.6.32.9 optionMemberList
2308 .........................
2310 Get the list of members of a bit mask set
2313 char * res = optionMemberList( od );
2314 Where the arguments are:
2315 Name Type Description
2317 od 'tOptDesc *' the set membership option description
2318 returns char * the names of the set bits
2320 This converts the OPT_VALUE_name mask value to a allocated string.
2321 It is the caller's responsibility to free the string.
2324 File: autogen.info, Node: libopts-optionNextValue, Next: libopts-optionOnlyUsage, Prev: libopts-optionMemberList, Up: libopts procedures
2326 7.6.32.10 optionNextValue
2327 .........................
2329 get the next value from a hierarchical list
2332 const tOptionValue * res = optionNextValue( pOptValue, pOldValue );
2333 Where the arguments are:
2334 Name Type Description
2336 pOptValue 'const a hierarchcal list value
2339 pOldValue 'const a value from this list
2342 returns const a compound value structure
2346 This routine will return the next entry after the entry passed in.
2347 At the end of the list, NULL will be returned. If the entry is not
2348 found on the list, NULL will be returned and "ERRNO" will be set to
2349 EINVAL. The "POLDVALUE" must have been gotten from a prior call to this
2350 routine or to "'opitonGetValue()'".
2352 The returned result is NULL and errno is set:
2353 * 'EINVAL' - the 'pOptValue' does not point to a valid hierarchical
2354 option value or 'pOldValue' does not point to a member of that
2356 * 'ENOENT' - the supplied 'pOldValue' pointed to the last entry.
2359 File: autogen.info, Node: libopts-optionOnlyUsage, Next: libopts-optionPrintVersion, Prev: libopts-optionNextValue, Up: libopts procedures
2361 7.6.32.11 optionOnlyUsage
2362 .........................
2364 Print usage text for just the options
2367 optionOnlyUsage( pOpts, ex_code );
2368 Where the arguments are:
2369 Name Type Description
2371 pOpts 'tOptions *' program options descriptor
2373 ex_code 'int' exit code for calling exit(3)
2375 This routine will print only the usage for each option. This
2376 function may be used when the emitted usage must incorporate information
2377 not available to AutoOpts.
2380 File: autogen.info, Node: libopts-optionPrintVersion, Next: libopts-optionPrintVersionAndReturn, Prev: libopts-optionOnlyUsage, Up: libopts procedures
2382 7.6.32.12 optionPrintVersion
2383 ............................
2385 Print the program version
2388 optionPrintVersion( opts, od );
2389 Where the arguments are:
2390 Name Type Description
2392 opts 'tOptions *' program options descriptor
2394 od 'tOptDesc *' the descriptor for this arg
2396 This routine will print the version to stdout.
2399 File: autogen.info, Node: libopts-optionPrintVersionAndReturn, Next: libopts-optionProcess, Prev: libopts-optionPrintVersion, Up: libopts procedures
2401 7.6.32.13 optionPrintVersionAndReturn
2402 .....................................
2404 Print the program version
2407 optionPrintVersionAndReturn( opts, od );
2408 Where the arguments are:
2409 Name Type Description
2411 opts 'tOptions *' program options descriptor
2413 od 'tOptDesc *' the descriptor for this arg
2415 This routine will print the version to stdout and return instead of
2416 exiting. Please see the source for the 'print_ver' funtion for details
2417 on selecting how verbose to be after this function returns.
2420 File: autogen.info, Node: libopts-optionProcess, Next: libopts-optionRestore, Prev: libopts-optionPrintVersionAndReturn, Up: libopts procedures
2422 7.6.32.14 optionProcess
2423 .......................
2425 this is the main option processing routine
2428 int res = optionProcess( opts, a_ct, a_v );
2429 Where the arguments are:
2430 Name Type Description
2432 opts 'tOptions *' program options descriptor
2434 a_ct 'int' program arg count
2436 a_v 'char **' program arg vector
2437 returns int the count of the arguments processed
2439 This is the main entry point for processing options. It is intended
2440 that this procedure be called once at the beginning of the execution of
2441 a program. Depending on options selected earlier, it is sometimes
2442 necessary to stop and restart option processing, or to select completely
2443 different sets of options. This can be done easily, but you generally
2444 do not want to do this.
2446 The number of arguments processed always includes the program name.
2447 If one of the arguments is "-", then it is counted and the processing
2448 stops. If an error was encountered and errors are to be tolerated, then
2449 the returned value is the index of the argument causing the error. A
2450 hyphen by itself ("-") will also cause processing to stop and will _not_
2451 be counted among the processed arguments. A hyphen by itself is treated
2452 as an operand. Encountering an operand stops option processing.
2454 Errors will cause diagnostics to be printed. 'exit(3)' may or may
2455 not be called. It depends upon whether or not the options were
2456 generated with the "allow-errors" attribute, or if the ERRSKIP_OPTERR or
2457 ERRSTOP_OPTERR macros were invoked.
2460 File: autogen.info, Node: libopts-optionRestore, Next: libopts-optionSaveFile, Prev: libopts-optionProcess, Up: libopts procedures
2462 7.6.32.15 optionRestore
2463 .......................
2465 restore option state from memory copy
2468 optionRestore( pOpts );
2469 Where the arguments are:
2470 Name Type Description
2472 pOpts 'tOptions *' program options descriptor
2474 Copy back the option state from saved memory. The allocated memory
2475 is left intact, so this routine can be called repeatedly without having
2476 to call optionSaveState again. If you are restoring a state that was
2477 saved before the first call to optionProcess(3AO), then you may change
2478 the contents of the argc/argv parameters to optionProcess.
2480 If you have not called 'optionSaveState' before, a diagnostic is
2481 printed to 'stderr' and exit is called.
2484 File: autogen.info, Node: libopts-optionSaveFile, Next: libopts-optionSaveState, Prev: libopts-optionRestore, Up: libopts procedures
2486 7.6.32.16 optionSaveFile
2487 ........................
2489 saves the option state to a file
2492 optionSaveFile( opts );
2493 Where the arguments are:
2494 Name Type Description
2496 opts 'tOptions *' program options descriptor
2498 This routine will save the state of option processing to a file. The
2499 name of that file can be specified with the argument to the
2500 '--save-opts' option, or by appending the 'rcfile' attribute to the last
2501 'homerc' attribute. If no 'rcfile' attribute was specified, it will
2502 default to '.programnamerc'. If you wish to specify another file, you
2503 should invoke the 'SET_OPT_SAVE_OPTS(filename)' macro.
2505 The recommend usage is as follows:
2506 optionProcess(&progOptions, argc, argv);
2507 if (i_want_a_non_standard_place_for_this)
2508 SET_OPT_SAVE_OPTS("myfilename");
2509 optionSaveFile(&progOptions);
2511 If no 'homerc' file was specified, this routine will silently return
2512 and do nothing. If the output file cannot be created or updated, a
2513 message will be printed to 'stderr' and the routine will return.
2516 File: autogen.info, Node: libopts-optionSaveState, Next: libopts-optionUnloadNested, Prev: libopts-optionSaveFile, Up: libopts procedures
2518 7.6.32.17 optionSaveState
2519 .........................
2521 saves the option state to memory
2524 optionSaveState( pOpts );
2525 Where the arguments are:
2526 Name Type Description
2528 pOpts 'tOptions *' program options descriptor
2530 This routine will allocate enough memory to save the current option
2531 processing state. If this routine has been called before, that memory
2532 will be reused. You may only save one copy of the option state. This
2533 routine may be called before optionProcess(3AO). If you do call it
2534 before the first call to optionProcess, then you may also change the
2535 contents of argc/argv after you call optionRestore(3AO)
2537 In fact, more strongly put: it is safest to only use this function
2538 before having processed any options. In particular, the saving and
2539 restoring of stacked string arguments and hierarchical values is
2540 disabled. The values are not saved.
2542 If it fails to allocate the memory, it will print a message to stderr
2543 and exit. Otherwise, it will always succeed.
2546 File: autogen.info, Node: libopts-optionUnloadNested, Next: libopts-optionVersion, Prev: libopts-optionSaveState, Up: libopts procedures
2548 7.6.32.18 optionUnloadNested
2549 ............................
2551 Deallocate the memory for a nested value
2554 optionUnloadNested( pOptVal );
2555 Where the arguments are:
2556 Name Type Description
2558 pOptVal 'tOptionValue the hierarchical value
2561 A nested value needs to be deallocated. The pointer passed in should
2562 have been gotten from a call to 'configFileLoad()' (See *note
2563 libopts-configFileLoad::).
2566 File: autogen.info, Node: libopts-optionVersion, Next: libopts-strequate, Prev: libopts-optionUnloadNested, Up: libopts procedures
2568 7.6.32.19 optionVersion
2569 .......................
2571 return the compiled AutoOpts version number
2574 char const * res = optionVersion();
2575 Where the arguments are:
2576 Name Type Description
2578 returns char const * the version string in constant memory
2580 Returns the full version string compiled into the library. The
2581 returned string cannot be modified.
2584 File: autogen.info, Node: libopts-strequate, Next: libopts-streqvcmp, Prev: libopts-optionVersion, Up: libopts procedures
2589 map a list of characters to the same value
2592 strequate( ch_list );
2593 Where the arguments are:
2594 Name Type Description
2596 ch_list 'char const characters to equivalence
2599 Each character in the input string get mapped to the first character
2600 in the string. This function name is mapped to option_strequate so as
2601 to not conflict with the POSIX name space.
2606 File: autogen.info, Node: libopts-streqvcmp, Next: libopts-streqvmap, Prev: libopts-strequate, Up: libopts procedures
2611 compare two strings with an equivalence mapping
2614 int res = streqvcmp( str1, str2 );
2615 Where the arguments are:
2616 Name Type Description
2618 str1 'char const first string
2620 str2 'char const second string
2622 returns int the difference between two differing
2625 Using a character mapping, two strings are compared for
2626 "equivalence". Each input character is mapped to a comparison character
2627 and the mapped-to characters are compared for the two NUL terminated
2628 input strings. This function name is mapped to option_streqvcmp so as
2629 to not conflict with the POSIX name space.
2631 none checked. Caller responsible for seg faults.
2634 File: autogen.info, Node: libopts-streqvmap, Next: libopts-strneqvcmp, Prev: libopts-streqvcmp, Up: libopts procedures
2639 Set the character mappings for the streqv functions
2642 streqvmap( from, to, ct );
2643 Where the arguments are:
2644 Name Type Description
2646 from 'char' Input character
2648 to 'char' Mapped-to character
2650 ct 'int' compare length
2652 Set the character mapping. If the count ('ct') is set to zero, then
2653 the map is cleared by setting all entries in the map to their index
2654 value. Otherwise, the "'From'" character is mapped to the "'To'"
2655 character. If 'ct' is greater than 1, then 'From' and 'To' are
2656 incremented and the process repeated until 'ct' entries have been set.
2658 streqvmap('a', 'A', 26);
2659 will alter the mapping so that all English lower case letters will map
2662 This function name is mapped to option_streqvmap so as to not
2663 conflict with the POSIX name space.
2668 File: autogen.info, Node: libopts-strneqvcmp, Next: libopts-strtransform, Prev: libopts-streqvmap, Up: libopts procedures
2670 7.6.32.23 strneqvcmp
2671 ....................
2673 compare two strings with an equivalence mapping
2676 int res = strneqvcmp( str1, str2, ct );
2677 Where the arguments are:
2678 Name Type Description
2680 str1 'char const first string
2682 str2 'char const second string
2684 ct 'int' compare length
2685 returns int the difference between two differing
2688 Using a character mapping, two strings are compared for
2689 "equivalence". Each input character is mapped to a comparison character
2690 and the mapped-to characters are compared for the two NUL terminated
2691 input strings. The comparison is limited to 'ct' bytes. This function
2692 name is mapped to option_strneqvcmp so as to not conflict with the POSIX
2695 none checked. Caller responsible for seg faults.
2698 File: autogen.info, Node: libopts-strtransform, Prev: libopts-strneqvcmp, Up: libopts procedures
2700 7.6.32.24 strtransform
2701 ......................
2703 convert a string into its mapped-to value
2706 strtransform( dest, src );
2707 Where the arguments are:
2708 Name Type Description
2710 dest 'char *' output string
2712 src 'char const input string
2715 Each character in the input string is mapped and the mapped-to
2716 character is put into the output. This function name is mapped to
2717 option_strtransform so as to not conflict with the POSIX name space.
2719 The source and destination may be the same.
2724 File: autogen.info, Node: Multi-Threading, Next: option descriptor, Prev: AutoOpts API, Up: AutoOpts
2729 AutoOpts was designed to configure a program for running. This
2730 generally happens before much real work has been started. Consequently,
2731 it is expected to be run before multi-threaded applications have started
2732 multiple threads. However, this is not always the case. Some
2733 applications may need to reset and reload their running configuration,
2734 and some may use 'SET_OPT_xxx()' macros during processing. If you need
2735 to dynamically change your option configuration in your multi-threaded
2736 application, it is your responsibility to prevent all threads from
2737 accessing the option configuration state, except the one altering the
2740 The various accessor macros ('HAVE_OPT()', etc.) do not modify state
2741 and are safe to use in a multi-threaded application. It is safe as long
2742 as no other thread is concurrently modifying state, of course.
2745 File: autogen.info, Node: option descriptor, Next: Using AutoOpts, Prev: Multi-Threading, Up: AutoOpts
2747 7.8 Option Descriptor File
2748 ==========================
2750 This is the module that is to be compiled and linked with your program.
2751 It contains internal data and procedures subject to change. Basically,
2752 it contains a single global data structure containing all the
2753 information provided in the option definitions, plus a number of static
2754 strings and any callout procedures that are specified or required. You
2755 should never have need for looking at this, except, perhaps, to examine
2756 the code generated for implementing the 'flag-code' construct.
2759 File: autogen.info, Node: Using AutoOpts, Next: Presetting Options, Prev: option descriptor, Up: AutoOpts
2764 There are actually several levels of 'using' autoopts. Which you choose
2765 depends upon how you plan to distribute (or not) your application.
2769 * local use:: local-only use
2770 * binary not installed:: binary distro, AutoOpts not installed
2771 * binary pre-installed:: binary distro, AutoOpts pre-installed
2772 * source pre-installed:: source distro, AutoOpts pre-installed
2773 * source not installed:: source distro, AutoOpts not installed
2776 File: autogen.info, Node: local use, Next: binary not installed, Up: Using AutoOpts
2778 7.9.1 local-only use
2779 --------------------
2781 To use AutoOpts in your application where you do not have to worry about
2782 distribution issues, your issues are simple and few.
2784 * Create a file 'myopts.def', according to the documentation above.
2785 It is probably easiest to start with the example in *note Quick
2786 Start:: and edit it into the form you need.
2788 * Run AutoGen to create the option interface file ('myopts.h') and
2789 the option descriptor code ('myopts.c'):
2793 * In all your source files where you need to refer to option state,
2794 '#include "myopts.h"'.
2795 * In your main routine, code something along the lines of:
2797 #define ARGC_MIN some-lower-limit
2798 #define ARGC_MAX some-upper-limit
2799 main( int argc, char** argv )
2802 int arg_ct = optionProcess( &myprogOptions, argc, argv );
2804 if ((argc < ARGC_MIN) || (argc > ARGC_MAX)) {
2805 fprintf( stderr, "%s ERROR: remaining args (%d) "
2806 "out of range\n", myprogOptions.pzProgName,
2809 USAGE( EXIT_FAILURE );
2813 if (HAVE_OPT(OPTN_NAME))
2814 respond_to_optn_name();
2818 * Compile 'myopts.c' and link your program with the following
2819 additional arguments:
2821 `autoopts-config cflags ldflags` myopts.c
2824 File: autogen.info, Node: binary not installed, Next: binary pre-installed, Prev: local use, Up: Using AutoOpts
2826 7.9.2 binary distro, AutoOpts not installed
2827 -------------------------------------------
2829 If you will be distributing (or copying) your project to a system that
2830 does not have AutoOpts installed, you will need to statically link the
2831 AutoOpts library, 'libopts' into your program. Get the link information
2832 with 'static-libs' instead of 'ldflags':
2834 `autoopts-config static-libs`
2837 File: autogen.info, Node: binary pre-installed, Next: source pre-installed, Prev: binary not installed, Up: Using AutoOpts
2839 7.9.3 binary distro, AutoOpts pre-installed
2840 -------------------------------------------
2842 If you will be distributing (or copying) your project to a system that
2843 does have AutoOpts (or only 'libopts') installed, you will still need to
2844 ensure that the library is findable at program load time, or you will
2845 still have to statically link. The former can be accomplished by
2846 linking your project with '--rpath' or by setting the 'LD_LIBRARY_PATH'
2847 appropriately. Otherwise, *Note binary not installed::.
2850 File: autogen.info, Node: source pre-installed, Next: source not installed, Prev: binary pre-installed, Up: Using AutoOpts
2852 7.9.4 source distro, AutoOpts pre-installed
2853 -------------------------------------------
2855 If you will be distributing your project to a system that will build
2856 your product but it may not be pre-installed with AutoOpts, you will
2857 need to do some configuration checking before you start the build.
2858 Assuming you are willing to fail the build if AutoOpts has not been
2859 installed, you will still need to do a little work.
2861 AutoOpts is distributed with a configuration check M4 script,
2862 'autoopts.m4'. It will add an 'autoconf' macro named,
2863 'AG_PATH_AUTOOPTS'. Add this to your 'configure.ac' script and use the
2864 following substitution values:
2867 the name of the autogen executable
2869 the directory where AutoGen template library is stored
2871 the compile time options needed to find the AutoOpts headers
2873 the link options required to access the 'libopts' library
2876 File: autogen.info, Node: source not installed, Prev: source pre-installed, Up: Using AutoOpts
2878 7.9.5 source distro, AutoOpts not installed
2879 -------------------------------------------
2881 If you will be distributing your project to a system that will build
2882 your product but it may not be pre-installed with AutoOpts, you may wish
2883 to incorporate the sources for 'libopts' in your project. To do this, I
2884 recommend reading the tear-off libopts library 'README' that you can
2885 find in the 'pkg/libopts' directory. You can also examine an example
2886 package (blocksort) that incorporates this tear off library in the
2887 autogen distribution directory. There is also a web page that describes
2888 what you need to do:
2889 <http://autogen.sourceforge.net/blocksort.html>
2891 Alternatively, you can pull the 'libopts' library sources into a
2892 build directory and build it for installation along with your package.
2893 This can be done approximately as follows:
2894 tar -xzvf `autoopts-config libsrc`
2900 That will install the library, but not the headers or anything else.
2903 File: autogen.info, Node: Presetting Options, Next: Config File Format, Prev: Using AutoOpts, Up: AutoOpts
2905 7.10 Configuring your program
2906 =============================
2908 AutoOpts supports the notion of 'presetting' the value or state of an
2909 option. The values may be obtained either from environment variables or
2910 from configuration files ('rc' or 'ini' files). In order to take
2911 advantage of this, the AutoOpts client program must specify these
2912 features in the option descriptor file (*note program attributes::) with
2913 the 'rcfile' or 'environrc' attributes.
2917 * loading rcfile:: configuration file presets
2918 * saving rcfile:: Saving the presets into a configuration file
2919 * sample rcfile:: Creating a sample configuration file
2920 * environrc:: environment variable presets
2921 * config example:: Config file only example
2923 It is also possible to configure your program without using the
2924 command line option parsing code. This is done by using only the
2925 following four functions from the 'libopts' library:
2928 (*note libopts-configFileLoad::) will parse the contents of a
2929 config file and return a pointer to a structure representing the
2930 hierarchical value. The values are sorted alphabetically by the
2931 value name and all entries with the same name will retain their
2932 original order. Insertion sort is used.
2935 (*note libopts-optionGetValue::) will find the first value within
2936 the hierarchy with a name that matches the name passed in.
2939 (*note libopts-optionNextValue::) will return the next value that
2940 follows the value passed in as an argument. If you wish to get all
2941 the values for a particular name, you must take note when the name
2944 'optionUnloadNested'
2945 (*note libopts-optionUnloadNested::). The pointer passed in must
2946 be of type, 'OPARG_TYPE_HIERARCHY' (see the autoopts/options.h
2947 header file). 'configFileLoad' will return a 'tOptionValue'
2948 pointer of that type. This function will release all the
2949 associated memory. 'AutoOpts' generated code uses this function
2950 for its own needs. Client code should only call this function with
2951 pointers gotten from 'configFileLoad'.
2954 File: autogen.info, Node: loading rcfile, Next: saving rcfile, Up: Presetting Options
2956 7.10.1 configuration file presets
2957 ---------------------------------
2959 Configuration files are enabled by specifying the program attribute
2960 'homerc' (*note program attributes::). Any option not marked with the
2961 'no-preset' attribute may appear in a configuration file. The files
2962 loaded are selected both by the 'homerc' entries and, optionally, via a
2963 command line option. The first component of the 'homerc' entry may be
2964 an environment variable such as '$HOME', or it may also be '$$' (*two*
2965 dollar sign characters) to specify the directory of the executable. For
2968 homerc = "$$/../share/autogen";
2970 will cause the AutoOpts library to look in the normal autogen datadir
2971 relative to the current installation directory for autogen.
2973 The configuration files are processed in the order they are specified
2974 by the 'homerc' attribute, so that each new file will normally override
2975 the settings of the previous files. This may be overridden by marking
2976 some options for 'immediate action' (*note Immediate Action::). Any
2977 such options are acted upon in *reverse* order. The disabled
2978 'load-opts' ('--no-load-opts') option, for example, is an immediate
2979 action option. Its presence in the last 'homerc' file will prevent the
2980 processing of any prior 'homerc' files because its effect is immediate.
2982 Configuration file processing can be completely suppressed by
2983 specifying '--no-load-opts' on the command line, or
2984 'PROGRAM_LOAD_OPTS=no' in the environment (if 'environrc' has been
2987 See the 'Configuration File Format' section (*note Config File
2988 Format::) for details on the format of the file.
2991 File: autogen.info, Node: saving rcfile, Next: sample rcfile, Prev: loading rcfile, Up: Presetting Options
2993 7.10.2 Saving the presets into a configuration file
2994 ---------------------------------------------------
2996 When configuration files are enabled for an application, the user is
2997 also provided with an automatically supplied '--save-opts' option. All
2998 of the known option state will be written to either the specified output
2999 file or, if it is not specified, then to the last specified 'homerc'
3003 File: autogen.info, Node: sample rcfile, Next: environrc, Prev: saving rcfile, Up: Presetting Options
3005 7.10.3 Creating a sample configuration file
3006 -------------------------------------------
3008 AutoOpts is shipped with a template named, 'rc-sample.tpl'. If your
3009 option definition file specifies the 'homerc' attribute, then you may
3010 invoke 'autogen' thus:
3012 autogen -Trc-sample <your-option-def-file>
3014 This will, by default, produce a sample file named,
3015 'sample-<prog-name>rc'. It will be named differently if you specify
3016 your configuration (rc) file name with the 'rcfile' attribute. In that
3017 case, the output file will be named, 'sample-<rcfile-name>'. It will
3018 contain all of the program options not marked as 'no-preset'. It will
3019 also include the text from the 'doc' attribute.
3021 Doing so with getdefs' option definitions yields this sample-getdefsrc
3022 file. I tend to be wordy in my 'doc' attributes:
3024 # getdefs sample configuration file
3025 ## This source file is copyrighted and licensed under the following terms:
3027 # Copyright (C) 1999-2018 Bruce Korb, all rights reserved.
3028 # This is free software. It is licensed for use, modification and
3029 # redistribution under the terms of the GNU General Public License,
3030 # version 3 or later <http://gnu.org/licenses/gpl.html>
3032 # getdefs is free software: you can redistribute it and/or modify it
3033 # under the terms of the GNU General Public License as published by the
3034 # Free Software Foundation, either version 3 of the License, or
3035 # (at your option) any later version.
3037 # getdefs is distributed in the hope that it will be useful, but
3038 # WITHOUT ANY WARRANTY; without even the implied warranty of
3039 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3040 # See the GNU General Public License for more details.
3042 # You should have received a copy of the GNU General Public License along
3043 # with this program. If not, see <http://www.gnu.org/licenses/>.
3045 # defs_to_get -- Regexp to look for after the "/*="
3050 # If you want definitions only from a particular category, or even
3051 # with names matching particular patterns, then specify this regular
3052 # expression for the text that must follow the @code{/*=}.
3057 # subblock -- subblock definition names
3062 # This option is used to create shorthand entries for nested definitions.
3063 # For example, with:
3065 # @item using subblock thus
3066 # @code{--subblock=arg=argname,type,null}
3067 # @item and defining an @code{arg} thus
3068 # @code{arg: this, char *}
3069 # @item will then expand to:
3070 # @code{arg = @{ argname = this; type = "char *"; @};}
3072 # The "this, char *" string is separated at the commas, with the
3073 # white space removed. You may use characters other than commas by
3074 # starting the value string with a punctuation character other than
3075 # a single or double quote character. You may also omit intermediate
3076 # values by placing the commas next to each other with no intervening
3077 # white space. For example, "+mumble++yes+" will expand to:
3079 # @code{arg = @{ argname = mumble; null = "yes"; @};}.
3084 # listattr -- attribute with list of values
3089 # This option is used to create shorthand entries for definitions
3090 # that generally appear several times. That is, they tend to be
3091 # a list of values. For example, with:
3093 # @code{listattr=foo} defined, the text:
3095 # @code{foo: this, is, a, multi-list} will then expand to:
3097 # @code{foo = 'this', 'is', 'a', 'multi-list';}
3099 # The texts are separated by the commas, with the
3100 # white space removed. You may use characters other than commas by
3101 # starting the value string with a punctuation character other than
3102 # a single or double quote character.
3107 # ordering -- Alphabetize or use named file
3112 # By default, ordering is alphabetical by the entry name. Use,
3113 # @code{no-ordering} if order is unimportant. Use @code{ordering}
3114 # with no argument to order without case sensitivity. Use
3115 # @code{ordering=<file-name>} if chronological order is important.
3116 # getdefs will maintain the text content of @code{file-name}.
3117 # @code{file-name} need not exist.
3122 # first_index -- The first index to apply to groups
3124 # This configuration value takes an integer number as its argument.
3127 # By default, the first occurrence of a named definition will have an
3128 # index of zero. Sometimes, that needs to be a reserved value. Provide
3129 # this option to specify a different starting point.
3134 # filelist -- Insert source file names into defs
3139 # Inserts the name of each input file into the output definitions.
3140 # If no argument is supplied, the format will be:
3144 # If an argument is supplied, that string will be used for the entry
3145 # name instead of @var{infile}.
3150 # assign -- Global assignments
3155 # The argument to each copy of this option will be inserted into
3156 # the output definitions, with only a semicolon attached.
3161 # common_assign -- Assignments common to all blocks
3166 # The argument to each copy of this option will be inserted into
3167 # each output definition, with only a semicolon attached.
3170 #common_assign ag-def
3172 # copy -- File(s) to copy into definitions
3177 # The content of each file named by these options will be inserted into
3178 # the output definitions.
3183 # srcfile -- Insert source file name into each def
3188 # Inserts the name of the input file where a definition was found
3189 # into the output definition.
3190 # If no argument is supplied, the format will be:
3194 # If an argument is supplied, that string will be used for the entry
3195 # name instead of @var{srcfile}.
3200 # linenum -- Insert source line number into each def
3205 # Inserts the line number in the input file where a definition
3206 # was found into the output definition.
3207 # If no argument is supplied, the format will be:
3211 # If an argument is supplied, that string will be used for the entry
3212 # name instead of @var{linenum}.
3217 # input -- Input file to search for defs
3222 # All files that are to be searched for definitions must be named on
3223 # the command line or read from @code{stdin}. If there is only one
3224 # @code{input} option and it is the string, "-", then the input file
3225 # list is read from @code{stdin}. If a command line argument is not
3226 # an option name and does not contain an assignment operator
3227 # (@code{=}), then it defaults to being an input file name.
3228 # At least one input file must be specified.
3233 # output -- Output file to open
3238 # If you are not sending the output to an AutoGen process,
3239 # you may name an output file instead.
3244 # autogen -- Invoke AutoGen with defs
3249 # This is the default output mode. Specifying @code{no-autogen} is
3250 # equivalent to @code{output=-}. If you supply an argument to this
3251 # option, that program will be started as if it were AutoGen and
3252 # its standard in will be set to the output definitions of this program.
3257 # template -- Template Name
3262 # Specifies the template name to be used for generating the final output.
3267 # agarg -- AutoGen Argument
3272 # This is a pass-through argument. It allows you to specify any
3273 # arbitrary argument to be passed to AutoGen.
3278 # base_name -- Base name for output file(s)
3283 # When output is going to AutoGen, a base name must either be supplied
3284 # or derived. If this option is not supplied, then it is taken from
3285 # the @code{template} option. If that is not provided either, then
3286 # it is set to the base name of the current directory.
3292 File: autogen.info, Node: environrc, Next: config example, Prev: sample rcfile, Up: Presetting Options
3294 7.10.4 environment variable presets
3295 -----------------------------------
3297 If the AutoOpts client program specifies 'environrc' in its option
3298 descriptor file, then environment variables will be used for presetting
3299 option state. Variables will be looked for that are named,
3300 'PROGRAM_OPTNAME' and 'PROGRAM'. 'PROGRAM' is the upper cased 'C-name'
3301 of the program, and OPTNAME is the upper cased 'C-name' of a specific
3302 option. (The 'C-name's are the regular names with all special
3303 characters converted to underscores ('_').)
3305 Option specific environment variables are processed after (and thus
3306 take precedence over) the contents of the 'PROGRAM' environment
3307 variable. The option argument string for these options takes on the
3308 string value gotten from the environment. Consequently, you can only
3309 have one instance of the OPTNAME.
3311 If a particular option may be disabled, then its disabled state is
3312 indicated by setting the 'PROGRAM_OPTNAME' value to the disablement
3313 prefix. So, for example, if the disablement prefix were 'dont', then
3314 you can disable the 'optname' option by setting the 'PROGRAM_OPTNAME''
3315 environment variable to 'dont'. *Note Common Attributes::.
3317 The 'PROGRAM' environment string is tokenized and parsed much like a
3318 command line. Doubly quoted strings have backslash escapes processed
3319 the same way they are processed in C program constant strings. Singly
3320 quoted strings are pretty raw in that backslashes are honored before
3321 other backslashes, apostrophes, newlines and cr/newline pairs. The
3322 options must be introduced with hyphens in the same way as the command
3325 Note that not all options may be preset. Options that are specified
3326 with the 'no-preset' attribute and the '--help', '--more-help', and
3327 '--save-opts' auto-supported options may not be preset.
3330 File: autogen.info, Node: config example, Prev: environrc, Up: Presetting Options
3332 7.10.5 Config file only example
3333 -------------------------------
3335 If for some reason it is difficult or unworkable to integrate
3336 configuration file processing with command line option parsing, the
3337 'libopts' (*note libopts procedures::) library can still be used to
3338 process configuration files. Below is a Hello, World! greeting program
3339 that tries to load a configuration file 'hello.conf' to see if it should
3340 use an alternate greeting or to personalize the salutation.
3342 #include <sys/types.h>
3346 #ifdef HAVE_UNISTD_H
3349 #include <autoopts/options.h>
3350 int main(int argc, char ** argv) {
3351 char const * greeting = "Hello";
3352 char const * greeted = "World";
3353 tOptionValue const * pOV = configFileLoad("hello.conf");
3356 const tOptionValue* pGetV = optionGetValue(pOV, "greeting");
3358 if ( (pGetV != NULL)
3359 && (pGetV->valType == OPARG_TYPE_STRING))
3360 greeting = strdup(pGetV->v.strVal);
3362 pGetV = optionGetValue(pOV, "personalize");
3363 if (pGetV != NULL) {
3364 struct passwd * pwe = getpwuid(getuid());
3366 greeted = strdup(pwe->pw_gecos);
3369 optionUnloadNested(pOV); /* deallocate config data */
3371 printf("%s, %s!\n", greeting, greeted);
3375 With that text in a file named "hello.c", this short script:
3377 cc -o hello hello.c `autoopts-config cflags ldflags`
3379 echo 'greeting Buzz off' > hello.conf
3381 echo personalize > hello.conf
3384 will produce the following output:
3388 Hello, Bruce Korb,,,!
3391 File: autogen.info, Node: Config File Format, Next: shell options, Prev: Presetting Options, Up: AutoOpts
3393 7.11 Configuration File Format
3394 ==============================
3396 The configuration file is designed to associate names and values, much
3397 like an AutoGen Definition File (*note Definitions File::).
3398 Unfortunately, the file formats are different. Specifically, AutoGen
3399 Definitions provide for simpler methods for the precise control of a
3400 value string and provides for dynamically computed content.
3401 Configuration files have some established traditions in their layout.
3402 So, they are different, even though they do both allow for a single name
3403 to be associated with multiple values and they both allow for
3404 hierarchical values.
3408 * config name/string-value:: assigning a string value to a configurable
3409 * config integer-values:: integer values
3410 * config nested-values:: hierarchical values
3411 * config directives:: configuration file directives
3412 * config comments:: comments in the configuration file
3415 File: autogen.info, Node: config name/string-value, Next: config integer-values, Up: Config File Format
3417 7.11.1 assigning a string value to a configurable
3418 -------------------------------------------------
3420 The basic syntax is a name followed by a value on a single line. They
3421 are separated from each other by either white space, a colon (':') or an
3422 equal sign ('='). The colon or equal sign may optionally be surrounded
3423 by additional white space. If more than one value line is needed, a
3424 backslash ('\') may be used to continue the value. The backslash (but
3425 not the newline) will be erased. Leading and trailing white space is
3426 always stripped from the value.
3428 Fundamentally, it looks like this:
3430 name value for that name
3434 name: a *third* value for name
3436 If you need more control over the content of the value, you may
3437 enclose the value in XML style brackets:
3439 Within these brackets you need not (must not) continue the value data
3440 with backslashes. You may also select the string formation rules to
3441 use, just add the attribute after the name, thus: '<name keep>'.
3444 This mode will keep all text between the brackets and not strip any
3447 This mode strips leading and trailing white space, but not do any
3448 quote processing. This is the default and need not be specified.
3450 The text is trimmed of leading and trailing white space and XML
3451 encodings are processed. These encodings are slightly expanded
3452 over the XML specification. They are specified with an ampersand
3453 followed by a value name or numeric value and then a semicolon:
3463 These are all per fairly standad HTML and/or XML encodings.
3467 The ASCII back space character.
3469 The ASCII form feed character.
3471 The ASCII horizontal (normal) tab character.
3473 The ASCII carriage return character.
3475 The ASCII vertical tab character.
3477 The ASCII alarm bell character.
3479 The ASCII new line character.
3481 The ASCII space character. Normally not necessary, but if you
3482 want to preserve leading or trailing space characters, then
3485 And here is an example of an XML-styled value:
3488 This is&nl;&ht;another multi-line
3492 The string value associated with 'name' will be exactly the text
3493 enclosed in quotes with the encoded characters 'cooked' as you would
3494 expect (three text lines with the last line not ending with a newline,
3495 but ending with a period).
3498 File: autogen.info, Node: config integer-values, Next: config nested-values, Prev: config name/string-value, Up: Config File Format
3500 7.11.2 integer values
3501 ---------------------
3503 A name can be specified as having an integer value. To do this, you
3504 must use the XML-ish format and specify a 'type' attribute for the name:
3506 <name type=integer> 1234 </name>
3508 Boolean, enumeration and set membership types will be added as time
3509 allows. 'type=string' is also supported, but also is the default.
3512 File: autogen.info, Node: config nested-values, Next: config directives, Prev: config integer-values, Up: Config File Format
3514 7.11.3 hierarchical values
3515 --------------------------
3517 In order to specify a hierarchical value, you *must* use XML-styled
3518 formatting, specifying a type that is shorter and easier to spell:
3520 <structured-name type=nested>
3524 The ellipsis may be filled with any legal configuration file name/value
3528 File: autogen.info, Node: config directives, Next: config comments, Prev: config nested-values, Up: Config File Format
3530 7.11.4 configuration file directives
3531 ------------------------------------
3533 The '<?' marker indicates an XML directive. There is only one directive
3534 supported: program sectioning, though two syntaxes are supported.
3536 If, for example, you have a collection of programs that work closely
3537 together and, likely, have a common set of options, these programs may
3538 use a single, sectioned, configuration file. The file may be sectioned
3539 in either of two ways. The two ways may not be intermixed in a single
3540 configuration file. All text before the first segmentation line is
3541 processed, then only the segment that applies:
3543 '<?auto-options ...>'
3544 The '...' ellipsis may contain AutoOpts option processing options.
3545 Currently, that consists of one or both of:
3549 to indicate GNU-standard or AutoOpts-standard layout of usage
3550 and version information, and/or
3554 to indicate whether the available options should be listed
3555 when an invalid option appears on the command line.
3556 Anything else will be silently ignored.
3558 '<?program prog-name>'
3559 The '<?' marker indicates an XML directive. The file is
3560 partitioned by these lines and the options are processed for the
3561 'prog-name' program only before the first '<?program' directive and
3562 the program section with a matching program name.
3565 This is basically an alias for '<?program prog-name>', except that
3566 the program name must be upper cased and segmented only with
3567 underscores and it is *not* recognized as a program segment when
3568 updating configuration files with the '--save-opts' option. In
3569 other words, use this only for Windows compatibility.
3571 Segmentation does not apply if the config file is being parsed with the
3572 'configFileLoad(3AutoOpts)' function.
3575 File: autogen.info, Node: config comments, Prev: config directives, Up: Config File Format
3577 7.11.5 comments in the configuration file
3578 -----------------------------------------
3580 Comments are lines beginning with a hash mark ('#'), XML-style comments
3581 ('<!-- arbitrary text -->'), and unrecognized XML directives.
3590 File: autogen.info, Node: shell options, Next: AutoInfo, Prev: Config File Format, Up: AutoOpts
3592 7.12 AutoOpts for Shell Scripts
3593 ===============================
3595 AutoOpts may be used with shell scripts either by automatically creating
3596 a complete program that will process command line options and pass back
3597 the results to the invoking shell by issuing shell variable assignment
3598 commands, or it may be used to generate portable shell code that can be
3599 inserted into your script.
3601 The functionality of these features, of course, is somewhat
3602 constrained compared with the normal program facilities. Specifically,
3603 you cannot invoke callout procedures with either of these methods.
3604 Additionally, if you generate a shell script to do the parsing:
3606 1. You cannot obtain options from configuration files.
3607 2. You cannot obtain options from environment variables.
3608 3. You cannot save the option state to an option file.
3609 4. Option conflict/requirement verification is disabled.
3611 Both of these methods are enabled by running AutoGen on the
3612 definitions file with the additional main procedure attribute:
3614 main = { main-type = shell-process; };
3616 main = { main-type = shell-parser; };
3618 If you do not supply a 'proc-to-call', it will default to
3619 'optionPutShell'. That will produce a program that will process the
3620 options and generate shell text for the invoking shell to interpret
3621 (*note binary-parser::). If you supply the name, 'optionParseShell',
3622 then you will have a program that will generate a shell script that can
3623 parse the options (*note script-parser::). If you supply a different
3624 procedure name, you will have to provide that routine and it may do
3629 * binary-parser:: Parsing with an Executable
3630 * script-parser:: Parsing with a Portable Script
3633 File: autogen.info, Node: binary-parser, Next: script-parser, Up: shell options
3635 7.12.1 Parsing with an Executable
3636 ---------------------------------
3638 The following commands are approximately all that is needed to build a
3639 shell script command line option parser from an option definition file:
3641 autogen -L <opt-template-dir> test-errors.def
3642 cc -o test-errors -L <opt-lib-dir> -I <opt-include-dir> \
3643 -DTEST_PROGRAM_OPTS test-errors.c -lopts
3645 The resulting program can then be used within your shell script as
3648 eval `./test-errors "$@"`
3649 if [ -z "${OPTION_CT}" ] ; then exit 1 ; fi
3650 test ${OPTION_CT} -gt 0 && shift ${OPTION_CT}
3652 Here is the usage output example from AutoOpts error handling tests.
3653 The option definition has argument reordering enabled:
3655 test_errors - Test AutoOpts for errors
3656 Usage: errors [ -<flag> [<val>] | --<name>[{=| }<val>] ]... arg ...
3657 Flg Arg Option-Name Description
3658 -o no option The option option descrip
3659 -s Str second The second option descrip
3660 - may appear up to 10 times
3661 -i --- ignored we have dumped this
3662 -X no another Another option descrip
3663 - may appear up to 5 times
3664 -? no help display extended usage information and exit
3665 -! no more-help extended usage information passed thru pager
3666 -> opt save-opts save the option state to a config file
3667 -< Str load-opts load options from a config file
3668 - disabled as '--no-load-opts'
3669 - may appear multiple times
3671 Options are specified by doubled hyphens and their name or by a single
3672 hyphen and the flag character.
3673 Operands and options may be intermixed. They will be reordered.
3675 The following option preset mechanisms are supported:
3676 - reading file errorsRC
3678 Using the invocation,
3679 test-errors operand1 -s first operand2 -X -- -s operand3
3680 you get the following output for your shell script to evaluate:
3684 TEST_ERRORS_SECOND='first'
3685 export TEST_ERRORS_SECOND
3686 TEST_ERRORS_ANOTHER=1 # 0x1
3687 export TEST_ERRORS_ANOTHER
3688 set -- 'operand1' 'operand2' '-s' 'operand3'
3692 File: autogen.info, Node: script-parser, Prev: binary-parser, Up: shell options
3694 7.12.2 Parsing with a Portable Script
3695 -------------------------------------
3697 If you had used 'test-main = optionParseShell' instead, then you can, at
3698 this point, merely run the program and it will write the parsing script
3699 to standard out. You may also provide this program with command line
3700 options to specify the shell script file to create or edit, and you may
3701 specify the shell program to use on the first shell script line. That
3702 program's usage text would look something like the following and the
3703 script parser itself would be very verbose:
3705 genshellopt - Generate Shell Option Processing Script - Ver. 1
3706 Usage: genshellopt [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
3707 Flg Arg Option-Name Description
3708 -o Str script Output Script File
3709 -s Str shell Shell name (follows "#!" magic)
3710 - disabled as '--no-shell'
3711 - enabled by default
3712 -v opt version output version information and exit
3713 -? no help display extended usage information and exit
3714 -! no more-help extended usage information passed thru pager
3716 Options are specified by doubled hyphens and their name or by a single
3717 hyphen and the flag character.
3718 Note that 'shell' is only useful if the output file does not already exist.
3719 If it does, then the shell name and optional first argument will be
3720 extracted from the script file.
3721 If the script file already exists and contains Automated Option Processing
3722 text, the second line of the file through the ending tag will be replaced
3723 by the newly generated text. The first '#!' line will be regenerated.
3725 Please send bug reports to: <autogen-users@lists.sourceforge.net>
3729 This incarnation of genshell will produce
3730 a shell script to parse the options for getdefs:
3732 getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
3733 Usage: getdefs [ <option-name>[{=| }<val>] ]...
3734 Arg Option-Name Description
3735 Str defs-to-get Regexp to look for after the "/*="
3736 Str subblock subblock definition names
3737 Str listattr attribute with list of values
3738 opt ordering Alphabetize or use named file
3739 Num first-index The first index to apply to groups
3740 opt filelist Insert source file names into defs
3741 Str assign Global assignments
3742 Str common-assign Assignments common to all blocks
3743 Str copy File(s) to copy into definitions
3744 opt srcfile Insert source file name into each def
3745 opt linenum Insert source line number into each def
3746 Str input Input file to search for defs
3747 Str output Output file to open
3748 opt autogen Invoke AutoGen with defs
3749 Str template Template Name
3750 Str agarg AutoGen Argument
3751 Str base-name Base name for output file(s)
3753 Resulting in the following script:
3755 # # # # # # # # # # -- do not modify this marker --
3757 # DO NOT EDIT THIS SECTION
3758 OF /u/bkorb/tools/ag/autogen-bld/doc/ag-texi-32340.d/.ag-5GQlKL/genshellopt.sh
3760 # From here to the next `-- do not modify this marker --',
3761 # the text has been generated Sunday August 26, 2018 at 10:46:02 AM PDT
3762 # From the GETDEFS option definitions
3764 GETDEFS_LONGUSAGE_TEXT='getdefs error: invalid option descriptor for version
3765 getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
3766 Usage: getdefs [ <option-name>[{=| }<val>] ]...
3768 Specify which definitions are of interest and what to say about them:
3770 Arg Option-Name Description
3771 Str defs-to-get Regexp to look for after the "/*="
3772 Str subblock subblock definition names
3773 - may appear multiple times
3774 Str listattr attribute with list of values
3775 - may appear multiple times
3777 specify how to number the definitions:
3779 Arg Option-Name Description
3780 opt ordering Alphabetize or use named file
3781 - disabled as '\''--no-ordering'\''
3782 - enabled by default
3783 Num first-index The first index to apply to groups
3785 Definition insertion options:
3787 Arg Option-Name Description
3788 opt filelist Insert source file names into defs
3789 Str assign Global assignments
3790 - may appear multiple times
3791 Str common-assign Assignments common to all blocks
3792 - may appear multiple times
3793 Str copy File(s) to copy into definitions
3794 - may appear multiple times
3795 opt srcfile Insert source file name into each def
3796 opt linenum Insert source line number into each def
3798 specify which files to search for markers:
3800 Arg Option-Name Description
3801 Str input Input file to search for defs
3802 - may appear multiple times
3803 - default option for unnamed options
3805 Definition output disposition options::
3807 Arg Option-Name Description
3808 Str output Output file to open
3809 - an alternate for '\''autogen'\''
3810 opt autogen Invoke AutoGen with defs
3811 - disabled as '\''--no-autogen'\''
3812 - enabled by default
3813 Str template Template Name
3814 Str agarg AutoGen Argument
3815 - prohibits the option '\''output'\''
3816 - may appear multiple times
3817 Str base-name Base name for output file(s)
3818 - prohibits the option '\''output'\''
3820 Version, usage and configuration options:
3822 Arg Option-Name Description
3825 GETDEFS_USAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
3826 Usage: getdefs [ <option-name>[{=| }<val>] ]...
3827 Arg Option-Name Description
3828 Str defs-to-get Regexp to look for after the "/*="
3829 Str subblock subblock definition names
3830 Str listattr attribute with list of values
3831 opt ordering Alphabetize or use named file
3832 Num first-index The first index to apply to groups
3833 opt filelist Insert source file names into defs
3834 Str assign Global assignments
3835 Str common-assign Assignments common to all blocks
3836 Str copy File(s) to copy into definitions
3837 opt srcfile Insert source file name into each def
3838 opt linenum Insert source line number into each def
3839 Str input Input file to search for defs
3840 Str output Output file to open
3841 opt autogen Invoke AutoGen with defs
3842 Str template Template Name
3843 Str agarg AutoGen Argument
3844 Str base-name Base name for output file(s)
3845 getdefs error: invalid option descriptor for version'
3848 GETDEFS_DEFS_TO_GET=${GETDEFS_DEFS_TO_GET}
3849 GETDEFS_DEFS_TO_GET_set=false
3850 export GETDEFS_DEFS_TO_GET
3852 if test -z "${GETDEFS_SUBBLOCK}"
3854 GETDEFS_SUBBLOCK_CT=0
3855 export GETDEFS_SUBBLOCK_CT
3857 GETDEFS_SUBBLOCK_CT=1
3858 GETDEFS_SUBBLOCK_1=${GETDEFS_SUBBLOCK}
3859 export GETDEFS_SUBBLOCK_CT GETDEFS_SUBBLOCK_1
3862 if test -z "${GETDEFS_LISTATTR}"
3864 GETDEFS_LISTATTR_CT=0
3865 export GETDEFS_LISTATTR_CT
3867 GETDEFS_LISTATTR_CT=1
3868 GETDEFS_LISTATTR_1=${GETDEFS_LISTATTR}
3869 export GETDEFS_LISTATTR_CT GETDEFS_LISTATTR_1
3872 GETDEFS_ORDERING=${GETDEFS_ORDERING}
3873 GETDEFS_ORDERING_set=false
3874 export GETDEFS_ORDERING
3876 GETDEFS_FIRST_INDEX=${GETDEFS_FIRST_INDEX-'0'}
3877 GETDEFS_FIRST_INDEX_set=false
3878 export GETDEFS_FIRST_INDEX
3880 GETDEFS_FILELIST=${GETDEFS_FILELIST}
3881 GETDEFS_FILELIST_set=false
3882 export GETDEFS_FILELIST
3884 if test -z "${GETDEFS_ASSIGN}"
3887 export GETDEFS_ASSIGN_CT
3890 GETDEFS_ASSIGN_1=${GETDEFS_ASSIGN}
3891 export GETDEFS_ASSIGN_CT GETDEFS_ASSIGN_1
3894 if test -z "${GETDEFS_COMMON_ASSIGN}"
3896 GETDEFS_COMMON_ASSIGN_CT=0
3897 export GETDEFS_COMMON_ASSIGN_CT
3899 GETDEFS_COMMON_ASSIGN_CT=1
3900 GETDEFS_COMMON_ASSIGN_1=${GETDEFS_COMMON_ASSIGN}
3901 export GETDEFS_COMMON_ASSIGN_CT GETDEFS_COMMON_ASSIGN_1
3904 if test -z "${GETDEFS_COPY}"
3907 export GETDEFS_COPY_CT
3910 GETDEFS_COPY_1=${GETDEFS_COPY}
3911 export GETDEFS_COPY_CT GETDEFS_COPY_1
3914 GETDEFS_SRCFILE=${GETDEFS_SRCFILE}
3915 GETDEFS_SRCFILE_set=false
3916 export GETDEFS_SRCFILE
3918 GETDEFS_LINENUM=${GETDEFS_LINENUM}
3919 GETDEFS_LINENUM_set=false
3920 export GETDEFS_LINENUM
3922 if test -z "${GETDEFS_INPUT}"
3925 export GETDEFS_INPUT_CT
3928 GETDEFS_INPUT_1=${GETDEFS_INPUT}
3929 export GETDEFS_INPUT_CT GETDEFS_INPUT_1
3932 GETDEFS_OUTPUT=${GETDEFS_OUTPUT}
3933 GETDEFS_OUTPUT_set=false
3934 export GETDEFS_OUTPUT
3936 GETDEFS_AUTOGEN=${GETDEFS_AUTOGEN}
3937 GETDEFS_AUTOGEN_set=false
3938 export GETDEFS_AUTOGEN
3940 GETDEFS_TEMPLATE=${GETDEFS_TEMPLATE}
3941 GETDEFS_TEMPLATE_set=false
3942 export GETDEFS_TEMPLATE
3944 if test -z "${GETDEFS_AGARG}"
3947 export GETDEFS_AGARG_CT
3950 GETDEFS_AGARG_1=${GETDEFS_AGARG}
3951 export GETDEFS_AGARG_CT GETDEFS_AGARG_1
3954 GETDEFS_BASE_NAME=${GETDEFS_BASE_NAME}
3955 GETDEFS_BASE_NAME_set=false
3956 export GETDEFS_BASE_NAME
3965 OPT_CODE=`echo "X${OPT_ARG}"|sed 's/^X-*//'`
3968 case "${OPT_CODE}" in *=* )
3969 OPT_ARG_VAL=`echo "${OPT_CODE}"|sed 's/^[^=]*=//'`
3970 OPT_CODE=`echo "${OPT_CODE}"|sed 's/=.*$//'` ;; esac
3971 case "${OPT_CODE}" in
3982 if [ -n "${GETDEFS_DEFS_TO_GET}" ] && ${GETDEFS_DEFS_TO_GET_set} ; then
3983 echo 'Error: duplicate DEFS_TO_GET option'
3984 echo "$GETDEFS_USAGE_TEXT"
3987 GETDEFS_DEFS_TO_GET_set=true
3988 OPT_NAME='DEFS_TO_GET'
3999 GETDEFS_SUBBLOCK_CT=`expr ${GETDEFS_SUBBLOCK_CT} + 1`
4000 OPT_ELEMENT="_${GETDEFS_SUBBLOCK_CT}"
4012 GETDEFS_LISTATTR_CT=`expr ${GETDEFS_LISTATTR_CT} + 1`
4013 OPT_ELEMENT="_${GETDEFS_LISTATTR_CT}"
4025 if [ -n "${GETDEFS_ORDERING}" ] && ${GETDEFS_ORDERING_set} ; then
4026 echo 'Error: duplicate ORDERING option'
4027 echo "$GETDEFS_USAGE_TEXT"
4030 GETDEFS_ORDERING_set=true
4032 eval GETDEFS_ORDERING${OPT_ELEMENT}=true
4033 export GETDEFS_ORDERING${OPT_ELEMENT}
4046 if [ -n "${GETDEFS_ORDERING}" ] && ${GETDEFS_ORDERING_set} ; then
4047 echo 'Error: duplicate ORDERING option'
4048 echo "$GETDEFS_USAGE_TEXT"
4051 GETDEFS_ORDERING_set=true
4052 GETDEFS_ORDERING='no'
4053 export GETDEFS_ORDERING
4068 if [ -n "${GETDEFS_FIRST_INDEX}" ] && ${GETDEFS_FIRST_INDEX_set} ; then
4069 echo 'Error: duplicate FIRST_INDEX option'
4070 echo "$GETDEFS_USAGE_TEXT"
4073 GETDEFS_FIRST_INDEX_set=true
4074 OPT_NAME='FIRST_INDEX'
4085 if [ -n "${GETDEFS_FILELIST}" ] && ${GETDEFS_FILELIST_set} ; then
4086 echo 'Error: duplicate FILELIST option'
4087 echo "$GETDEFS_USAGE_TEXT"
4090 GETDEFS_FILELIST_set=true
4092 eval GETDEFS_FILELIST${OPT_ELEMENT}=true
4093 export GETDEFS_FILELIST${OPT_ELEMENT}
4102 GETDEFS_ASSIGN_CT=`expr ${GETDEFS_ASSIGN_CT} + 1`
4103 OPT_ELEMENT="_${GETDEFS_ASSIGN_CT}"
4120 GETDEFS_COMMON_ASSIGN_CT=`expr ${GETDEFS_COMMON_ASSIGN_CT} + 1`
4121 OPT_ELEMENT="_${GETDEFS_COMMON_ASSIGN_CT}"
4122 OPT_NAME='COMMON_ASSIGN'
4129 GETDEFS_COPY_CT=`expr ${GETDEFS_COPY_CT} + 1`
4130 OPT_ELEMENT="_${GETDEFS_COPY_CT}"
4141 if [ -n "${GETDEFS_SRCFILE}" ] && ${GETDEFS_SRCFILE_set} ; then
4142 echo 'Error: duplicate SRCFILE option'
4143 echo "$GETDEFS_USAGE_TEXT"
4146 GETDEFS_SRCFILE_set=true
4148 eval GETDEFS_SRCFILE${OPT_ELEMENT}=true
4149 export GETDEFS_SRCFILE${OPT_ELEMENT}
4159 if [ -n "${GETDEFS_LINENUM}" ] && ${GETDEFS_LINENUM_set} ; then
4160 echo 'Error: duplicate LINENUM option'
4161 echo "$GETDEFS_USAGE_TEXT"
4164 GETDEFS_LINENUM_set=true
4166 eval GETDEFS_LINENUM${OPT_ELEMENT}=true
4167 export GETDEFS_LINENUM${OPT_ELEMENT}
4175 GETDEFS_INPUT_CT=`expr ${GETDEFS_INPUT_CT} + 1`
4176 OPT_ELEMENT="_${GETDEFS_INPUT_CT}"
4186 if [ -n "${GETDEFS_OUTPUT}" ] && ${GETDEFS_OUTPUT_set} ; then
4187 echo 'Error: duplicate OUTPUT option'
4188 echo "$GETDEFS_USAGE_TEXT"
4191 GETDEFS_OUTPUT_set=true
4202 if [ -n "${GETDEFS_AUTOGEN}" ] && ${GETDEFS_AUTOGEN_set} ; then
4203 echo 'Error: duplicate AUTOGEN option'
4204 echo "$GETDEFS_USAGE_TEXT"
4207 GETDEFS_AUTOGEN_set=true
4209 eval GETDEFS_AUTOGEN${OPT_ELEMENT}=true
4210 export GETDEFS_AUTOGEN${OPT_ELEMENT}
4222 if [ -n "${GETDEFS_AUTOGEN}" ] && ${GETDEFS_AUTOGEN_set} ; then
4223 echo 'Error: duplicate AUTOGEN option'
4224 echo "$GETDEFS_USAGE_TEXT"
4227 GETDEFS_AUTOGEN_set=true
4228 GETDEFS_AUTOGEN='no'
4229 export GETDEFS_AUTOGEN
4241 if [ -n "${GETDEFS_TEMPLATE}" ] && ${GETDEFS_TEMPLATE_set} ; then
4242 echo 'Error: duplicate TEMPLATE option'
4243 echo "$GETDEFS_USAGE_TEXT"
4246 GETDEFS_TEMPLATE_set=true
4255 GETDEFS_AGARG_CT=`expr ${GETDEFS_AGARG_CT} + 1`
4256 OPT_ELEMENT="_${GETDEFS_AGARG_CT}"
4269 if [ -n "${GETDEFS_BASE_NAME}" ] && ${GETDEFS_BASE_NAME_set} ; then
4270 echo 'Error: duplicate BASE_NAME option'
4271 echo "$GETDEFS_USAGE_TEXT"
4274 GETDEFS_BASE_NAME_set=true
4275 OPT_NAME='BASE_NAME'
4285 echo "$GETDEFS_LONGUSAGE_TEXT"
4292 echo "$GETDEFS_LONGUSAGE_TEXT"
4304 echo "$GETDEFS_LONGUSAGE_TEXT" | ${PAGER-more}
4316 echo 'Warning: Cannot save options files' >&2
4328 echo 'Warning: Cannot load options files' >&2
4342 echo 'Warning: Cannot suppress the loading of options files' >&2
4347 echo Unknown option: "${OPT_CODE}" >&2
4348 echo "$GETDEFS_USAGE_TEXT" >&2
4352 case "${OPT_ARG_NEEDED}" in
4357 if [ -z "${OPT_ARG_VAL}" ]
4361 echo No argument provided for ${OPT_NAME} option
4362 echo "$GETDEFS_USAGE_TEXT"
4365 OPT_ARG_VAL=${OPT_ARG}
4371 if [ -z "${OPT_ARG_VAL}" ] && [ $# -gt 0 ]
4373 case "${OPT_ARG}" in -* ) ;; * )
4374 OPT_ARG_VAL=${OPT_ARG}
4380 if [ -n "${OPT_ARG_VAL}" ]
4382 eval GETDEFS_${OPT_NAME}${OPT_ELEMENT}="'${OPT_ARG_VAL}'"
4383 export GETDEFS_${OPT_NAME}${OPT_ELEMENT}
4386 OPTION_COUNT=`expr $ARG_COUNT - $#`
4388 unset OPT_PROCESS || :
4389 unset OPT_ELEMENT || :
4391 unset OPT_ARG_NEEDED || :
4394 unset OPT_ARG_VAL || :
4398 # END OF AUTOMATED OPTION PROCESSING
4400 # # # # # # # # # # -- do not modify this marker --
4402 env | grep '^GETDEFS_'
4405 File: autogen.info, Node: AutoInfo, Next: AutoMan pages, Prev: shell options, Up: AutoOpts
4407 7.13 Automated Info Docs
4408 ========================
4410 AutoOpts provides two templates for producing '.texi' documentation.
4411 'agtexi-cmd.tpl' for the invoking section, and 'aginfo3.tpl' for
4412 describing exported library functions and macros.
4414 For both types of documents, the documentation level is selected by
4415 passing a '-DLEVEL=<level-name>' argument to AutoGen when you build the
4416 document. (See the example invocation below.)
4418 Two files will be produced, a '.texi' file and a '.menu' file. You
4419 should include the text in the '.menu' file in a '@menu' list, either
4420 with '@include'-ing it or just copying text. The '.texi' file should be
4421 '@include'-ed where the invoking section belongs in your document.
4423 The '.texi' file will contain an introductory paragraph, a menu and a
4424 subordinate section for the invocation usage and for each documented
4425 option. The introductory paragraph is normally the boiler plate text,
4428 This chapter documents the @file{AutoOpts} generated usage text
4429 and option meanings for the @file{your-program} program.
4433 These are the publicly exported procedures from the libname library.
4434 Any other functions mentioned in the header file are for the private use
4439 * command-info:: 'invoking' info docs
4440 * library-info:: library info docs
4443 File: autogen.info, Node: command-info, Next: library-info, Up: AutoInfo
4445 7.13.1 'invoking' info docs
4446 ---------------------------
4448 Using the option definitions for an AutoOpt client program, the
4449 'agtexi-cmd.tpl' template will produce texinfo text that documents the
4450 invocation of your program. The text emitted is designed to be included
4451 in the full texinfo document for your product. It is not a stand-alone
4452 document. The usage text for the *note autogen usage::, *note getdefs
4453 usage:: and *note columns usage:: programs, are included in this
4454 document and are all generated using this template.
4456 If your program's option definitions include a 'prog-info-descrip'
4457 section, then that text will replace the boilerplate introductory
4460 These files are produced by invoking the following command:
4462 autogen -L ${prefix}/share/autogen -Tagtexi-cmd.tpl \
4463 -DLEVEL=section your-opts.def
4465 Where '${prefix}' is the AutoGen installation prefix and 'your-opts.def'
4466 is the name of your product's option definition file.
4469 File: autogen.info, Node: library-info, Prev: command-info, Up: AutoInfo
4471 7.13.2 library info docs
4472 ------------------------
4474 The 'texinfo' doc for libraries is derived from mostly the same
4475 information as is used for producing man pages *Note man3::. The main
4476 difference is that there is only one output file and the individual
4477 functions are referenced from a 'texi' menu. There is also a small
4478 difference in the global attributes used:
4480 lib_description A description of the library. This text
4481 appears before the menu. If not provided,
4482 the standard boilerplate version will be
4484 see_also The 'SEE ALSO' functionality is not supported
4485 for the 'texinfo' documentation, so any
4486 'see_also' attribute will be ignored.
4488 These files are produced by invoking the following commands:
4490 getdefs linenum srcfile template=aginfo3.tpl output=libexport.def \
4493 autogen -L ${prefix}/share/autogen -DLEVEL=section libexport.def
4495 Where '${prefix}' is the AutoGen installation prefix and 'libexport.def'
4496 is some name that suits you.
4498 An example of this can be seen in this document, *Note libopts
4502 File: autogen.info, Node: AutoMan pages, Next: getopt_long, Prev: AutoInfo, Up: AutoOpts
4504 7.14 Automated Man Pages
4505 ========================
4507 AutoOpts provides two templates for producing man pages. The command
4508 ('man1') pages are derived from the options definition file, and the
4509 library ('man3') pages are derived from stylized comments (*note getdefs
4512 Man pages include a date in the footer. By default, this is derived
4513 from the current date. However, this may be overridden with the
4514 'MAN_PAGE_DATE' environment variable. If set and not empty, its
4515 contents will be copied into where the output of 'date '+%d %b %Y''
4518 Man pages may be formatted as either traditional man pages or using
4519 'mdoc' formatting. The format is selected by selecting the appropriate
4524 * man1:: command line man pages
4525 * man3:: library man pages
4528 File: autogen.info, Node: man1, Next: man3, Up: AutoMan pages
4530 7.14.1 command line man pages
4531 -----------------------------
4533 Man pages for commands are documented using the 'agman-cmd.tpl' and
4534 'agmdoc-cmd.tpl' templates. If the options specify pulling information
4535 from 'RC'/'ini'/'cfg' files, then you may use the 'rc-sample.tpl'
4536 template to produce an example config file for your program.
4538 Using the option definitions for an AutoOpts client program, the
4539 'agman-cmd.tpl' template will produce an nroff document suitable for use
4540 as a 'man(1)' page document for a command line command. The description
4541 section of the document is either the 'prog-man-descrip' text, if
4542 present, or the 'detail' text.
4544 Each option in the option definitions file is fully documented in its
4545 usage. This includes all the information documented above for each
4546 option (*note option attributes::), plus the 'doc' attribute is
4547 appended. Since the 'doc' text is presumed to be designed for 'texinfo'
4548 documentation, 'sed' is used to convert some constructs from 'texi' to
4549 'nroff'-for-'man'-pages. Specifically,
4551 convert @code, @var and @samp into \fB...\fP phrases
4552 convert @file into \fI...\fP phrases
4553 Remove the '@' prefix from curly braces
4554 Indent example regions
4555 Delete the example commands
4556 Replace 'end example' command with ".br"
4557 Replace the '@*' command with ".br"
4559 This document is produced by invoking the following command:
4561 autogen -L ${prefix}/share/autogen -Tagman-cmd.tpl options.def
4563 Where '${prefix}' is the AutoGen installation prefix and 'options.def'
4564 is the name of your product's option definition file. I do not use this
4565 very much, so any feedback or improvements would be greatly appreciated.
4568 File: autogen.info, Node: man3, Prev: man1, Up: AutoMan pages
4570 7.14.2 library man pages
4571 ------------------------
4573 Man pages for libraries are documented using the 'agman3.tpl' template.
4575 Two global definitions are required, and then one library man page is
4576 produced for each 'export_func' definition that is found. It is
4577 generally convenient to place these definitions as 'getdefs' comments
4578 (*note getdefs Invocation::) near the procedure definition, but they may
4579 also be a separate AutoGen definitions file (*note Definitions File::).
4580 Each function will be cross referenced with their sister functions in a
4581 'SEE ALSO' section. A global 'see_also' definition will be appended to
4582 this cross referencing text.
4584 The two global definitions required are:
4586 library This is the name of your library, without the 'lib'
4587 prefix. The AutoOpts library is named
4588 'libopts.so...', so the 'library' attribute would
4589 have the value 'opts'.
4590 header Generally, using a library with a compiled program
4591 entails '#include'-ing a header file. Name that
4592 header with this attribute. In the case of AutoOpts,
4593 it is generated and will vary based on the name of
4594 the option definition file. Consequently,
4595 'your-opts.h' is specified.
4597 The 'export_func' definition should contain the following attributes:
4599 name The name of the procedure the library user may call.
4600 what A brief sentence describing what the procedure does.
4601 doc A detailed description of what the procedure does.
4602 It may ramble on for as long as necessary to properly
4604 err A short description of how errors are handled.
4605 ret_type The data type returned by the procedure. Omit this
4606 for 'void' procedures.
4607 ret_desc Describe what the returned value is, if needed.
4608 private If specified, the function will *not* be documented.
4609 This is used, for example, to produce external
4610 declarations for functions that are not available for
4611 public use, but are used in the generated text.
4612 arg This is a compound attribute that contains:
4613 arg_type The data type of the argument.
4614 arg_name A short name for it.
4615 arg_desc A brief description.
4617 As a 'getdefs' comment, this would appear something like this:
4619 /*=--subblock=arg=arg_type,arg_name,arg_desc =*/
4622 * header: your-opts.h
4624 /*=export_func optionProcess
4626 * what: this is the main option processing routine
4627 * arg: + tOptions* + pOpts + program options descriptor +
4628 * arg: + int + argc + program arg count +
4629 * arg: + char** + argv + program arg vector +
4631 * ret_desc: the count of the arguments processed
4633 * doc: This is what it does.
4634 * err: When it can't, it does this.
4637 Note the 'subblock' and 'library' comments. 'subblock' is an embedded
4638 'getdefs' option (*note getdefs subblock::) that tells it how to parse
4639 the 'arg' attribute. The 'library' and 'header' entries are global
4640 definitions that apply to all the documented functions.
4643 File: autogen.info, Node: getopt_long, Next: i18n, Prev: AutoMan pages, Up: AutoOpts
4645 7.15 Using getopt(3C)
4646 =====================
4648 There is a template named, 'getopt.tpl' that is distributed with
4649 AutoOpts. Using that template instead of 'options.tpl' will produce
4650 completely independent source code that will parse command line options.
4651 It will utilize either the standard 'getopt(3C)' or the GNU
4652 'getopt_long(3GNU)' function to drive the parsing. Which is used is
4653 selected by the presence or absence of the 'long-opts' program
4654 attribute. It will save you from being dependent upon the 'libopts'
4655 library and it produces code ready for internationalization. However,
4656 it also carries with it some limitations on the use of AutoOpts features
4657 and some requirements on the build environment.
4659 *PLEASE NOTE*: in processing the option definitions to produce the
4660 usage text, it is necessary to compile some generated code in a
4661 temporary directory. That means that all the include directories needed
4662 to compile the code must be full path names and not relative directory
4663 names. "." is a relative directory name. To specify "-I." in the
4664 'CFLAGS' environment variable, you must expand it. For example, use:
4669 * getopt limitations:: getopt feature limitations
4670 * getopt building:: getopt build requirements
4673 File: autogen.info, Node: getopt limitations, Next: getopt building, Up: getopt_long
4675 7.15.1 getopt feature limitations
4676 ---------------------------------
4678 This list of limitations is relative to the full list of AutoOpts
4679 supported features, *Note Features::.
4681 1. You cannot automatically take advantage of environment variable
4682 options or automated parsing of configuration files ('rc' or 'ini'
4683 files). Consequently, the resulting code does not support
4684 '--load-opts' or '--save-opts' options automatically.
4686 2. You cannot use set membership, enumerated, range checked or stacked
4687 argument type options. In fact, you cannot use anything that
4688 depends upon the 'libopts' library. You are constrained to options
4689 that take 'string' arguments, though you may handle the option
4690 argument with a callback procedure.
4692 3. Special disablement and/or enablement prefixes are not recognized.
4694 4. Option coordination with external libraries will not work.
4696 5. Every option must be 'settable' because the emitted code depends
4697 upon the 'SET_OPT_XXX' macros having been defined. Specify this as
4698 a global (program) attribute.
4700 6. You must specify a main procedure attribute (*note Generated
4701 main::). The 'getopt.tpl' template depends upon being able to
4702 compile the traditional .c file into a program and get it to emit
4705 7. For the same reason, the traditional option parsing table code must
4706 be emitted before the 'getopt.tpl' template gets expanded.
4708 8. The usage text is, therefore, statically defined.
4711 File: autogen.info, Node: getopt building, Prev: getopt limitations, Up: getopt_long
4713 7.15.2 getopt build requirements
4714 --------------------------------
4716 You must supply some compile and link options via environment variables.
4719 In case the option definition file lives in a different directory.
4721 Any special flags required to compile. The flags from
4722 'autoopts-config cflags' will be included automatically. Since the
4723 creation of the option parsing code includes creating a program
4724 that prints out help text, if it is necessary to include files from
4725 various directories to compile that program, you will need to
4726 specify those directories with '-Idirpath' text in the 'CFLAGS'.
4727 Some experimentation may be necessary in that case.
4729 *NOTE*: the '-Idirpath' text is only needed if your option callback
4730 functions include code that require additional '#include'
4733 Any special flags required to link. The flags from
4734 'autoopts-config ldflags' will be included automatically. This is
4735 required only if additional link flags for the help text emission
4736 program might be needed.
4738 This is needed only if 'cc' cannot be found in '$PATH' (or it is
4739 not the one you want).
4741 To use this, set the exported environment variables and specify
4742 'getopt' as the default template in your option definitions file (*note
4743 Identification::). You will have four new files. Assuming your
4744 definitions were in a file named 'myprog-opts.def' and your program name
4745 was specified as 'progname', the resulting files would be created:
4746 'myprog-opts.h', 'myprog-opts.c', 'getopt-progname.h' and
4747 'getopt-progname.c'. You must compile and link both '.c' files into
4748 your program. If there are link failures, then you are using AutoOpts
4749 features that require the 'libopts' library. You must remove these
4750 features, *Note getopt limitations::.
4752 These generated files depend upon configure defines to work
4753 correctly. Therefore, you must specify a 'config-header' attribute
4754 (*note programming attributes::) and ensure it has '#defines' for either
4755 'HAVE_STDINT_H' or 'HAVE_INTTYPES_H'; either 'HAVE_SYS_LIMITS_H' or
4756 'HAVE_LIMITS_H'; and 'HAVE_SYSEXITS_H', if the 'sysexits.h' header is
4757 available. The required header files for these defines are,
4758 respectively, the '/usr/include' files named:
4765 The following header files must also exist on the build platform:
4769 * unistd.h - or, for getopt_long:
4773 File: autogen.info, Node: i18n, Next: Naming Conflicts, Prev: getopt_long, Up: AutoOpts
4775 7.16 Internationalizing AutoOpts
4776 ================================
4778 The generated code for AutoOpts will enable and disable the translation
4779 of AutoOpts run time messages. If 'ENABLE_NLS' is defined at compile
4780 time and 'no-xlate' has been not set to the value _anything_, then the
4781 '_()' macro may be used to specify a translation function. If
4782 undefined, it will default to 'gettext(3GNU)'. This define will also
4783 enable a callback function that 'optionProcess' invokes at the beginning
4784 of option processing. The AutoOpts 'libopts' library will always check
4785 for this _compiled with NLS_ flag, so 'libopts' does not need to be
4786 specially compiled. The strings returned by the translation function
4787 will be 'strdup(3)-ed' and kept. They will not be re-translated, even
4788 if the locale changes, but they will also not be dependent upon reused
4789 or unmappable memory.
4791 You should also ensure that the 'ATTRIBUTE_FORMAT_ARG()' gets
4792 '#define'-ed to something useful. There is an autoconf macro named
4793 'AG_COMPILE_FORMAT_ARG' in 'ag_macros.m4' that will set it appropriately
4794 for you. If you do not do this, then translated formatting strings may
4795 trigger GCC compiler warnings.
4797 To internationalize option processing, you should first
4798 internationalize your program. Then, the option processing strings can
4799 be added to your translation text by processing the AutoOpts-generated
4800 'my-opts.c' file and adding the distributed 'po/usage-txt.pot' file.
4801 (Also by extracting the strings yourself from the 'usage-txt.h' file.)
4802 When you call 'optionProcess', all of the user visible AutoOpts strings
4803 will be passed through the localization procedure established with the
4804 '_()' preprocessing macro.
4806 All of this is _dis_-abled if you specify the global attribute
4807 'no-xlate' to _anything_.
4810 File: autogen.info, Node: Naming Conflicts, Next: All Attribute Names, Prev: i18n, Up: AutoOpts
4812 7.17 Naming Conflicts
4813 =====================
4815 AutoOpts generates a header file that contains many C preprocessing
4816 macros and several external names. For the most part, they begin with
4817 either 'opt_' or 'option', or else they end with '_opt'. If this
4818 happens to conflict with other macros you are using, or if you are
4819 compiling multiple option sets in the same compilation unit, the
4820 conflicts can be avoided. You may specify an external name 'prefix'
4821 (*note program attributes::) for all of the names generated for each set
4822 of option definitions.
4824 Among these macros, several take an option name as a macro argument.
4825 Sometimes, this will inconveniently conflict. For example, if you
4826 specify an option named, 'debug', the emitted code will presume that
4827 'DEBUG' is not a preprocessing name. Or also, if you are building on a
4828 Windows platform, you may find that MicroSoft has usurped a number of
4829 user space names in its header files. Consequently, you will get a
4830 preprocessing error if you use, for example, 'HAVE_OPT(DEBUG)' or
4831 'HAVE_OPT(INTERNAL)' (*note HAVE_OPT::) in your code. You may trigger
4832 an obvious warning for such conflicts by specifying the
4833 'guard-option-names' attribute (*note program attributes::). That
4834 emitted code will also '#undef'-ine the conflicting name.
4837 File: autogen.info, Node: All Attribute Names, Next: Option Define Names, Prev: Naming Conflicts, Up: AutoOpts
4839 7.18 All Attribute Names
4840 ========================
4842 This is the list of all the option attributes used in the various option
4843 processing templates. There are several flavors of attributes, and
4844 these are not distinguished here.
4846 * Valid, current attributes that you are encouraged to use.
4847 * Internally generated attributes that you cannot use at all. I need
4848 to prefix these with a distinguished prefix. e.g. 'ao-'
4849 * Valid attributes, but are deprecated. Alternates should be
4852 This list is derived by running many example option definitions
4853 through the option generation and man page templates and noting which
4854 attributes are actually used. There may be a few that are used but not
4855 exercised in my testing. If so, I need to ferret those out and test
4858 addtogroup aliases allow_errors arg_default
4859 arg_name arg_optional arg_range arg_type
4860 argument author call_proc cmd_section
4861 comment_char concept config_header copyright
4862 date default deprecated descrip
4863 detail die_code disable disable_load
4864 disable_save doc doc_section doc_sub
4865 doc_sub_cmd documentation ds_format ds_text
4866 ds_type eaddr enable enabled
4867 environrc equivalence exit_desc exit_name
4868 explain export extract_code field
4869 file_fail_code flag flag_code flag_proc
4870 flags_cant flags_must full_usage gnu_usage
4871 guard_option_names handler_proc handler_type help_type
4872 help_value home_rc homerc ifdef
4873 ifndef immed_disable immediate include
4874 interleaved keyword lib_name library
4875 load_opts_value long_opts main_fini main_init
4876 main_type max min more_help_value
4877 must_set name no_command no_libopts
4878 no_misuse_usage no_preset no_xlate omit_texi
4879 omitted_usage open_file opt_state option_format
4880 option_info owner package prefix
4881 prefix_enum preserve_case prog_descrip prog_info_descrip
4882 prog_man_descrip prog_name prog_title rcfile
4883 reorder_args reset_value resettable save_opts_value
4884 scaled set_desc set_index settable
4885 short_usage stack_arg stdin_input sub_name
4886 sub_text sub_type test_main translators
4887 type unshar_file_code unstack_arg usage
4888 usage_message usage_opt usage_value value
4889 vendor_opt version version_proc version_value
4892 File: autogen.info, Node: Option Define Names, Prev: All Attribute Names, Up: AutoOpts
4894 7.19 Option Definition Name Index
4895 =================================
4900 * addtogroup: global option attributes.
4902 * allow-errors: presentation attributes.
4904 * arg-default: arg-default. (line 6)
4905 * arg-name: per option attributes.
4907 * arg-optional: arg-optional. (line 6)
4908 * arg-range: arg-type number. (line 21)
4909 * arg-type: Option Arguments. (line 24)
4910 * argument: program attributes. (line 22)
4911 * author: information attributes.
4913 * before-guile-boot: main guile. (line 9)
4914 * call-proc: Option Argument Handling.
4916 * cmd-section: global option attributes.
4918 * comment-char: main-for-each-opts. (line 25)
4919 * config-header: program attributes. (line 33)
4920 * config-header <1>: programming attributes.
4922 * copyright: information attributes.
4924 * date: information attributes.
4926 * default: opt-attr default option.
4928 * deprecated: Common Attributes. (line 28)
4929 * descrip: Required Attributes. (line 34)
4930 * detail: information attributes.
4932 * detail <1>: global option attributes.
4934 * die-code: programming attributes.
4936 * disable: Common Attributes. (line 33)
4937 * disable-load: config attributes. (line 13)
4938 * disable-save: config attributes. (line 13)
4939 * doc: per option attributes.
4941 * doc-section: global option attributes.
4943 * doc-sub: global option attributes.
4945 * doc-sub-cmd: global option attributes.
4947 * documentation: lib and program. (line 16)
4948 * documentation <1>: opt-attr documentation.
4950 * eaddr: information attributes.
4952 * enable: Common Attributes. (line 45)
4953 * enabled: Common Attributes. (line 49)
4954 * environrc: config attributes. (line 17)
4955 * equivalence: opt-attr equivalence.
4957 * exit-desc: programming attributes.
4959 * exit-name: programming attributes.
4961 * explain: information attributes.
4963 * export: programming attributes.
4965 * extra-code: arg-keyword. (line 15)
4966 * extract-code: Option Argument Handling.
4968 * file-exists: arg-type file name. (line 13)
4969 * file-mode: arg-type file name. (line 29)
4970 * flag-code: Option Argument Handling.
4972 * flag-proc: Option Argument Handling.
4974 * full-usage: usage attributes. (line 10)
4975 * gnu-usage: usage attributes. (line 43)
4976 * gnu-usage <1>: information attributes.
4978 * guard-option-names: programming attributes.
4980 * guile-main: main guile. (line 14)
4981 * handler-frees: main-for-each-type. (line 66)
4982 * handler-proc: main-for-each-proc. (line 6)
4983 * handler-type: main-for-each-type. (line 6)
4984 * help-value: automatic options. (line 18)
4985 * homerc: config attributes. (line 26)
4986 * ifdef: Common Attributes. (line 56)
4987 * ifndef: Common Attributes. (line 56)
4988 * immed-disable: Immediate Action. (line 31)
4989 * immediate: Immediate Action. (line 24)
4990 * include: programming attributes.
4992 * interleaved: main-for-each-opts. (line 10)
4993 * keyword: arg-keyword. (line 6)
4994 * lib-name: lib and program. (line 24)
4995 * library: lib and program. (line 7)
4996 * load-opts-value: automatic options. (line 15)
4997 * long-opts: presentation attributes.
4999 * main: Generated main. (line 8)
5000 * main-fini: main-for-each-opts. (line 21)
5001 * main-init: main-for-each-opts. (line 17)
5002 * main-type: Generated main. (line 12)
5003 * max: Common Attributes. (line 14)
5004 * min: Common Attributes. (line 19)
5005 * more-help-value: automatic options. (line 15)
5006 * must-set: Common Attributes. (line 24)
5007 * MYHANDLER-code: main-for-each-code. (line 6)
5008 * name: Required Attributes. (line 9)
5009 * no-command: Common Attributes. (line 87)
5010 * no-libopts: programming attributes.
5012 * no-misuse-usage: usage attributes. (line 57)
5013 * no-preset: opt-attr no-preset. (line 6)
5014 * no-xlate: presentation attributes.
5016 * omitted-usage: Common Attributes. (line 56)
5017 * open-file: arg-type file name. (line 23)
5018 * option-code: main main. (line 7)
5019 * option-format: global option attributes.
5021 * option-info: global option attributes.
5023 * opts-ptr: information attributes.
5025 * owner: information attributes.
5027 * package: information attributes.
5029 * prefix: programming attributes.
5031 * prefix-enum: arg-type keyword. (line 38)
5032 * preserve-case: information attributes.
5034 * prog-desc: information attributes.
5036 * prog-group: usage attributes. (line 65)
5037 * prog-name: program attributes. (line 15)
5038 * prog-title: program attributes. (line 19)
5039 * rcfile: config attributes. (line 56)
5040 * reorder-args: presentation attributes.
5042 * reorder-args <1>: information attributes.
5044 * reset-value: automatic options. (line 15)
5045 * resettable: presentation attributes.
5047 * save-opts-value: automatic options. (line 19)
5048 * scaled: arg-type number. (line 15)
5049 * settable: opt-attr settable. (line 6)
5050 * short-usage: usage attributes. (line 38)
5051 * stack-arg: Option Argument Handling.
5053 * text: information attributes.
5055 * translators: opt-attr translators.
5057 * type: information attributes.
5059 * unstack-arg: Option Argument Handling.
5061 * usage: usage attributes. (line 73)
5062 * usage <1>: information attributes.
5064 * usage-message: programming attributes.
5066 * usage-opt: Features. (line 56)
5067 * usage-opt <1>: usage attributes. (line 51)
5068 * usage-value: automatic options. (line 15)
5069 * value: Common Attributes. (line 10)
5070 * vendor-opt: config attributes. (line 61)
5071 * version: usage attributes. (line 90)
5072 * version-proc: automatic options. (line 23)
5073 * version-value: automatic options. (line 15)
5076 File: autogen.info, Node: Add-Ons, Next: Future, Prev: AutoOpts, Up: Top
5078 8 Add-on packages for AutoGen
5079 *****************************
5081 This chapter includes several programs that either work closely with
5082 AutoGen (extracting definitions or providing special formatting
5083 functions), or leverage off of AutoGen technology. There is also a
5084 formatting library that helps make AutoGen possible.
5086 AutoOpts ought to appear in this list as well, but since it is the
5087 primary reason why many people would even look into AutoGen at all, I
5088 decided to leave it in the list of chapters.
5092 * AutoFSM:: Automated Finite State Machine.
5093 * AutoXDR:: Combined RPC Marshalling.
5094 * AutoEvents:: Automated Event Management.
5095 * Bit Maps:: Bit Maps and Enumerations.
5096 * columns Invocation:: Invoking columns.
5097 * getdefs Invocation:: Invoking getdefs.
5098 * xml2ag Invocation:: Invoking xml2ag.
5099 * snprintfv:: The extensible format printing library.
5102 File: autogen.info, Node: AutoFSM, Next: AutoXDR, Up: Add-Ons
5104 8.1 Automated Finite State Machine
5105 ==================================
5107 The templates to generate a finite state machine in C or C++ is included
5108 with AutoGen. The documentation is not. The documentation is in HTML
5109 format for viewing (http://www.gnu.org/software/autogen/autofsm.html),
5110 or you can download FSM (http://download.sourceforge.net/autogen/).
5113 File: autogen.info, Node: AutoXDR, Next: AutoEvents, Prev: AutoFSM, Up: Add-Ons
5115 8.2 Combined RPC Marshalling
5116 ============================
5118 The templates and NFSv4 definitions are not included with AutoGen in any
5119 way. The folks that designed NFSv4 noticed that much time and bandwidth
5120 was wasted sending queries and responses when many of them could be
5121 bundled. The protocol bundles the data, but there is no support for it
5122 in rpcgen. That means you have to write your own code to do that.
5123 Until now. Download this and you will have a large, complex example of
5124 how to use 'AutoXDR' for generating the marshaling and unmarshaling of
5125 combined RPC calls. There is a brief example on the web
5126 (http://www.gnu.org/software/autogen/xdr/index.html), but you should
5127 download AutoXDR (http://download.sourceforge.net/autogen/).
5130 File: autogen.info, Node: AutoEvents, Next: Bit Maps, Prev: AutoXDR, Up: Add-Ons
5132 8.3 Automated Event Management
5133 ==============================
5135 Large software development projects invariably have a need to manage the
5136 distribution and display of state information and state changes. In
5137 other words, they need to manage their software events. Generally, each
5138 such project invents its own way of accomplishing this and then
5139 struggles to get all of its components to play the same way. It is a
5140 difficult process and not always completely successful. This project
5143 AutoEvents completely separates the tasks of supplying the data
5144 needed for a particular event from the methods used to manage the
5145 distribution and display of that event. Consequently, the programmer
5146 writing the code no longer has to worry about that part of the problem.
5147 Likewise the persons responsible for designing the event management and
5148 distribution no longer have to worry about getting programmers to write
5151 This is a work in progress. See my web page
5152 (http://www.gnu.org/software/autogen/autoevents.html) on the subject, if
5153 you are interested. I have some useful things put together, but it is
5154 not ready to call a product.
5157 File: autogen.info, Node: Bit Maps, Next: columns Invocation, Prev: AutoEvents, Up: Add-Ons
5159 8.4 Bit Maps and Enumerations
5160 =============================
5162 AutoGen provides two templates for managing enumerations and bit maps
5163 (flag words). They produce an enumeration of the enum or '#define's for
5164 the bit maps, plus conversion functions for converting a string into one
5165 of these values or converting one of these values into a human readable
5166 string. Finally, for enumerations, you may specify one or more sets of
5167 dispatching functions that will be selected by identifying a keyword
5168 prefix of a string (*note the dispatch attribute in Strings to Enums and
5171 There is a separate project that produces a GDB add-on that will add
5172 these capabilities into GDB for bit masks. (GDB does just fine with
5177 * enums:: Enumerations
5178 * enum-code:: Strings to Enums and Back
5179 * masks:: Bit Maps and Masks
5182 File: autogen.info, Node: enums, Next: enum-code, Up: Bit Maps
5189 Produce an enumeration for a list of input "cmd"s (names).
5190 Optionally, produce functions to:
5192 * convert a string to an enumeration
5193 * convert an enumeration value into a string
5194 * invoke a function based on the first token name found in a string
5196 The header file produced will contain the enumeration and
5197 declarations for the optional procedures. The code ('.c') file will
5198 contain these optional procedures, but can be omitted if the 'no-code'
5199 attribute is specified.
5201 The following attributes are recognized with the 'str2enum' template:
5204 You must provide a series of these attributes: they specify the
5205 list of names used in the enumeration. Specific values for the
5206 names may be specified by specifying a numeric index for these
5207 attributes. e.g. 'cmd[5] = mumble;' will cause
5209 to be inserted into the enumeration. Do not specify a value of
5210 "invalid", unless you specify the 'invalid-name' attribute. (In
5211 that case, do not specify a 'cmd' value that matches the
5212 'invalid-name' value.)
5215 This specifies the first segment of each enumeration name. If not
5216 specified, the first segment of the enumeration definition file
5217 name will be used. e.g. 'foo-bar.def' will default to a 'FOO'
5221 Normally, there is a second constant segment following the prefix.
5222 If not specified, it will be 'CMD', so if both 'prefix' and 'type'
5223 were to default from 'foo-bar.def', you will have enumeration
5224 values prefixed with 'FOO_CMD_'. If specified as the empty string,
5225 there will be no "type" component to the name and the default
5226 constant prefix will thus be 'FOO_'.
5229 This specifies the base name of the output files, enumeration type
5230 and the translation functions. The default is to use the
5231 'basename(3)' of the definition file. e.g. 'foo-bar.def' results
5232 in a 'base-name' of 'foo-bar'.
5235 The default invalid value is zero. Sometimes, it is useful for
5236 zero to be valid. If so, you can specify ~0 or the empty string to
5237 be invalid. The empty string will cause the enumeration count
5238 (maximum value plus 1) to be the invalid value.
5241 By default, the invalid value is emitted into the enumeration as
5242 'FOO_INVALID_CMD'. Specifying this attribute will replace
5243 'INVALID' with whatever you place in this attribute.
5246 Additional text to insert into the code or header file.
5249 Which file to insert the text into. There are four choices,
5250 only two of which are relevant for the 'str2enum' template:
5251 "enum-header", "enum-code", "mask-header" or "mask-code".
5257 File: autogen.info, Node: enum-code, Next: masks, Prev: enums, Up: Bit Maps
5259 8.4.2 Strings to Enums and Back
5260 -------------------------------
5262 A continuation of the attributes for the 'str2enum.tpl' template.
5265 Do not emit any string to enumeration or enumeration to string code
5266 at all. If this is specified, the remainder of the attributes have
5270 Do not emit the enumeration to name function.
5273 When looking up a string, the case of the input string is ignored.
5276 A single punctuation character can be interpreted as a command.
5277 The first character of this attribute is the aliased character and
5278 the remainder the aliased-to command. e.g. "#comment" makes '#'
5279 an alias for the 'comment' command. "#comment" must still be
5280 listed in the 'cmd' attributes.
5283 Specify how lengths are to be handled. Under the covers,
5284 'gperf(1)' is used to map a string to an enumeration value. The
5285 code it produces requires the string length to be passed in. You
5286 may pass in the length yourself, or the generated code may figure
5287 it out, or you may ask for that length to be returned back after
5290 You have four choices with the 'length' attribute:
5292 * Do not specify it. You will need to provide the length.
5293 * Specify "provided". You will need to provide the length.
5294 * Specify "returned". You must pass a pointer to a size_t
5295 object. If the name is found, the length will be put there.
5296 * Specify an empty string. The generated code will compute the
5297 length and that computed length will not be returned. The
5298 length parameter may be omitted. If the input strings contain
5299 only enumeration names, then this would be sufficient.
5300 * Specifying anything else is undefined.
5303 Normally, a name must fully match to be found successfully. This
5304 attribute causes the generated code to look for partial matches if
5305 the full match 'gperf' function fails. Partial matches must be at
5306 least two characters long.
5309 by default, the display string for an undefined value is "*
5310 UNDEFINED *". Use this to change that.
5313 A series of punctuation characters considered equivalent.
5314 Typically, "-_" but sometimes (Tandem) "-_^". Do not use '#' in
5315 the list of characters.
5318 A lookup procedure will call a dispatch function for the procedure
5319 named after the keyword identified at the start of a string. Other
5320 than as specially noted below, for every named "cmd", must have a
5321 handling function, plus another function to handle errors, with
5322 "invalid" (or the 'invalid-name' value) as the 'cmd' name.
5323 Multiple 'dispatch' definitions will produce multiple dispatching
5324 functions, each with (potentially) unique argument lists and return
5327 You may also use 'add-on-text' to "#define" one function to
5328 another, thus allowing one function to handle multiple keywords or
5329 commands. The 'd-nam' and 'd-ret' attributes are required. The
5330 'd-arg', 'd-omit' and 'd-only' attributes are optional:
5333 This must be a printf format string with one formatting
5334 element: '%s'. The '%s' will be replaced by each 'cmd' name.
5335 The '%s' will be stripped and the result will be combined with
5336 the base name to construct the dispatch procedure name.
5339 The return type of the dispatched function, even if "void".
5342 If there are additional arguments that are to be passed
5343 through to the dispatched function, specify this as though it
5344 were part of the procedure header. (It will be glued into the
5345 dispatching function as is and sedded into what is needed for
5346 the dispatched function.)
5349 Instead of providing handling functions for all of the 'cmd'
5350 names, the invalid function will be called for omitted command
5354 You need only provide functions for the names listed by
5355 'd-only', plus the "invalid" name. All other command values
5356 will trigger calls to the invalid handling function. Note
5357 that the invalid call can distinguish from a command that
5358 could not be found by examining the value of its first ('id')
5361 The handler functions will have the command enumeration as its
5362 first first argument, a pointer to a constant string that will be
5363 the character after the parsed command (keyword) name, plus any
5364 'd-arg' arguments that follow that.
5366 As an example, a file 'samp-chk.def' containing this:
5367 AutoGen Definitions str2enum;
5368 cmd = one, two; invalid-name = oops;
5369 dispatch = { d-nam = 'hdl_%s_cmd'; d-ret = void; };
5370 will produce a header containing:
5378 extern samp_chk_enum_t
5379 find_samp_chk_cmd(char const * str, size_t len);
5381 typedef void(samp_chk_handler_t)(
5382 samp_chk_enum_t id, char const * str);
5385 hdl_oops_cmd, hdl_one_cmd, hdl_two_cmd;
5388 disp_samp_chk(char * str, size_t len);
5391 samp_chk_name(samp_chk_enum_t id);
5393 * 'find_samp_chk_cmd' will look up a 'len' byte 'str' and return
5394 the corresponding 'samp_chk_enum_t' value. That value is
5395 'SAMP_OOPS_CMD' if the string is not "one" or "two".
5396 * 'samp_chk_handler_t' is the type of the callback procedures.
5397 Three must be provided for the dispatching function to call:
5398 'hdl_oops_cmd', 'hdl_one_cmd' and 'hdl_two_cmd'.
5399 'hdl_oops_cmd' will receive calls when the string does not
5401 * 'disp_samp_chk' this function will call the handler function
5402 and return whatever the handler returns. In this case, it is
5404 * 'samp_chk_name' will return a string corresponding to the
5405 enumeration value argument. If the value is not valid, "*
5406 UNDEFINED *" (or the value of 'undef-str') is used.
5409 File: autogen.info, Node: masks, Prev: enum-code, Up: Bit Maps
5411 8.4.3 Bit Maps and Masks
5412 ------------------------
5416 This template leverages highly off of enumerations (*note enums::).
5417 It will produce a header file with bit masks defined for each bit
5418 specified with a 'cmd' attribute. 63 is the highest legal bit number
5419 because this template has not been extended to cope with multiple word
5420 masks. (Patches would be welcome.)
5422 There are a few constraints on the names allowed:
5424 * names are constrained to alphanumerics and the underscore
5425 * aliases are not allowed
5426 * dispatch procedures are not allowed
5428 'no-code' and 'no-name' are honored. 'dispatch' is not. The lookup
5429 function will examine each token in an input string, determine which bit
5430 is specified and add it into a result. The names may be prefixed with a
5431 hyphen (-) or tilde (~) to remove the bit(s) from the cumulative result.
5432 If the string begins with a plus (+), hyphen or tilde, a "base value"
5433 parameter is used for the starting mask, otherwise the conversion starts
5436 Beyond the enumeration attributes that are used (or ignored), the
5437 'str2mask' template accepts a 'mask' attribute. It takes a few
5441 a special name for a sub-collection of the mask bits
5444 The name of each previously defined bit(s). If the desired
5445 previously defined value is a mask, that 'm-name' must be suffixed
5449 When all done collecting the bits, x-or the value with the mask of
5450 all the bits in the collection.
5452 A mask of all bits in the collection is always generated.
5455 File: autogen.info, Node: columns Invocation, Next: getdefs Invocation, Prev: Bit Maps, Up: Add-Ons
5457 8.5 Invoking columns
5458 ====================
5460 This program was designed for the purpose of generating compact,
5461 columnized tables. It will read a list of text items from standard in
5462 or a specified input file and produce a columnized listing of all the
5463 non-blank lines. Leading white space on each line is preserved, but
5464 trailing white space is stripped. Methods of applying per-entry and
5465 per-line embellishments are provided. See the formatting and separation
5468 This program is used by AutoGen to help clean up and organize its
5471 See 'autogen/agen5/fsm.tpl' and the generated output 'pseudo-fsm.h'.
5473 This function was not implemented as an expression function because
5474 either it would have to be many expression functions, or a provision
5475 would have to be added to provide options to expression functions.
5476 Maybe not a bad idea, but it is not being implemented at the moment.
5478 A side benefit is that you can use it outside of 'autogen' to
5479 columnize input, a la the 'ls' command.
5481 This section was generated by *AutoGen*, using the 'agtexi-cmd'
5482 template and the option descriptions for the 'columns' program. This
5483 software is released under the GNU General Public License, version 3 or
5488 * columns usage:: columns help/usage ('--help')
5489 * columns dimensions:: dimensions options
5490 * columns treatment:: treatment options
5491 * columns ordering:: ordering options
5492 * columns input-text:: input-text options
5493 * columns config:: presetting/configuring columns
5494 * columns exit status:: exit status
5495 * columns See Also:: See Also
5498 File: autogen.info, Node: columns usage, Next: columns dimensions, Up: columns Invocation
5500 8.5.1 columns help/usage ('--help')
5501 -----------------------------------
5503 This is the automatically generated usage text for columns.
5505 The text printed is the same whether selected with the 'help' option
5506 ('--help') or the 'more-help' option ('--more-help'). 'more-help' will
5507 print the usage text by passing it through a pager program. 'more-help'
5508 is disabled on platforms without a working 'fork(2)' function. The
5509 'PAGER' environment variable is used to select the program, defaulting
5510 to 'more'. Both will exit with a status code of 0.
5512 columns (GNU AutoGen) - Columnize Input Text - Ver. 1.2
5513 Usage: columns [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
5515 Specify the output dimensions:
5517 Flg Arg Option-Name Description
5518 -W Num width Maximum Line Width
5519 - it must be in the range:
5521 -c Num columns Desired number of columns
5522 - it must be in the range:
5524 -w Num col-width Set width of each column
5525 - it must be in the range:
5527 Num tab-width tab width
5529 Specify how to lay out the text:
5531 Flg Arg Option-Name Description
5532 Num spread maximum spread added to column width
5533 - it must be in the range:
5535 no fill Fill lines with input
5536 - prohibits these options:
5540 -I Str indent Line prefix or indentation
5541 Str first-indent First line prefix
5542 - requires the option 'indent'
5543 -f Str format Formatting string for each input
5544 -S Str separation Separation string - follows all but last
5545 Str line-separation string at end of all lines but last
5546 Str ending string at end of last line
5548 Specify the ordering of the entries:
5550 Flg Arg Option-Name Description
5551 no by-columns Print entries in column order
5552 -s opt sort Sort input text
5554 Redirecting stdin to an alternate file:
5556 Flg Arg Option-Name Description
5557 -i Str input Input file (if not stdin)
5559 Version, usage and configuration options:
5561 Flg Arg Option-Name Description
5562 -v opt version output version information and exit
5563 -? no help display extended usage information and exit
5564 -! no more-help extended usage information passed thru pager
5565 -> opt save-opts save the option state to a config file
5566 -< Str load-opts load options from a config file
5567 - disabled as '--no-load-opts'
5568 - may appear multiple times
5570 Options are specified by doubled hyphens and their name or by a single
5571 hyphen and the flag character.
5573 The following option preset mechanisms are supported:
5574 - reading file ./.columnsrc
5575 - reading file $HOME/.columnsrc
5576 - examining environment variables named COLUMNS_*
5578 Please send bug reports to: <autogen-users@lists.sourceforge.net>
5581 File: autogen.info, Node: columns dimensions, Next: columns treatment, Prev: columns usage, Up: columns Invocation
5583 8.5.2 dimensions options
5584 ------------------------
5586 Specify the output dimensions.
5591 This is the "maximum line width" option. This option takes a number
5592 argument 'num'. This option specifies the full width of the output
5593 line, including any start-of-line indentation. The output will fill
5594 each line as completely as possible, unless the column width has been
5595 explicitly specified. If the maximum width is less than the length of
5596 the widest input, you will get a single column of output.
5598 columns option (-c).
5599 ....................
5601 This is the "desired number of columns" option. This option takes a
5602 number argument 'count'. Use this option to specify exactly how many
5603 columns to produce. If that many columns will not fit within
5604 LINE_WIDTH, then the count will be reduced to the number that fit.
5606 col-width option (-w).
5607 ......................
5609 This is the "set width of each column" option. This option takes a
5610 number argument 'num'. Use this option to specify exactly how many
5611 characters are to be allocated for each column. If it is narrower than
5612 the widest entry, it will be over-ridden with the required width.
5617 This is the "tab width" option. This option takes a number argument
5618 'num'. If an indentation string contains tabs, then this value is used
5619 to compute the ending column of the prefix string.
5622 File: autogen.info, Node: columns treatment, Next: columns ordering, Prev: columns dimensions, Up: columns Invocation
5624 8.5.3 treatment options
5625 -----------------------
5627 Specify how to lay out the text.
5632 This is the "maximum spread added to column width" option. This option
5633 takes a number argument 'num'. Use this option to specify exactly how
5634 many characters may be added to each column. It allows you to prevent
5635 columns from becoming too far apart. Without this option, 'columns'
5636 will attempt to widen columns to fill the full width.
5641 This is the "fill lines with input" option.
5643 This option has some usage constraints. It:
5644 * must not appear in combination with any of the following options:
5645 spread, col_width, by_columns.
5647 Instead of columnizing the input text, fill the output lines with the
5648 input lines. Blank lines on input will cause a blank line in the
5649 output, unless the output is sorted. With sorted output, blank lines
5655 This is the "line prefix or indentation" option. This option takes a
5656 string argument 'l-pfx'. If a number, then this many spaces will be
5657 inserted at the start of every line. Otherwise, it is a line prefix
5658 that will be inserted at the start of every line.
5660 first-indent option.
5661 ....................
5663 This is the "first line prefix" option. This option takes a string
5666 This option has some usage constraints. It:
5667 * must appear in combination with the following options: indent.
5669 If a number, then this many spaces will be inserted at the start of
5670 the first line. Otherwise, it is a line prefix that will be inserted at
5671 the start of that line. If its length exceeds "indent", then it will be
5672 emitted on a line by itself, suffixed by any line separation string.
5675 $ columns --first='#define TABLE' -c 2 -I4 --line=' \' <<_EOF_
5688 This is the "formatting string for each input" option. This option
5689 takes a string argument 'fmt-str'. If you need to reformat each input
5690 text, the argument to this option is interpreted as an 'sprintf(3)'
5691 format that is used to produce each output entry.
5693 separation option (-S).
5694 .......................
5696 This is the "separation string - follows all but last" option. This
5697 option takes a string argument 'sep-str'. Use this option if, for
5698 example, you wish a comma to appear after each entry except the last.
5700 line-separation option.
5701 .......................
5703 This is the "string at end of all lines but last" option. This option
5704 takes a string argument 'sep-str'. Use this option if, for example, you
5705 wish a backslash to appear at the end of every line, except the last.
5710 This is the "string at end of last line" option. This option takes a
5711 string argument 'end-str'. This option puts the specified string at the
5715 File: autogen.info, Node: columns ordering, Next: columns input-text, Prev: columns treatment, Up: columns Invocation
5717 8.5.4 ordering options
5718 ----------------------
5720 Specify the ordering of the entries.
5725 This is the "print entries in column order" option. Normally, the
5726 entries are printed out in order by rows and then columns. This option
5727 will cause the entries to be ordered within columns. The final column,
5728 instead of the final row, may be shorter than the others.
5733 This is the "sort input text" option. This option takes an optional
5734 string argument 'key-pat'. Causes the input text to be sorted. If an
5735 argument is supplied, it is presumed to be a pattern and the sort is
5736 based upon the matched text. If the pattern starts with or consists of
5737 an asterisk ('*'), then the sort is case insensitive.
5740 File: autogen.info, Node: columns input-text, Next: columns config, Prev: columns ordering, Up: columns Invocation
5742 8.5.5 input-text options
5743 ------------------------
5745 Redirecting stdin to an alternate file.
5750 This is the "input file (if not stdin)" option. This option takes a
5751 string argument 'file'. This program normally runs as a 'filter',
5752 reading from standard input, columnizing and writing to standard out.
5753 This option redirects input to a file.
5756 File: autogen.info, Node: columns config, Next: columns exit status, Prev: columns input-text, Up: columns Invocation
5758 8.5.6 presetting/configuring columns
5759 ------------------------------------
5761 Any option that is not marked as not presettable may be preset by
5762 loading values from configuration ("rc" or "ini") files, and values from
5763 environment variables named 'COLUMNS' and 'COLUMNS_<OPTION_NAME>'.
5764 '<OPTION_NAME>' must be one of the options listed above in upper case
5765 and segmented with underscores. The 'COLUMNS' variable will be
5766 tokenized and parsed like the command line. The remaining variables are
5767 tested for existence and their values are treated like option arguments.
5769 'libopts' will search in 2 places for configuration files:
5772 The environment variables 'PWD', and 'HOME' are expanded and replaced
5773 when 'columns' runs. For any of these that are plain files, they are
5774 simply processed. For any that are directories, then a file named
5775 '.columnsrc' is searched for within that directory and processed.
5777 Configuration files may be in a wide variety of formats. The basic
5778 format is an option name followed by a value (argument) on the same
5779 line. Values may be separated from the option name with a colon, equal
5780 sign or simply white space. Values may be continued across multiple
5781 lines by escaping the newline with a backslash.
5783 Multiple programs may also share the same initialization file.
5784 Common options are collected at the top, followed by program specific
5785 segments. The segments are separated by lines like:
5789 Do not mix these styles within one configuration file.
5791 Compound values and carefully constructed string values may also be
5792 specified using XML syntax:
5794 <sub-opt>...<...>...</sub-opt>
5796 yielding an 'option-name.sub-opt' string value of
5798 'AutoOpts' does not track suboptions. You simply note that it is a
5799 hierarchicly valued option. 'AutoOpts' does provide a means for
5800 searching the associated name/value pair list (see: optionFindValue).
5802 The command line options relating to configuration and/or usage help
5808 Print the program version to standard out, optionally with licensing
5809 information, then exit 0. The optional argument specifies how much
5810 licensing detail to provide. The default is to print just the version.
5811 The licensing information may be selected with an option argument. Only
5812 the first letter of the argument is examined:
5815 Only print the version. This is the default.
5817 Name the copyright usage licensing terms.
5819 Print the full copyright usage licensing terms.
5822 File: autogen.info, Node: columns exit status, Next: columns See Also, Prev: columns config, Up: columns Invocation
5824 8.5.7 columns exit status
5825 -------------------------
5827 One of the following exit values will be returned:
5829 Successful program execution.
5831 The operation failed or the command syntax was not valid.
5833 A specified configuration file could not be loaded.
5835 libopts had an internal operational error. Please report it to
5836 autogen-users@lists.sourceforge.net. Thank you.
5839 File: autogen.info, Node: columns See Also, Prev: columns exit status, Up: columns Invocation
5841 8.5.8 columns See Also
5842 ----------------------
5844 This program is documented more fully in the Columns section of the
5845 Add-On chapter in the 'AutoGen' Info system documentation.
5848 File: autogen.info, Node: getdefs Invocation, Next: xml2ag Invocation, Prev: columns Invocation, Up: Add-Ons
5850 8.6 Invoking getdefs
5851 ====================
5853 If no 'input' argument is provided or is set to simply "-", and if
5854 'stdin' is not a 'tty', then the list of input files will be read from
5855 'stdin'. This program extracts AutoGen definitions from a list of
5856 source files. Definitions are delimited by '/*=<entry-type>
5857 <entry-name>\n' and '=*/\n'. From that, this program creates a
5858 definition of the following form:
5860 #line nnn "source-file-name"
5866 1. The ellipsis '...' is filled in by text found between the two
5867 delimiters. Each line of text is stripped of anything before the
5868 first asterisk, then leading asterisks, then any leading or
5869 trailing white space.
5871 2. If what is left starts with what looks like a name followed by a
5872 colon, then it is interpreted as a name followed by a value.
5874 3. If the first character of the value is either a single or double
5875 quote, then you are responsible for quoting the text as it gets
5876 inserted into the output definitions. So, if you want whitespace
5877 at the beginnings of the lines of text, you must do something like
5884 4. If the '<entry-name>' is followed by a comma, the word 'ifdef' (or
5885 'ifndef') and a name 'if_name', then the above entry will be under
5888 /*=group entry_name, ifdef FOO
5889 * attr: attribute value
5892 Will produce the following:
5895 #line nnn "source-file-name"
5898 attr = 'attribute value';
5902 5. If you use of the 'subblock' option, you can specify a nested
5903 value, *Note getdefs subblock::. That is, this text:
5905 * arg: int, this, what-it-is
5907 with the '--subblock=arg=type,name,doc' option would yield:
5909 arg = { type = int; name = this; doc = what-it-is; };
5911 This section was generated by *AutoGen*, using the 'agtexi-cmd'
5912 template and the option descriptions for the 'getdefs' program. This
5913 software is released under the GNU General Public License, version 3 or
5918 * getdefs usage:: getdefs help/usage ('help')
5919 * getdefs def-selection:: def-selection options
5920 * getdefs enumerating:: enumerating options
5921 * getdefs doc-insert:: doc-insert options
5922 * getdefs input-files:: input-files options
5923 * getdefs doc-output:: doc-output options
5924 * getdefs config:: presetting/configuring getdefs
5925 * getdefs exit status:: exit status
5926 * getdefs See Also:: See Also
5929 File: autogen.info, Node: getdefs usage, Next: getdefs def-selection, Up: getdefs Invocation
5931 8.6.1 getdefs help/usage ('help')
5932 ---------------------------------
5934 This is the automatically generated usage text for getdefs.
5936 The text printed is the same whether selected with the 'help' option
5937 ('help') or the 'more-help' option ('more-help'). 'more-help' will
5938 print the usage text by passing it through a pager program. 'more-help'
5939 is disabled on platforms without a working 'fork(2)' function. The
5940 'PAGER' environment variable is used to select the program, defaulting
5941 to 'more'. Both will exit with a status code of 0.
5943 getdefs error: invalid option descriptor for version
5944 getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
5945 Usage: getdefs [ <option-name>[{=| }<val>] ]...
5947 Specify which definitions are of interest and what to say about them:
5949 Arg Option-Name Description
5950 Str defs-to-get Regexp to look for after the "/*="
5951 Str subblock subblock definition names
5952 - may appear multiple times
5953 Str listattr attribute with list of values
5954 - may appear multiple times
5956 specify how to number the definitions:
5958 Arg Option-Name Description
5959 opt ordering Alphabetize or use named file
5960 - disabled as '--no-ordering'
5961 - enabled by default
5962 Num first-index The first index to apply to groups
5964 Definition insertion options:
5966 Arg Option-Name Description
5967 opt filelist Insert source file names into defs
5968 Str assign Global assignments
5969 - may appear multiple times
5970 Str common-assign Assignments common to all blocks
5971 - may appear multiple times
5972 Str copy File(s) to copy into definitions
5973 - may appear multiple times
5974 opt srcfile Insert source file name into each def
5975 opt linenum Insert source line number into each def
5977 specify which files to search for markers:
5979 Arg Option-Name Description
5980 Str input Input file to search for defs
5981 - may appear multiple times
5982 - default option for unnamed options
5984 Definition output disposition options::
5986 Arg Option-Name Description
5987 Str output Output file to open
5988 - an alternate for 'autogen'
5989 opt autogen Invoke AutoGen with defs
5990 - disabled as '--no-autogen'
5991 - enabled by default
5992 Str template Template Name
5993 Str agarg AutoGen Argument
5994 - prohibits the option 'output'
5995 - may appear multiple times
5996 Str base-name Base name for output file(s)
5997 - prohibits the option 'output'
5999 Version, usage and configuration options:
6001 Arg Option-Name Description
6004 File: autogen.info, Node: getdefs def-selection, Next: getdefs enumerating, Prev: getdefs usage, Up: getdefs Invocation
6006 8.6.2 def-selection options
6007 ---------------------------
6009 Specify which definitions are of interest and what to say about them.
6014 This is the "regexp to look for after the "/*="" option. This option
6015 takes a string argument 'reg-ex'. If you want definitions only from a
6016 particular category, or even with names matching particular patterns,
6017 then specify this regular expression for the text that must follow the
6023 This is the "subblock definition names" option. This option takes a
6024 string argument 'sub-def'.
6026 This option has some usage constraints. It:
6027 * may appear an unlimited number of times.
6029 This option is used to create shorthand entries for nested
6030 definitions. For example, with:
6032 '--subblock=arg=argname,type,null'
6033 and defining an 'arg' thus
6035 will then expand to:
6036 'arg = { argname = this; type = "char *"; };'
6037 The "this, char *" string is separated at the commas, with the white
6038 space removed. You may use characters other than commas by starting the
6039 value string with a punctuation character other than a single or double
6040 quote character. You may also omit intermediate values by placing the
6041 commas next to each other with no intervening white space. For example,
6042 "+mumble++yes+" will expand to:
6043 'arg = { argname = mumble; null = "yes"; };'.
6048 This is the "attribute with list of values" option. This option takes a
6049 string argument 'def'.
6051 This option has some usage constraints. It:
6052 * may appear an unlimited number of times.
6054 This option is used to create shorthand entries for definitions that
6055 generally appear several times. That is, they tend to be a list of
6056 values. For example, with:
6057 'listattr=foo' defined, the text:
6058 'foo: this, is, a, multi-list' will then expand to:
6059 'foo = 'this', 'is', 'a', 'multi-list';'
6060 The texts are separated by the commas, with the white space removed.
6061 You may use characters other than commas by starting the value string
6062 with a punctuation character other than a single or double quote
6066 File: autogen.info, Node: getdefs enumerating, Next: getdefs doc-insert, Prev: getdefs def-selection, Up: getdefs Invocation
6068 8.6.3 enumerating options
6069 -------------------------
6071 specify how to number the definitions.
6076 This is the "alphabetize or use named file" option. This option takes
6077 an optional string argument 'file-name'.
6079 This option has some usage constraints. It:
6080 * can be disabled with -no-ordering.
6081 * It is enabled by default.
6083 By default, ordering is alphabetical by the entry name. Use,
6084 'no-ordering' if order is unimportant. Use 'ordering' with no argument
6085 to order without case sensitivity. Use 'ordering=<file-name>' if
6086 chronological order is important. getdefs will maintain the text
6087 content of 'file-name'. 'file-name' need not exist.
6092 This is the "the first index to apply to groups" option. This option
6093 takes a number argument 'first-index'. By default, the first occurrence
6094 of a named definition will have an index of zero. Sometimes, that needs
6095 to be a reserved value. Provide this option to specify a different
6099 File: autogen.info, Node: getdefs doc-insert, Next: getdefs input-files, Prev: getdefs enumerating, Up: getdefs Invocation
6101 8.6.4 doc-insert options
6102 ------------------------
6104 Definition insertion options.
6109 This is the "insert source file names into defs" option. This option
6110 takes an optional string argument 'file'. Inserts the name of each
6111 input file into the output definitions. If no argument is supplied, the
6114 If an argument is supplied, that string will be used for the entry
6115 name instead of INFILE.
6120 This is the "global assignments" option. This option takes a string
6123 This option has some usage constraints. It:
6124 * may appear an unlimited number of times.
6126 The argument to each copy of this option will be inserted into the
6127 output definitions, with only a semicolon attached.
6129 common-assign option.
6130 .....................
6132 This is the "assignments common to all blocks" option. This option
6133 takes a string argument 'ag-def'.
6135 This option has some usage constraints. It:
6136 * may appear an unlimited number of times.
6138 The argument to each copy of this option will be inserted into each
6139 output definition, with only a semicolon attached.
6144 This is the "file(s) to copy into definitions" option. This option
6145 takes a string argument 'file'.
6147 This option has some usage constraints. It:
6148 * may appear an unlimited number of times.
6150 The content of each file named by these options will be inserted into
6151 the output definitions.
6156 This is the "insert source file name into each def" option. This option
6157 takes an optional string argument 'file'. Inserts the name of the input
6158 file where a definition was found into the output definition. If no
6159 argument is supplied, the format will be:
6161 If an argument is supplied, that string will be used for the entry
6162 name instead of SRCFILE.
6167 This is the "insert source line number into each def" option. This
6168 option takes an optional string argument 'def-name'. Inserts the line
6169 number in the input file where a definition was found into the output
6170 definition. If no argument is supplied, the format will be:
6172 If an argument is supplied, that string will be used for the entry
6173 name instead of LINENUM.
6176 File: autogen.info, Node: getdefs input-files, Next: getdefs doc-output, Prev: getdefs doc-insert, Up: getdefs Invocation
6178 8.6.5 input-files options
6179 -------------------------
6181 specify which files to search for markers.
6186 This is the "input file to search for defs" option. This option takes a
6187 string argument 'src-file'.
6189 This option has some usage constraints. It:
6190 * may appear an unlimited number of times.
6192 All files that are to be searched for definitions must be named on
6193 the command line or read from 'stdin'. If there is only one 'input'
6194 option and it is the string, "-", then the input file list is read from
6195 'stdin'. If a command line argument is not an option name and does not
6196 contain an assignment operator ('='), then it defaults to being an input
6197 file name. At least one input file must be specified.
6200 File: autogen.info, Node: getdefs doc-output, Next: getdefs config, Prev: getdefs input-files, Up: getdefs Invocation
6202 8.6.6 doc-output options
6203 ------------------------
6205 Definition output disposition options:.
6210 This is the "output file to open" option. This option takes a string
6213 This option has some usage constraints. It:
6214 * is a member of the autogen class of options.
6216 If you are not sending the output to an AutoGen process, you may name
6217 an output file instead.
6222 This is the "invoke autogen with defs" option. This option takes an
6223 optional string argument 'ag-cmd'.
6225 This option has some usage constraints. It:
6226 * can be disabled with -no-autogen.
6227 * It is enabled by default.
6228 * is a member of the autogen class of options.
6230 This is the default output mode. Specifying 'no-autogen' is
6231 equivalent to 'output=-'. If you supply an argument to this option,
6232 that program will be started as if it were AutoGen and its standard in
6233 will be set to the output definitions of this program.
6238 This is the "template name" option. This option takes a string argument
6239 'file'. Specifies the template name to be used for generating the final
6245 This is the "autogen argument" option. This option takes a string
6248 This option has some usage constraints. It:
6249 * may appear an unlimited number of times.
6250 * must not appear in combination with any of the following options:
6253 This is a pass-through argument. It allows you to specify any
6254 arbitrary argument to be passed to AutoGen.
6259 This is the "base name for output file(s)" option. This option takes a
6260 string argument 'name'.
6262 This option has some usage constraints. It:
6263 * must not appear in combination with any of the following options:
6266 When output is going to AutoGen, a base name must either be supplied
6267 or derived. If this option is not supplied, then it is taken from the
6268 'template' option. If that is not provided either, then it is set to
6269 the base name of the current directory.
6272 File: autogen.info, Node: getdefs config, Next: getdefs exit status, Prev: getdefs doc-output, Up: getdefs Invocation
6274 8.6.7 presetting/configuring getdefs
6275 ------------------------------------
6277 Any option that is not marked as not presettable may be preset by
6278 loading values from configuration ("rc" or "ini") files.
6280 'libopts' will search in '/dev/null' for configuration (option) data.
6281 If this is a plain file, it is simply processed. If it is a directory,
6282 then a file named '.getdefsrc' is searched for within that directory.
6284 Configuration files may be in a wide variety of formats. The basic
6285 format is an option name followed by a value (argument) on the same
6286 line. Values may be separated from the option name with a colon, equal
6287 sign or simply white space. Values may be continued across multiple
6288 lines by escaping the newline with a backslash.
6290 Multiple programs may also share the same initialization file.
6291 Common options are collected at the top, followed by program specific
6292 segments. The segments are separated by lines like:
6296 Do not mix these styles within one configuration file.
6298 Compound values and carefully constructed string values may also be
6299 specified using XML syntax:
6301 <sub-opt>...<...>...</sub-opt>
6303 yielding an 'option-name.sub-opt' string value of
6305 'AutoOpts' does not track suboptions. You simply note that it is a
6306 hierarchicly valued option. 'AutoOpts' does provide a means for
6307 searching the associated name/value pair list (see: optionFindValue).
6309 The command line options relating to configuration and/or usage help
6315 Print the program version to standard out, optionally with licensing
6316 information, then exit 0. The optional argument specifies how much
6317 licensing detail to provide. The default is to print just the version.
6318 The licensing information may be selected with an option argument. Only
6319 the first letter of the argument is examined:
6322 Only print the version. This is the default.
6324 Name the copyright usage licensing terms.
6326 Print the full copyright usage licensing terms.
6329 File: autogen.info, Node: getdefs exit status, Next: getdefs See Also, Prev: getdefs config, Up: getdefs Invocation
6331 8.6.8 getdefs exit status
6332 -------------------------
6334 One of the following exit values will be returned:
6336 Successful program execution.
6338 The operation failed or the command syntax was not valid.
6339 '2 (EXIT_INVALID_INPUT)'
6340 An input file was specified that is not a file
6342 Insufficient memory for operation
6344 A specified configuration file could not be loaded.
6346 libopts had an internal operational error. Please report it to
6347 autogen-users@lists.sourceforge.net. Thank you.
6350 File: autogen.info, Node: getdefs See Also, Prev: getdefs exit status, Up: getdefs Invocation
6352 8.6.9 getdefs See Also
6353 ----------------------
6355 This program is documented more fully in the Getdefs section of the
6356 Add-On chapter in the 'AutoGen' Info system documentation.
6359 File: autogen.info, Node: xml2ag Invocation, Next: snprintfv, Prev: getdefs Invocation, Up: Add-Ons
6364 This program will convert any arbitrary XML file into equivalent AutoGen
6365 definitions, and invoke AutoGen. The template used will be derived from
6367 * The *-override-tpl* command line option
6368 * A top level XML attribute named, "'template'"
6369 One or the other *must* be provided, or the program will exit with a
6372 The _base-name_ for the output will similarly be either:
6373 * The *-base-name* command line option.
6374 * The base name of the '.xml' file.
6376 The definitions derived from XML generally have an extra layer of
6377 definition. Specifically, this XML input:
6381 grumble, grumble, grumble.
6382 </grumble>mumble, mumble
6384 Will get converted into this:
6387 text = 'grumble, grumble, grumble';
6390 text = 'mumble, mumble';
6392 Please notice that some information is lost. AutoGen cannot tell
6393 that "grumble" used to lie between the mumble texts. Also please note
6394 that you cannot assign:
6395 grumble = 'grumble, grumble, grumble.';
6396 because if another "grumble" has an attribute or multiple texts, it
6397 becomes impossible to have the definitions be the same type (compound or
6400 This section was generated by *AutoGen*, using the 'agtexi-cmd'
6401 template and the option descriptions for the 'xml2ag' program. This
6402 software is released under the GNU General Public License, version 3 or
6407 * xml2ag usage:: xml2ag help/usage ('--help')
6408 * xml2ag the-xml2ag-option:: the-xml2ag-option options
6409 * xml2ag autogen-options:: autogen-options options
6410 * xml2ag exit status:: exit status
6413 File: autogen.info, Node: xml2ag usage, Next: xml2ag the-xml2ag-option, Up: xml2ag Invocation
6415 8.7.1 xml2ag help/usage ('--help')
6416 ----------------------------------
6418 This is the automatically generated usage text for xml2ag.
6420 The text printed is the same whether selected with the 'help' option
6421 ('--help') or the 'more-help' option ('--more-help'). 'more-help' will
6422 print the usage text by passing it through a pager program. 'more-help'
6423 is disabled on platforms without a working 'fork(2)' function. The
6424 'PAGER' environment variable is used to select the program, defaulting
6425 to 'more'. Both will exit with a status code of 0.
6427 xml2ag (GNU AutoGen) - XML to AutoGen Definiton Converter - Ver. 5.18.16
6428 Usage: xml2ag [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <def-file> ]
6430 All other options are derived from autogen:
6432 Flg Arg Option-Name Description
6433 -O Str output Output file in lieu of AutoGen processing
6437 Flg Arg Option-Name Description
6438 -L Str templ-dirs Search for templates in DIR
6439 - may appear multiple times
6440 -T Str override-tpl Use TPL-FILE for the template
6441 Str definitions Read definitions from FILE
6442 Str shell name or path name of shell to use
6443 -m no no-fmemopen Do not use in-mem streams
6444 Str equate characters considered equivalent
6445 -b Str base-name Specify NAME as the base name for output
6446 no source-time set mod times to latest source
6447 no writable Allow output files to be writable
6448 - disabled as '--not-writable'
6449 Num loop-limit Limit on increment loops
6450 - is scalable with a suffix: k/K/m/M/g/G/t/T
6451 - it must lie in one of the ranges:
6454 -t Num timeout Limit server shell operations to SECONDS
6455 - it must be in the range:
6457 KWd trace tracing level of detail
6458 Str trace-out tracing output file or filter
6459 no show-defs Show the definition tree
6460 no used-defines Show the definitions used
6461 -C no core Leave a core dump on a failure exit
6462 -s Str skip-suffix Skip the file with this SUFFIX
6463 - prohibits the option 'select-suffix'
6464 - may appear multiple times
6465 -o Str select-suffix specify this output suffix
6466 - may appear multiple times
6467 -D Str define name to add to definition list
6468 - may appear multiple times
6469 -U Str undefine definition list removal pattern
6470 - an alternate for 'define'
6471 -M opt make-dep emit make dependency file
6472 - may appear multiple times
6474 Version, usage and configuration options:
6476 Flg Arg Option-Name Description
6477 -v opt version output version information and exit
6478 -? no help display extended usage information and exit
6479 -! no more-help extended usage information passed thru pager
6481 Options are specified by doubled hyphens and their name or by a single
6482 hyphen and the flag character.
6483 This program will convert any arbitrary XML file into equivalent AutoGen
6484 definitions, and invoke AutoGen.
6486 The valid "trace" option keywords are:
6487 nothing debug-message server-shell templates block-macros
6488 expressions everything
6489 or an integer from 0 through 6
6490 The template will be derived from either: * the ``--override-tpl'' command
6491 line option * a top level XML attribute named, "template"
6493 The ``base-name'' for the output will similarly be either: * the
6494 ``--base-name'' command line option * the base name of the .xml file
6496 Please send bug reports to: <autogen-users@lists.sourceforge.net>
6499 File: autogen.info, Node: xml2ag the-xml2ag-option, Next: xml2ag autogen-options, Prev: xml2ag usage, Up: xml2ag Invocation
6501 8.7.2 the-xml2ag-option options
6502 -------------------------------
6504 All other options are derived from autogen.
6509 This is the "output file in lieu of autogen processing" option. This
6510 option takes a string argument 'file'. By default, the output is handed
6511 to an AutoGen for processing. However, you may save the definitions to
6515 File: autogen.info, Node: xml2ag autogen-options, Next: xml2ag exit status, Prev: xml2ag the-xml2ag-option, Up: xml2ag Invocation
6517 8.7.3 autogen-options options
6518 -----------------------------
6520 All other options. These options are mostly just passed throug to
6521 'autogen'. The one exception is '--override-tpl' which replaces the
6522 default template in the output definitions. It does not get passed
6523 through on the command line.
6525 templ-dirs option (-L).
6526 .......................
6528 This is the "search for templates in 'dir'" option. This option takes a
6529 string argument 'DIR'.
6531 This option has some usage constraints. It:
6532 * may appear an unlimited number of times.
6534 Pass-through AutoGen argument
6536 override-tpl option (-T).
6537 .........................
6539 This is the "use 'tpl-file' for the template" option. This option takes
6540 a string argument 'TPL-FILE'. Pass-through AutoGen argument
6545 This is the "read definitions from 'file'" option. This option takes a
6546 string argument 'FILE'. Pass-through AutoGen argument
6551 This is the "name or path name of shell to use" option. This option
6552 takes a string argument 'shell'. Pass-through AutoGen argument
6554 no-fmemopen option (-m).
6555 ........................
6557 This is the "do not use in-mem streams" option. Pass-through AutoGen
6563 This is the "characters considered equivalent" option. This option
6564 takes a string argument 'char-list'. Pass-through AutoGen argument
6566 base-name option (-b).
6567 ......................
6569 This is the "specify 'name' as the base name for output" option. This
6570 option takes a string argument 'NAME'. Pass-through AutoGen argument
6575 This is the "set mod times to latest source" option. Pass-through
6581 This is the "allow output files to be writable" option.
6583 This option has some usage constraints. It:
6584 * can be disabled with -not-writable.
6586 Pass-through AutoGen argument
6591 This is the "limit on increment loops" option. This option takes a
6592 number argument 'lim'. Pass-through AutoGen argument
6594 timeout option (-t).
6595 ....................
6597 This is the "limit server shell operations to 'seconds'" option. This
6598 option takes a number argument 'SECONDS'. Pass-through AutoGen argument
6603 This is the "tracing level of detail" option. This option takes a
6604 keyword argument 'level'.
6606 This option has some usage constraints. It:
6607 * This option takes a keyword as its argument. The argument sets an
6608 enumeration value that can be tested by comparing the option value
6609 macro (OPT_VALUE_TRACE). The available keywords are:
6610 nothing debug-message server-shell
6611 templates block-macros expressions
6614 or their numeric equivalent.
6616 Pass-through AutoGen argument
6621 This is the "tracing output file or filter" option. This option takes a
6622 string argument 'file'. Pass-through AutoGen argument
6627 This is the "show the definition tree" option. Pass-through AutoGen
6630 used-defines option.
6631 ....................
6633 This is the "show the definitions used" option. Pass-through AutoGen
6639 This is the "leave a core dump on a failure exit" option.
6641 This option has some usage constraints. It:
6642 * must be compiled in by defining 'HAVE_SYS_RESOURCE_H' during the
6645 Many systems default to a zero sized core limit. If the system has
6646 the sys/resource.h header and if this option is supplied, then in the
6647 failure exit path, autogen will attempt to set the soft core limit to
6648 whatever the hard core limit is. If that does not work, then an
6649 administrator must raise the hard core size limit.
6651 skip-suffix option (-s).
6652 ........................
6654 This is the "skip the file with this 'suffix'" option. This option
6655 takes a string argument 'SUFFIX'.
6657 This option has some usage constraints. It:
6658 * may appear an unlimited number of times.
6659 * must not appear in combination with any of the following options:
6662 Pass-through AutoGen argument
6664 select-suffix option (-o).
6665 ..........................
6667 This is the "specify this output suffix" option. This option takes a
6668 string argument 'SUFFIX'.
6670 This option has some usage constraints. It:
6671 * may appear an unlimited number of times.
6673 Pass-through AutoGen argument
6678 This is the "name to add to definition list" option. This option takes
6679 a string argument 'value'.
6681 This option has some usage constraints. It:
6682 * may appear an unlimited number of times.
6684 Pass-through AutoGen argument
6686 undefine option (-U).
6687 .....................
6689 This is the "definition list removal pattern" option. This option takes
6690 a string argument 'name-pat'.
6692 This option has some usage constraints. It:
6693 * may appear an unlimited number of times.
6695 Pass-through AutoGen argument
6697 make-dep option (-M).
6698 .....................
6700 This is the "emit make dependency file" option. This option takes an
6701 optional string argument 'type'.
6703 This option has some usage constraints. It:
6704 * may appear an unlimited number of times.
6706 Pass-through AutoGen argument
6709 File: autogen.info, Node: xml2ag exit status, Prev: xml2ag autogen-options, Up: xml2ag Invocation
6711 8.7.4 xml2ag exit status
6712 ------------------------
6714 One of the following exit values will be returned:
6716 Successful program execution.
6718 The operation failed or the command syntax was not valid.
6721 File: autogen.info, Node: snprintfv, Prev: xml2ag Invocation, Up: Add-Ons
6723 8.8 Replacement for Stdio Formatting Library
6724 ============================================
6726 Using the 'printf' formatting routines in a portable fashion has always
6727 been a pain, and this package has been way more pain than anyone ever
6728 imagined. Hopefully, with this release of snprintfv, the pain is now
6731 The issues with portable usage are these:
6733 1. Argument number specifiers are often either not implemented or are
6734 buggy. Even GNU libc, version 1 got it wrong.
6736 2. ANSI/ISO "forgot" to provide a mechanism for computing argument
6737 lists for vararg procedures.
6739 3. The argument array version of printf ('printfv()') is not generally
6740 available, does not work with the native printf, and does not have
6741 a working argument number specifier in the format specification.
6742 (Last I knew, anyway.)
6744 4. You cannot fake varargs by calling 'vprintf()' with an array of
6745 arguments, because ANSI does not require such an implementation and
6746 some vendors play funny tricks because they are allowed to.
6748 These four issues made it impossible for AutoGen to ship without its
6749 own implementation of the 'printf' formatting routines. Since we were
6750 forced to do this, we decided to make the formatting routines both
6751 better and more complete :-). We addressed these issues and added the
6752 following features to the common printf API:
6754 5. The formatted output can be written to
6756 * a string allocated by the formatting function ('asprintf()').
6757 * a file descriptor instead of a file stream ('dprintf()').
6758 * a user specified stream ('stream_printf()').
6760 6. The formatting functions can be augmented with your own functions.
6761 These functions are allowed to consume more than one character from
6762 the format, but must commence with a unique character. For
6767 might be used with '{' registered to a procedure that would look up
6768 "struct stat" in a symbol table and do appropriate things,
6769 consuming the format string through the '}' character.
6771 Gary V. Vaughan was generous enough to supply this implementation.
6774 For further details, the reader is referred to the snprintfv
6775 documentation. These functions are also available in the template
6776 processing as 'sprintf' (*note SCM sprintf::), 'printf' (*note SCM
6777 printf::), 'fprintf' (*note SCM fprintf::), and 'shellf' (*note SCM
6781 File: autogen.info, Node: Future, Next: Copying This Manual, Prev: Add-Ons, Up: Top
6783 9 Some ideas for the future.
6784 ****************************
6786 Here are some things that might happen in the distant future.
6788 * Fix up current tools that contain miserably complex perl, shell,
6789 sed, awk and m4 scripts to instead use this tool.
6792 File: autogen.info, Node: Copying This Manual, Next: Concept Index, Prev: Future, Up: Top
6794 Appendix A Copying This Manual
6795 ******************************
6797 You may copy this manual under the terms of the FDL (the GNU Free
6798 Documentation License (http://gnu.org/licenses/fdl.texi)).
6801 File: autogen.info, Node: Concept Index, Next: Function Index, Prev: Copying This Manual, Up: Top
6809 * .: naming values. (line 23)
6810 * .def file: Definitions File. (line 6)
6811 * .tpl file: Template File. (line 6)
6812 * Alternate Definition: Alternate Definition.
6814 * assert: Directives. (line 26)
6815 * assert directive: Directives. (line 26)
6816 * Augmenting AutoGen: Augmenting AutoGen. (line 6)
6817 * AutoEvents: AutoEvents. (line 6)
6818 * AutoFSM: AutoFSM. (line 6)
6819 * autogen: autogen Invocation. (line 6)
6820 * AutoGen Definition Extraction Tool: getdefs Invocation. (line 6)
6821 * autogen help: autogen usage. (line 6)
6822 * autogen-base-name: autogen out-handling.
6824 * autogen-core: autogen debug-tpl. (line 138)
6825 * autogen-define: autogen processing. (line 46)
6826 * autogen-definitions: autogen input-select.
6828 * autogen-equate: autogen input-select.
6830 * autogen-loop-limit: autogen debug-tpl. (line 13)
6831 * autogen-make-dep: autogen dep-track. (line 11)
6832 * autogen-no-abort: autogen autoopts-opts.
6834 * autogen-no-fmemopen: autogen input-select.
6836 * autogen-override-tpl: autogen input-select.
6838 * autogen-select-suffix: autogen processing. (line 31)
6839 * autogen-shell: autogen input-select.
6841 * autogen-show-defs: autogen debug-tpl. (line 106)
6842 * autogen-skip-suffix: autogen processing. (line 13)
6843 * autogen-source-time: autogen out-handling.
6845 * autogen-templ-dirs: autogen input-select.
6847 * autogen-timeout: autogen debug-tpl. (line 23)
6848 * autogen-trace: autogen debug-tpl. (line 40)
6849 * autogen-trace-out: autogen debug-tpl. (line 95)
6850 * autogen-undefine: autogen processing. (line 76)
6851 * autogen-used-defines: autogen debug-tpl. (line 120)
6852 * autogen-writable: autogen out-handling.
6854 * AutoInfo: AutoInfo. (line 6)
6855 * AutoMan pages: AutoMan pages. (line 6)
6856 * automatic options: automatic options. (line 6)
6857 * autoopts: AutoOpts. (line 6)
6858 * autoopts <1>: Caveats. (line 34)
6859 * AutoOpts API: AutoOpts API. (line 6)
6860 * autoopts directives: config directives. (line 6)
6861 * AutoXDR: AutoXDR. (line 6)
6862 * backtrack: naming values. (line 24)
6863 * Columnize Input Text: columns Invocation. (line 6)
6864 * columns: columns Invocation. (line 6)
6865 * columns help: columns usage. (line 6)
6866 * columns-by-columns: columns ordering. (line 11)
6867 * columns-col-width: columns dimensions. (line 29)
6868 * columns-columns: columns dimensions. (line 21)
6869 * columns-ending: columns treatment. (line 89)
6870 * columns-fill: columns treatment. (line 20)
6871 * columns-first-indent: columns treatment. (line 42)
6872 * columns-format: columns treatment. (line 67)
6873 * columns-indent: columns treatment. (line 34)
6874 * columns-input: columns input-text. (line 11)
6875 * columns-line-separation: columns treatment. (line 82)
6876 * columns-separation: columns treatment. (line 75)
6877 * columns-sort: columns ordering. (line 19)
6878 * columns-spread: columns treatment. (line 11)
6879 * columns-tab-width: columns dimensions. (line 37)
6880 * columns-width: columns dimensions. (line 11)
6881 * comments: Comments. (line 6)
6882 * Common Option Attributes: Common Attributes. (line 6)
6883 * compound definitions: Definitions. (line 43)
6884 * concat-string: concat-string. (line 6)
6885 * conditional emit: IF. (line 6)
6886 * conditional emit <1>: WHILE. (line 6)
6887 * configuration file: opt-attr no-preset. (line 6)
6888 * configuration file <1>: automatic options. (line 67)
6889 * configuration file <2>: automatic options. (line 83)
6890 * configuration file <3>: Option Processing Data.
6892 * Configuration File: config example. (line 6)
6893 * Configuration File <1>: Config File Format. (line 6)
6894 * configuration file <4>: shell options. (line 6)
6895 * Configuration File example: config example. (line 6)
6896 * configuring: configuring. (line 6)
6897 * define: Directives. (line 41)
6898 * define directive: Directives. (line 41)
6899 * define macro: DEFINE. (line 6)
6900 * Definition Index: Index Assignments. (line 6)
6901 * definitions: Definitions. (line 6)
6902 * definitions file: Definitions File. (line 6)
6903 * design goals: Generalities. (line 11)
6904 * directives: Directives. (line 6)
6905 * diversion: output controls. (line 6)
6906 * documentation attributes: documentation attributes.
6908 * Dynamic Definition Text: Dynamic Text. (line 6)
6909 * elif: Directives. (line 49)
6910 * elif directive: Directives. (line 49)
6911 * else: Directives. (line 53)
6912 * else directive: Directives. (line 53)
6913 * endif: Directives. (line 58)
6914 * endif directive: Directives. (line 58)
6915 * endmac: Directives. (line 62)
6916 * endmac directive: Directives. (line 62)
6917 * endshell: Directives. (line 65)
6918 * endshell directive: Directives. (line 65)
6919 * environrc: environrc. (line 6)
6920 * error: Directives. (line 68)
6921 * error directive: Directives. (line 68)
6922 * example, simple AutoGen: Example Usage. (line 6)
6923 * example, simple AutoOpts: Quick Start. (line 6)
6924 * expression syntax: expression syntax. (line 6)
6925 * features: Features. (line 6)
6926 * finite state machine: AutoFSM. (line 6)
6927 * flags-cant: Option Conflict Attributes.
6929 * flags-must: Option Conflict Attributes.
6931 * fOptState: Option Processing Data.
6933 * for loop: FOR. (line 6)
6934 * futures: Future. (line 6)
6935 * getdefs: getdefs Invocation. (line 6)
6936 * getdefs help: getdefs usage. (line 6)
6937 * getdefs-agarg: getdefs doc-output. (line 46)
6938 * getdefs-assign: getdefs doc-insert. (line 22)
6939 * getdefs-autogen: getdefs doc-output. (line 23)
6940 * getdefs-base-name: getdefs doc-output. (line 60)
6941 * getdefs-common-assign: getdefs doc-insert. (line 34)
6942 * getdefs-copy: getdefs doc-insert. (line 46)
6943 * getdefs-defs-to-get: getdefs def-selection.
6945 * getdefs-filelist: getdefs doc-insert. (line 11)
6946 * getdefs-first-index: getdefs enumerating. (line 27)
6947 * getdefs-input: getdefs input-files. (line 11)
6948 * getdefs-linenum: getdefs doc-insert. (line 69)
6949 * getdefs-listattr: getdefs def-selection.
6951 * getdefs-ordering: getdefs enumerating. (line 11)
6952 * getdefs-output: getdefs doc-output. (line 11)
6953 * getdefs-srcfile: getdefs doc-insert. (line 58)
6954 * getdefs-subblock: getdefs def-selection.
6956 * getdefs-template: getdefs doc-output. (line 39)
6957 * getopt_long: getopt_long. (line 6)
6958 * gnu: Caveats. (line 29)
6959 * here-string: here-string. (line 6)
6960 * ident: Directives. (line 72)
6961 * ident directive: Directives. (line 72)
6962 * identification: Identification. (line 6)
6963 * if: Directives. (line 75)
6964 * if directive: Directives. (line 75)
6965 * if test: IF. (line 6)
6966 * ifdef: Directives. (line 79)
6967 * ifdef directive: Directives. (line 79)
6968 * ifndef: Directives. (line 85)
6969 * ifndef directive: Directives. (line 85)
6970 * immediate action: Immediate Action. (line 6)
6971 * include: Directives. (line 89)
6972 * include directive: Directives. (line 89)
6973 * information attributes: information attributes.
6975 * Installing: installing. (line 6)
6976 * Internationalizing AutoOpts: i18n. (line 6)
6977 * Internationalizing Options: Internationalizing Options.
6979 * Introduction: Introduction. (line 6)
6980 * let: Directives. (line 94)
6981 * let directive: Directives. (line 94)
6982 * library attributes: library attributes. (line 6)
6983 * Licensing: Licensing. (line 6)
6984 * line: Directives. (line 97)
6985 * line directive: Directives. (line 97)
6986 * looping, for: FOR. (line 6)
6987 * m4: Testimonial. (line 41)
6988 * macdef: Directives. (line 104)
6989 * macdef directive: Directives. (line 104)
6990 * macro syntax: AGMacro syntax. (line 6)
6991 * macro, pseudo: Template File. (line 10)
6992 * main procedure: Generated main. (line 6)
6993 * misuse-usage: Caveats. (line 45)
6994 * named option mode: presentation attributes.
6996 * Naming Conflicts: Naming Conflicts. (line 6)
6997 * naming values: naming values. (line 6)
6998 * native macros: native macros. (line 6)
6999 * no-misuse-usage: Caveats. (line 40)
7000 * optActualIndex: Option Processing Data.
7002 * optActualValue: Option Processing Data.
7004 * optIndex: Option Processing Data.
7006 * option: Directives. (line 110)
7007 * Option Argument Handling: Option Argument Handling.
7009 * Option Arguments: Option Arguments. (line 6)
7010 * option attributes: option attributes. (line 6)
7011 * Option Conflict Attributes: Option Conflict Attributes.
7013 * Option Definitions: Option Definitions. (line 6)
7014 * option descriptor: option descriptor. (line 6)
7015 * option directive: Directives. (line 110)
7016 * Option Processing Data: Option Processing Data.
7018 * optOccCt: Option Processing Data.
7020 * optValue: Option Processing Data.
7022 * pragma: Directives. (line 125)
7023 * pragma directive: Directives. (line 125)
7024 * predefines: Predefines. (line 6)
7025 * program attributes: program attributes. (line 6)
7026 * pseudo macro: Template File. (line 10)
7027 * pseudo macro <1>: pseudo macro. (line 6)
7028 * pzLastArg: Option Processing Data.
7030 * pzProgName: Option Processing Data.
7032 * pzProgPath: Option Processing Data.
7034 * rcfile: loading rcfile. (line 6)
7035 * rcfile <1>: config example. (line 6)
7036 * Redirecting Output: output controls. (line 6)
7037 * remote procedure call: AutoXDR. (line 6)
7038 * Required Attributes: Required Attributes. (line 6)
7039 * RPC: AutoXDR. (line 6)
7040 * rpcgen: AutoXDR. (line 6)
7041 * sample rcfile: sample rcfile. (line 6)
7042 * shell: Directives. (line 128)
7043 * shell directive: Directives. (line 128)
7044 * shell options: Presetting Options. (line 6)
7045 * shell options <1>: shell options. (line 6)
7046 * shell-generated string: shell-generated. (line 6)
7047 * Signal Names: signal names. (line 6)
7048 * simple definitions: Definitions. (line 44)
7049 * standard options: standard options. (line 6)
7050 * string, double quote: double-quote-string. (line 6)
7051 * string, shell output: shell-generated. (line 6)
7052 * string, single quote: single-quote-string. (line 6)
7053 * template file: Identification. (line 21)
7054 * template file <1>: Template File. (line 6)
7055 * The Automated Program Generator: autogen Invocation. (line 6)
7056 * undef: Directives. (line 136)
7057 * undef directive: Directives. (line 136)
7058 * using AutoOpts: Using AutoOpts. (line 6)
7059 * while test: WHILE. (line 6)
7060 * XDR: AutoXDR. (line 6)
7061 * XML to AutoGen Definiton Converter: xml2ag Invocation. (line 6)
7062 * xml2ag: xml2ag Invocation. (line 6)
7063 * xml2ag help: xml2ag usage. (line 6)
7064 * xml2ag-base-name: xml2ag autogen-options.
7066 * xml2ag-core: xml2ag autogen-options.
7068 * xml2ag-define: xml2ag autogen-options.
7070 * xml2ag-definitions: xml2ag autogen-options.
7072 * xml2ag-equate: xml2ag autogen-options.
7074 * xml2ag-loop-limit: xml2ag autogen-options.
7076 * xml2ag-make-dep: xml2ag autogen-options.
7078 * xml2ag-no-fmemopen: xml2ag autogen-options.
7080 * xml2ag-output: xml2ag the-xml2ag-option.
7082 * xml2ag-override-tpl: xml2ag autogen-options.
7084 * xml2ag-select-suffix: xml2ag autogen-options.
7086 * xml2ag-shell: xml2ag autogen-options.
7088 * xml2ag-show-defs: xml2ag autogen-options.
7090 * xml2ag-skip-suffix: xml2ag autogen-options.
7092 * xml2ag-source-time: xml2ag autogen-options.
7094 * xml2ag-templ-dirs: xml2ag autogen-options.
7096 * xml2ag-timeout: xml2ag autogen-options.
7098 * xml2ag-trace: xml2ag autogen-options.
7100 * xml2ag-trace-out: xml2ag autogen-options.
7102 * xml2ag-undefine: xml2ag autogen-options.
7104 * xml2ag-used-defines: xml2ag autogen-options.
7106 * xml2ag-writable: xml2ag autogen-options.
7110 File: autogen.info, Node: Function Index, Prev: Concept Index, Up: Top
7118 * *=: SCM *=. (line 6)
7119 * *=*: SCM *=*. (line 6)
7120 * *==: SCM *==. (line 6)
7121 * *==*: SCM *==*. (line 6)
7122 * *~: SCM *~. (line 6)
7123 * *~*: SCM *~*. (line 6)
7124 * *~~: SCM *~~. (line 6)
7125 * *~~*: SCM *~~*. (line 6)
7126 * =: SCM =. (line 6)
7127 * =*: SCM =*. (line 6)
7128 * ==: SCM ==. (line 6)
7129 * ==*: SCM ==*. (line 6)
7130 * ~: SCM ~. (line 6)
7131 * ~*: SCM ~*. (line 6)
7132 * ~~: SCM ~~. (line 6)
7133 * ~~*: SCM ~~*. (line 6)
7134 * ag-fprintf: SCM ag-fprintf. (line 6)
7135 * ag-function?: SCM ag-function?. (line 6)
7136 * agpl: SCM agpl. (line 6)
7137 * ao_string_tokenize: libopts-ao_string_tokenize.
7139 * autogen-version: SCM autogen-version. (line 6)
7140 * base-name: SCM base-name. (line 6)
7141 * BREAK: BREAK. (line 6)
7142 * bsd: SCM bsd. (line 6)
7143 * c-file-line-fmt: SCM c-file-line-fmt. (line 6)
7144 * c-string: SCM c-string. (line 6)
7145 * CASE: CASE. (line 6)
7146 * chdir: SCM chdir. (line 6)
7147 * CLEAR_OPT: CLEAR_OPT. (line 6)
7148 * COMMENT: COMMENT. (line 6)
7149 * configFileLoad: libopts-configFileLoad.
7151 * CONTINUE: CONTINUE. (line 6)
7152 * count: SCM count. (line 6)
7153 * COUNT_OPT: COUNT_OPT. (line 6)
7154 * DEBUG: DEBUG. (line 6)
7155 * def-file: SCM def-file. (line 6)
7156 * def-file-line: SCM def-file-line. (line 6)
7157 * DEFINE: DEFINE. (line 6)
7158 * DESC: DESC. (line 6)
7159 * DISABLE_OPT_name: DISABLE_OPT_name. (line 6)
7160 * dne: SCM dne. (line 6)
7161 * ELIF: ELIF. (line 6)
7162 * ELSE: ELSE. (line 6)
7163 * emit: SCM emit. (line 6)
7164 * emit-string-table: SCM emit-string-table. (line 6)
7165 * ENABLED_OPT: ENABLED_OPT. (line 6)
7166 * ENDDEF: ENDDEF. (line 6)
7167 * ENDFOR: ENDFOR. (line 6)
7168 * ENDIF: ENDIF. (line 6)
7169 * ENDWHILE: ENDWHILE. (line 6)
7170 * error: SCM error. (line 6)
7171 * error-source-line: SCM error-source-line. (line 6)
7172 * ERRSKIP_OPTERR: ERRSKIP_OPTERR. (line 6)
7173 * ERRSTOP_OPTERR: ERRSTOP_OPTERR. (line 6)
7174 * ESAC: ESAC. (line 6)
7175 * exist?: SCM exist?. (line 6)
7176 * EXPR: EXPR. (line 6)
7177 * extract: SCM extract. (line 6)
7178 * find-file: SCM find-file. (line 6)
7179 * first-for?: SCM first-for?. (line 6)
7180 * FOR: FOR. (line 6)
7181 * for-by: SCM for-by. (line 6)
7182 * for-from: SCM for-from. (line 6)
7183 * for-index: SCM for-index. (line 6)
7184 * for-sep: SCM for-sep. (line 6)
7185 * for-to: SCM for-to. (line 6)
7186 * format-arg-count: SCM format-arg-count. (line 6)
7187 * found-for?: SCM found-for?. (line 6)
7188 * fprintf: SCM fprintf. (line 6)
7189 * get: SCM get. (line 6)
7190 * get-c-name: SCM get-c-name. (line 6)
7191 * get-down-name: SCM get-down-name. (line 6)
7192 * get-up-name: SCM get-up-name. (line 6)
7193 * gperf: SCM gperf. (line 6)
7194 * gperf-code: SCM gperf-code. (line 6)
7195 * gpl: SCM gpl. (line 6)
7196 * HAVE_OPT: HAVE_OPT. (line 6)
7197 * hide-email: SCM hide-email. (line 6)
7198 * high-lim: SCM high-lim. (line 6)
7199 * html-escape-encode: SCM html-escape-encode.
7202 * in?: SCM in?. (line 6)
7203 * INCLUDE: INCLUDE. (line 6)
7204 * insert-file: SCM insert-file. (line 6)
7205 * insert-suspended: SCM insert-suspended. (line 6)
7206 * INVOKE: INVOKE. (line 6)
7207 * ISSEL_OPT: ISSEL_OPT. (line 6)
7208 * ISUNUSED_OPT: ISUNUSED_OPT. (line 6)
7209 * join: SCM join. (line 6)
7210 * kr-string: SCM kr-string. (line 6)
7211 * last-for?: SCM last-for?. (line 6)
7212 * len: SCM len. (line 6)
7213 * lgpl: SCM lgpl. (line 6)
7214 * license: SCM license. (line 6)
7215 * license-description: SCM license-description.
7217 * license-full: SCM license-full. (line 6)
7218 * license-info: SCM license-info. (line 6)
7219 * license-name: SCM license-name. (line 6)
7220 * low-lim: SCM low-lim. (line 6)
7221 * make-gperf: SCM make-gperf. (line 6)
7222 * make-header-guard: SCM make-header-guard. (line 6)
7223 * make-tmp-dir: SCM make-tmp-dir. (line 6)
7224 * makefile-script: SCM makefile-script. (line 6)
7225 * match-value?: SCM match-value?. (line 6)
7226 * max: SCM max. (line 6)
7227 * max-file-time: SCM max-file-time. (line 6)
7228 * min: SCM min. (line 6)
7229 * mk-gettextable: SCM mk-gettextable. (line 6)
7230 * optionFileLoad: libopts-optionFileLoad.
7232 * optionFindNextValue: libopts-optionFindNextValue.
7234 * optionFindValue: libopts-optionFindValue.
7236 * optionFree: libopts-optionFree. (line 6)
7237 * optionGetValue: libopts-optionGetValue.
7239 * optionLoadLine: libopts-optionLoadLine.
7241 * optionMemberList: libopts-optionMemberList.
7243 * optionNextValue: libopts-optionNextValue.
7245 * optionOnlyUsage: libopts-optionOnlyUsage.
7247 * optionPrintVersion: libopts-optionPrintVersion.
7249 * optionPrintVersionAndReturn: libopts-optionPrintVersionAndReturn.
7251 * optionProcess: libopts-optionProcess. (line 6)
7252 * optionRestore: libopts-optionRestore. (line 6)
7253 * optionSaveFile: libopts-optionSaveFile.
7255 * optionSaveState: libopts-optionSaveState.
7257 * optionUnloadNested: libopts-optionUnloadNested.
7259 * optionVersion: libopts-optionVersion. (line 6)
7260 * OPTION_CT: OPTION_CT. (line 6)
7261 * OPT_ARG: OPT_ARG. (line 6)
7262 * OPT_NO_XLAT_CFG_NAMES: OPT_NO_XLAT_CFG_NAMES. (line 6)
7263 * OPT_NO_XLAT_OPT_NAMES: OPT_NO_XLAT_OPT_NAMES. (line 6)
7264 * OPT_VALUE_name: OPT_VALUE_name. (line 6)
7265 * OPT_XLAT_CFG_NAMES: OPT_XLAT_CFG_NAMES. (line 6)
7266 * OPT_XLAT_OPT_NAMES: OPT_XLAT_OPT_NAMES. (line 6)
7267 * out-delete: SCM out-delete. (line 6)
7268 * out-depth: SCM out-depth. (line 6)
7269 * out-emit-suspended: SCM out-emit-suspended.
7271 * out-line: SCM out-line. (line 6)
7272 * out-move: SCM out-move. (line 6)
7273 * out-name: SCM out-name. (line 6)
7274 * out-pop: SCM out-pop. (line 6)
7275 * out-push-add: SCM out-push-add. (line 6)
7276 * out-push-new: SCM out-push-new. (line 6)
7277 * out-resume: SCM out-resume. (line 6)
7278 * out-suspend: SCM out-suspend. (line 6)
7279 * out-switch: SCM out-switch. (line 6)
7280 * output-file-next-line: SCM output-file-next-line.
7282 * prefix: SCM prefix. (line 6)
7283 * printf: SCM printf. (line 6)
7284 * raw-shell-str: SCM raw-shell-str. (line 6)
7285 * RESTART_OPT: RESTART_OPT. (line 6)
7286 * RETURN: RETURN. (line 6)
7287 * SELECT: SELECT. (line 6)
7288 * set-option: SCM set-option. (line 6)
7289 * set-writable: SCM set-writable. (line 6)
7290 * SET_OPT_name: SET_OPT_name. (line 6)
7291 * shell: SCM shell. (line 6)
7292 * shell-str: SCM shell-str. (line 6)
7293 * shellf: SCM shellf. (line 6)
7294 * sprintf: SCM sprintf. (line 6)
7295 * stack: SCM stack. (line 6)
7296 * stack-join: SCM stack-join. (line 6)
7297 * STACKCT_OPT: STACKCT_OPT. (line 6)
7298 * STACKLST_OPT: STACKLST_OPT. (line 6)
7299 * START_OPT: START_OPT. (line 6)
7300 * STATE_OPT: STATE_OPT. (line 6)
7301 * strequate: libopts-strequate. (line 6)
7302 * streqvcmp: libopts-streqvcmp. (line 6)
7303 * streqvmap: libopts-streqvmap. (line 6)
7304 * string->c-name!: SCM string->c-name!. (line 6)
7305 * string->camelcase: SCM string->camelcase. (line 6)
7306 * string-capitalize: SCM string-capitalize. (line 6)
7307 * string-capitalize!: SCM string-capitalize!.
7309 * string-contains-eqv?: SCM *=*. (line 6)
7310 * string-contains?: SCM *==*. (line 6)
7311 * string-downcase: SCM string-downcase. (line 6)
7312 * string-downcase!: SCM string-downcase!. (line 6)
7313 * string-end-eqv-match?: SCM *~. (line 6)
7314 * string-end-match?: SCM *~~. (line 6)
7315 * string-ends-eqv?: SCM *=. (line 6)
7316 * string-ends-with?: SCM *==. (line 6)
7317 * string-equals?: SCM ==. (line 6)
7318 * string-eqv-match?: SCM ~. (line 6)
7319 * string-eqv?: SCM =. (line 6)
7320 * string-has-eqv-match?: SCM *~*. (line 6)
7321 * string-has-match?: SCM *~~*. (line 6)
7322 * string-match?: SCM ~~. (line 6)
7323 * string-start-eqv-match?: SCM ~*. (line 6)
7324 * string-start-match?: SCM ~~*. (line 6)
7325 * string-starts-eqv?: SCM =*. (line 6)
7326 * string-starts-with?: SCM ==*. (line 6)
7327 * string-substitute: SCM string-substitute. (line 6)
7328 * string-table-add: SCM string-table-add. (line 6)
7329 * string-table-add-ref: SCM string-table-add-ref.
7331 * string-table-new: SCM string-table-new. (line 6)
7332 * string-table-size: SCM string-table-size. (line 6)
7333 * string-tr: SCM string-tr. (line 6)
7334 * string-tr!: SCM string-tr!. (line 6)
7335 * string-upcase: SCM string-upcase. (line 6)
7336 * string-upcase!: SCM string-upcase!. (line 6)
7337 * strneqvcmp: libopts-strneqvcmp. (line 6)
7338 * strtransform: libopts-strtransform. (line 6)
7339 * sub-shell-str: SCM sub-shell-str. (line 6)
7340 * suffix: SCM suffix. (line 6)
7341 * sum: SCM sum. (line 6)
7342 * teOptIndex: teOptIndex. (line 6)
7343 * time-string->number: SCM time-string->number.
7345 * tpl-file: SCM tpl-file. (line 6)
7346 * tpl-file-line: SCM tpl-file-line. (line 6)
7347 * tpl-file-next-line: SCM tpl-file-next-line.
7349 * UNKNOWN: UNKNOWN. (line 6)
7350 * USAGE: USAGE. (line 6)
7351 * VALUE_OPT_name: VALUE_OPT_name. (line 6)
7352 * VERSION: VERSION. (line 6)
7353 * version-compare: SCM version-compare. (line 6)
7354 * warn: SCM warn. (line 6)
7355 * WHICH_IDX_name: WHICH_IDX_name. (line 6)
7356 * WHICH_OPT_name: WHICH_OPT_name. (line 6)
7357 * WHILE: WHILE. (line 6)