defines.cfg

The define config file specifies a set of logical "defines"--preprocessor conditional switches for including or excluding sections of the configuration files.  You use these defines together with the '#ifdef <define>' preprocessor directive to customize your PIKT configurations according to certain conditions--those you specify directly, or conditions based on the current system or network state.

A define stanza takes the form

<define>      TRUE|true|YES|yes|ON|on|1|FALSE|false|NO|no|OFF|off|0|
              [<proc>]
where the TRUE, FALSE, etc. can follow on the same line or on a subsequent indented line.

You may also set a define according to the exit status (TRUE or FALSE) of any process, for example

dst     // TRUE if Daylight Savings Time now applies, FALSE otherwise
        // at our site, `date +%Z` returns "CDT" if DST is in effect,
        // "CST" otherwise; use your own time zone string as needed
        [test `date +%Z` = "CDT"]
Observe that you can set/unset defines on a per-machine basis in the defines.cfg file, for example
#if dbserver
paranoid     TRUE
#else
paranoid     FALSE
#endif
Or, alternatively and equivalently,
paranoid
#if dbserver
             TRUE
#else
             FALSE
#endif
You may use #ifdef, #ifndef, and #setdef in defines.cfg just so long as the referenced define is specified earlier in defines.cfg.  For example, you may do this:
attentive       TRUE    // the lowest security level

cautious                // the second security level
#  if misscritsys | cssys
                TRUE
#  else
                FALSE
#  endif

worried                 // the third security level
#if misscritsys
                TRUE
#else
                FALSE
#endif

paranoid        FALSE   // the fourth, and highest, security level

#ifdef cautious
#  setdef attentive = TRUE      // or:  #define attentive
#endifdef

#ifdef worried
#  setdef attentive = TRUE
#  setdef cautious = TRUE
#endifdef

#ifdef paranoid
#  setdef attentive = TRUE
#  setdef cautious = TRUE
#  setdef worried = TRUE
#endifdef
This code ensures that if you are in a certain security state, all lower security levels are also set to TRUE.  (If you are paranoid, you are guaranteed also worried, cautious, and attentive.)

Refer to the sample defines.cfg for examples.

prev page 1st page next page
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software | DevNotes | Licensing | Authors | Pikt-Users | Pikt-Workers | Links | SiteIndex | ContactUs
Page best viewed at 1024x768.   Page last updated 2006-09-10.   This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.   Copyright © 1998-2006 Robert Osterlund.  All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title