]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Added support for "octal integer", which is just printed as octal.
authorTimo Sirainen <tss@iki.fi>
Tue, 19 Jan 2010 12:39:24 +0000 (14:39 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 19 Jan 2010 12:39:24 +0000 (14:39 +0200)
--HG--
branch : HEAD

src/config/config-request.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index 739c9c0bc7e190f111fc329a1e1ad9a78d083000..e6019074db161c5d0d74779d8e0c8eaff71d83c8 100644 (file)
@@ -137,10 +137,19 @@ settings_export(struct settings_export_context *ctx,
                        break;
                }
                case SET_UINT:
+               case SET_UINT_OCT:
                case SET_TIME: {
                        const unsigned int *val = value, *dval = default_value;
-                       if (dump_default || dval == NULL || *val != *dval)
-                               str_printfa(ctx->value, "%u", *val);
+                       if (dump_default || dval == NULL || *val != *dval) {
+                               switch (def->type) {
+                               case SET_UINT_OCT:
+                                       str_printfa(ctx->value, "0%o", *val);
+                                       break;
+                               default:
+                                       str_printfa(ctx->value, "%u", *val);
+                                       break;
+                               }
+                       }
                        break;
                }
                case SET_STR_VARS: {
index 8676de05fd8b14a43be05e241706daee9efeba53..111ed5651dd6c3acf3adff19eca8b9850216a2b6 100644 (file)
@@ -551,6 +551,7 @@ settings_parse(struct setting_parser_context *ctx, struct setting_link *link,
                        return -1;
                break;
        case SET_UINT:
+       case SET_UINT_OCT:
                if (get_uint(ctx, value, (unsigned int *)ptr) < 0)
                        return -1;
                break;
@@ -1023,6 +1024,7 @@ settings_var_expand_info(const struct setting_parser_info *info,
                switch (def->type) {
                case SET_BOOL:
                case SET_UINT:
+               case SET_UINT_OCT:
                case SET_TIME:
                case SET_SIZE:
                case SET_STR:
@@ -1095,6 +1097,7 @@ bool settings_vars_have_key(const struct setting_parser_info *info, void *set,
                switch (def->type) {
                case SET_BOOL:
                case SET_UINT:
+               case SET_UINT_OCT:
                case SET_TIME:
                case SET_SIZE:
                case SET_STR:
@@ -1166,6 +1169,7 @@ setting_copy(enum setting_type type, const void *src, void *dest, pool_t pool)
                break;
        }
        case SET_UINT:
+       case SET_UINT_OCT:
        case SET_TIME: {
                const unsigned int *src_uint = src;
                unsigned int *dest_uint = dest;
@@ -1276,6 +1280,7 @@ settings_changes_dup(const struct setting_parser_info *info,
                switch (def->type) {
                case SET_BOOL:
                case SET_UINT:
+               case SET_UINT_OCT:
                case SET_TIME:
                case SET_SIZE:
                case SET_STR_VARS:
index f83764c8e96e292f7e297f30ca522af73c75a8f7..7369ba402a0c6af09446ea4298312d2c9ffabc5a 100644 (file)
@@ -19,6 +19,7 @@ struct var_expand_table;
 enum setting_type {
        SET_BOOL,
        SET_UINT,
+       SET_UINT_OCT,
        SET_TIME,
        SET_SIZE,
        SET_STR,