Next: , Previous: , Up: Option Attributes   [Contents][Index]


7.5.5.2 Common Option Attributes

These option attributes are optional. Any that do appear in the definition of a flag, may appear only once.

value

The flag character to specify for traditional option flags, e.g., -L.

max

Maximum occurrence count (invalid if disable present). The default maximum is 1. NOLIMIT can be used for the value, otherwise it must be a number or a #define that evaluates to a number.

min

Minimum occurrence count. If present, then the option must appear on the command line. Do not define it with the value zero (0).

must-set

If an option must be specified, but it need not be specified on the command line, then specify this attribute for the option.

deprecated

There are two effects to this attribute: the usage text will not show the option, and the generated documentation will mark it with: NOTE: THIS OPTION IS DEPRECATED.

disable

Prefix for disabling (inverting sense of) the option. Only useful if long option names are being processed. When an option has this attribute, the test ENABLED_OPT(OPTNAME) is false when either of the following is true:

  • The option has not been specified and the enable attribute has not been specified.
  • The option has been specified with this disabling prefix.

To detect that the option has been specified with the disabling prefix, you must use:

HAVE_OPT(OPTNAME) && ! ENABLED_OPT(OPTNAME)
enable

Long-name prefix for enabling the option (invalid if disable not present). Only useful if long option names are being processed.

enabled

If default is for option being enabled. (Otherwise, the OPTST_DISABLED bit is set at compile time.) Only useful if the option can be disabled.

ifdef
ifndef
omitted-usage

If an option is relevant on certain platforms or when certain features are enabled or disabled, you can specify the compile time flag used to indicate when the option should be compiled in or out. For example, if you have a configurable feature, mumble that is indicated with the compile time define, WITH_MUMBLING, then add:

ifdef = WITH_MUMBLING;

Take care when using these. There are several caveats:

  • The case and spelling must match whatever is specified.
  • Do not confuse these attributes with the AutoGen directives of the same names, See Controlling What Gets Processed. These cause C preprocessing directives to be inserted into the generated C text.
  • Only one of ifdef and ifndef may apply to any one option.
  • The VALUE_OPT_ values are #define-d. If WITH_MUMBLING is not defined, then the associated VALUE_OPT_ value will not be #define-d either. So, if you have an option named, MUMBLING that is active only if WITH_MUMBLING is #define-d, then VALUE_OPT_MUMBLING will be #define-d iff WITH_MUMBLING is #define-d. Watch those switch statements.
  • If you specify omitted-usage, then the option will be recognized as disabled when it is configured out of the build, but will yield the message, “This option has been disabled.” You may specify an alternate message by giving omitted-usage a string value. e.g.:
    omitted-usage = 'you cannot do this';
    
no-command

This option specifies that the option is not allowed on the command line. Such an option may not take a value (flag character) attribute. The program must have the homerc (see Program Description Attributes) option set.


Next: Immediate Action Attributes, Previous: Required Attributes, Up: Option Attributes   [Contents][Index]