add support for includes
[project/firewall3.git] / options.c
index 9870e91..3f8c977 100644 (file)
--- a/options.c
+++ b/options.c
@@ -672,6 +672,19 @@ fw3_parse_monthdays(void *ptr, const char *val)
        return true;
 }
 
        return true;
 }
 
+bool
+fw3_parse_include_type(void *ptr, const char *val)
+{
+       if (!strcmp(val, "script"))
+               *((enum fw3_include_type *)ptr) = FW3_INC_TYPE_SCRIPT;
+       else if (!strcmp(val, "restore"))
+               *((enum fw3_include_type *)ptr) = FW3_INC_TYPE_RESTORE;
+       else
+               return false;
+
+       return true;
+}
+
 
 void
 fw3_parse_options(void *s, const struct fw3_option *opts,
 
 void
 fw3_parse_options(void *s, const struct fw3_option *opts,
@@ -1014,7 +1027,7 @@ fw3_format_time(struct fw3_time *time)
 
        if (time->monthdays & 0xFFFFFFFE)
        {
 
        if (time->monthdays & 0xFFFFFFFE)
        {
-               fw3_pr(" %s--monthdays", (time->monthdays & 1) ? "! " : "");
+               fw3_pr(" %s--monthdays", hasbit(time->monthdays, 0) ? "! " : "");
 
                for (i = 1, first = true; i < 32; i++)
                {
 
                for (i = 1, first = true; i < 32; i++)
                {
@@ -1028,7 +1041,7 @@ fw3_format_time(struct fw3_time *time)
 
        if (time->weekdays & 0xFE)
        {
 
        if (time->weekdays & 0xFE)
        {
-               fw3_pr(" %s--weekdays", (time->weekdays & 1) ? "! " : "");
+               fw3_pr(" %s--weekdays", hasbit(time->weekdays, 0) ? "! " : "");
 
                for (i = 1, first = true; i < 8; i++)
                {
 
                for (i = 1, first = true; i < 8; i++)
                {