]> granicus.if.org Git - fcron/commitdiff
new default system : we use a macro set_default_opt instead of changing
authorthib <thib>
Sat, 21 Apr 2001 08:56:28 +0000 (08:56 +0000)
committerthib <thib>
Sat, 21 Apr 2001 08:56:28 +0000 (08:56 +0000)
the meaning of a set/unset bit

option.h

index b62279fb07854b606eb96c214c8e0304feba14a7..d3b8a7501a54a507fadc57186aab360c49ab4ad1 100644 (file)
--- a/option.h
+++ b/option.h
@@ -21,7 +21,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: option.h,v 1.16 2001-02-01 20:53:11 thib Exp $ */
+ /* $Id: option.h,v 1.17 2001-04-21 08:56:28 thib Exp $ */
 
 /* This has been inspired from bitstring(3) : here is the original copyright :
  */
  *
  */
 
+
 /* read and set options of a line */
 
+/* WARNING : do not change any option number, nor remove any option, nor change
+ *           the meaning of a value (i.e. bit set to 1 -> true).
+ *           It can lead to errors with fcrontabs save to disk/load in memory.
+ */
+
 /*
   
   The options are :
@@ -81,8 +87,6 @@
 
 */
 
-/* default value corresponds to a bit value of 0 */
-
 #ifndef __OPTIONH__
 #define __OPTIONH__
 
 
 /* external macros */
 
+/* default value generally corresponds to a bit value of 0 : if you want to
+ * change the default value of an option, do it by modifying the following
+ * macro (set to 1 the needed bits) */
+#define set_default_opt(opt)  \
+       { \
+          if ( SERIAL_ONCE >= 1 ) clear_serial_sev(opt); \
+          if ( LAVG_ONCE == 0 ) set_lavg_sev(opt); \
+       }
+
+
 /*
   bit 0 : set to 1 : line is based on system up time
           set to 0 : line is based on time and date
        (_bit_clear(opt, 10))
 
 
-#if ( SERIAL_ONCE == 1 )
-/*
-  bit 11 : set to 1 : can be put several times in serial queue simultaneously
-           set to 0 : can only be put once in serial queue simultaneously
-*/
-#define        is_serial_sev(opt) \
-       (_bit_test(opt, 11))
-#define        set_serial_sev(opt) \
-       (_bit_set(opt, 11))
-#define clear_serial_sev(opt) \
-       (_bit_clear(opt, 11))
-#else
 /*
   bit 11 : set to 1 : can only be put once in serial queue simultaneously
            set to 0 : can be put several times in serial queue simultaneously
        (_bit_clear(opt, 11))
 #define clear_serial_sev(opt) \
        (_bit_set(opt, 11))
-#endif /* SERIAL_ONCE == 0 */
 
 
-#if ( LAVG_ONCE == 1 )
 /*
-  bit 12 : set to 1 : can be put several times in lavg queue simultaneously
-           set to 0 : can only be put once in lavg queue simultaneously
+  bit 12 : set to 1 : can only be put once in lavg queue simultaneously
+           set to 0 : can be put several times in lavg queue simultaneously
 */
 #define        is_lavg_sev(opt) \
        (_bit_test(opt, 12))
        (_bit_set(opt, 12))
 #define clear_lavg_sev(opt) \
        (_bit_clear(opt, 12))
-#else
-/*
-  bit 12 : set to 1 : can only be put once in lavg queue simultaneously
-           set to 0 : can be put several times in lavg queue simultaneously
-*/
-#define        is_lavg_sev(opt) \
-       ( ! _bit_test(opt, 12))
-#define        set_lavg_sev(opt) \
-       (_bit_clear(opt, 12))
-#define clear_lavg_sev(opt) \
-       (_bit_set(opt, 12))
-#endif /* LAVG_ONCE == 0 */
 
 
 /*