[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.1.3 Programming Details

These attributes affect some of the ways that the option data are made available to the program.

config-header

The contents of this attribute should be just the name of the configuration file. A "#include" naming this file will be inserted at the top of the generated header.

exit-name
exit-desc

These values should be defined as indexed values, thus:

 
exit-name[0] = success;
exit-desc[0] = 'Successful program execution.';
exit-name[1] = failure;
exit-desc[1] = 'The operation failed or command syntax was not valid.';

By default, all programs have these effectively defined for them. They may be overridden by explicitly defining any or all of these values. Additional names and descriptions may be defined. They will cause an enumeration to be emitted, like this one for getdefs:

 
typedef enum {
    GETDEFS_EXIT_SUCCESS = 0,
    GETDEFS_EXIT_FAILURE = 1
} getdefs_exit_code_t;

which will be augmented by any exit-name definitions beyond “1”.

export

This string is inserted into the .h interface file. Generally used for global variables or #include directives required by flag-code text and shared with other program text. Do not specify your configuration header (‘config.h’) in this attribute or the include attribute, however. Instead, use config-header, above.n.

guard-option-names

AutoOpts generates macros that presume that there are no cpp macros with the same name as the option name. For example, if you have an option named, debug, then you must not use #ifdef DEBUG in your code. If you specify this attribute, every option name will be guarded. If the name is #define-d, then a warning will be issued and the name undefined. If you do not specify this and there is a conflict, you will get strange error messages.

This attribute may be set to any of four recognized states:

include

This string is inserted into the .c file. Generally used for global variables required only by flag-code program text.

no-libopts

If you are going to handle your option processing with the getopt.tpl template instead of using libopts, then specify this attribute. It will suppress mention of --more-help in the generated documentation. (getopt_long does not support --more-help.)

prefix

This value is inserted into all global names. This will disambiguate them if more than one set of options are to be compiled into a single program.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on February 17, 2011 using texi2html 1.82.

Viewable With Any Browser   autogen Home