Next: , Previous: , Up: Programmatic Interface   [Contents][Index]


7.6.24 STATE_OPT( <NAME> ) - Option State

If you need to know if an option was set because of presetting actions (configuration file processing or environment variables), versus a command line entry versus one of the SET/DISABLE macros, then use this macro. It will yield one of four values: OPTST_INIT, OPTST_SET, OPTST_PRESET or OPTST_DEFINED. It is used thus:

switch (STATE_OPT( NAME )) {
    case OPTST_INIT:
        not-preset, set or on the command line.  (unless CLEAR-ed)

    case OPTST_SET:
        option set via the SET_OPT_NAME() macro.

    case OPTST_PRESET:
        option set via an configuration file or environment variable

    case OPTST_DEFINED:
        option set via a command line option.

    default:
        cannot happen :)
}