ead57376e6880f16a734d3d11f4d0595448e0fbd
tdreszer
  Tue Nov 2 14:43:28 2010 -0700
Added a couple of useful macros for boolean settings
diff --git src/inc/common.h src/inc/common.h
index 448e211..e987229 100644
--- src/inc/common.h
+++ src/inc/common.h
@@ -1323,16 +1323,22 @@
 /* debugging function to run the pstack program on the current process. In
  * prints a message, following by a new line, and then the stack track.  Just
  * prints errors to stderr rather than aborts. For debugging purposes
  * only.  */
 
 void dumpStack(char *format, ...)
 /* debugging function to run the pstack program on the current process. In
  * prints a message, following by a new line, and then the stack track.  Just
  * prints errors to stderr rather than aborts. For debugging purposes
  * only.  */
 #if defined(__GNUC__)
 __attribute__((format(printf, 1, 2)))
 #endif
 ;
 
+// SETTING_ON set of macros are frequently used comparisons of string values for boolean questions.
+// Notice the subtle difference between NOT_ON and IS_OFF.  NOT_ON could be NULL but IS_OFF must be explicitly set
+#define SETTING_IS_ON(setting)    (setting && (sameWord(setting,"on") || sameWord(setting,"true") || sameWord(setting,"enabled") || atoi(setting) != 0))
+#define SETTING_NOT_ON(setting)   (!SETTING_IS_ON(setting))
+#define SETTING_IS_OFF(setting)   (setting && (sameWord(setting,"off") || sameWord(setting,"false") || sameWord(setting,"disabled") || atoi(setting) == 0))
+
 #endif /* COMMON_H */