Use mu_c_type_t throughout the code. Get rid of mu_cfg_param_data_type.
* include/mailutils/cfg.h (mu_cfg_param_data_type): Remove. (mu_cfg_param_type): New enum. (mu_cfg_param) <type>: Change type to int. (mu_cfg_cidr): Remove. (mu_cfg_parse_boolean): Remove. All uses updated. * include/mailutils/util.h (mu_c_void): New constant. (mu_c_type_str): New extern/ * libmailutils/string/str_to_c.c (mu_c_type_str): New global. * libmailutils/cfg/format.c (mu_cfg_data_type_string): Rename to mu_c_type_string; change argument type. All uses updated. * libmailutils/cfg/parser.y: Use mu_str_to_c for value conversion. * libmailutils/tests/.gitignore: Update. * libmailutils/tests/Makefile.am: Add strtoc.at; build strtoc * libmailutils/tests/strtoc.at: New file. * libmailutils/tests/strtoc.c: New file. * libmailutils/tests/testsuite.at: Include strtoc.at * comsat/comsat.c: Use mu_c_type_t types. * dotlock/dotlock.c: Likewise. * imap4d/imap4d.c: Likewise. * lib/manlock.c: Likewise. * lib/tcpwrap.c: Likewise. * libmailutils/server/msrv.c: Likewise. * libmu_argp/muinit.c: Likewise. * libmu_cfg/common.c: Likewise. * libmu_cfg/gsasl.c: Likewise. * libmu_cfg/ldap.c: Likewise. * libmu_cfg/pam.c: Likewise. * libmu_cfg/radius.c: Likewise. * libmu_cfg/sieve.c: Likewise. * libmu_cfg/sql.c: Likewise. * libmu_cfg/tls.c: Likewise. * libmu_cfg/virtdomain.c: Likewise. * maidag/maidag.c: Likewise. * mimeview/mimeview.c: Likewise. * movemail/movemail.c: Likewise. * pop3d/pop3d.c: Likewise. * readmsg/readmsg.c: Likewise. * sieve/sieve.c: Likewise.
Showing
32 changed files
with
570 additions
and
188 deletions
... | @@ -128,7 +128,7 @@ biffrc_error_ctl (mu_config_value_t *val, int flag) | ... | @@ -128,7 +128,7 @@ biffrc_error_ctl (mu_config_value_t *val, int flag) |
128 | 128 | ||
129 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | 129 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) |
130 | return 1; | 130 | return 1; |
131 | if (mu_cfg_parse_boolean (val->v.string, &res)) | 131 | if (mu_str_to_c (val->v.string, mu_c_bool, &res, NULL)) |
132 | mu_diag_output (MU_LOG_ERROR, _("not a boolean")); | 132 | mu_diag_output (MU_LOG_ERROR, _("not a boolean")); |
133 | else if (res) | 133 | else if (res) |
134 | biffrc_errors |= flag; | 134 | biffrc_errors |= flag; |
... | @@ -150,9 +150,9 @@ cb_biffrc_errors_to_err (void *data, mu_config_value_t *val) | ... | @@ -150,9 +150,9 @@ cb_biffrc_errors_to_err (void *data, mu_config_value_t *val) |
150 | } | 150 | } |
151 | 151 | ||
152 | struct mu_cfg_param comsat_cfg_param[] = { | 152 | struct mu_cfg_param comsat_cfg_param[] = { |
153 | { "allow-biffrc", mu_cfg_bool, &allow_biffrc, 0, NULL, | 153 | { "allow-biffrc", mu_c_bool, &allow_biffrc, 0, NULL, |
154 | N_("Read .biffrc file from the user home directory.") }, | 154 | N_("Read .biffrc file from the user home directory.") }, |
155 | { "require-tty", mu_cfg_bool, &require_tty, 0, NULL, | 155 | { "require-tty", mu_c_bool, &require_tty, 0, NULL, |
156 | N_("Notify only if the user is logged on one of the ttys.") }, | 156 | N_("Notify only if the user is logged on one of the ttys.") }, |
157 | { "biffrc-errors-to-tty", mu_cfg_callback, NULL, 0, cb_biffrc_errors_to_tty, | 157 | { "biffrc-errors-to-tty", mu_cfg_callback, NULL, 0, cb_biffrc_errors_to_tty, |
158 | N_("Send biffrc errors to user's tty."), | 158 | N_("Send biffrc errors to user's tty."), |
... | @@ -160,17 +160,17 @@ struct mu_cfg_param comsat_cfg_param[] = { | ... | @@ -160,17 +160,17 @@ struct mu_cfg_param comsat_cfg_param[] = { |
160 | { "biffrc-errors-to-err", mu_cfg_callback, NULL, 0, cb_biffrc_errors_to_err, | 160 | { "biffrc-errors-to-err", mu_cfg_callback, NULL, 0, cb_biffrc_errors_to_err, |
161 | N_("Send biffrc errors to Mailutils error output."), | 161 | N_("Send biffrc errors to Mailutils error output."), |
162 | N_("arg: bool") }, | 162 | N_("arg: bool") }, |
163 | { "max-lines", mu_cfg_int, &maxlines, 0, NULL, | 163 | { "max-lines", mu_c_int, &maxlines, 0, NULL, |
164 | N_("Maximum number of message body lines to be output.") }, | 164 | N_("Maximum number of message body lines to be output.") }, |
165 | { "max-requests", mu_cfg_uint, &maxrequests, 0, NULL, | 165 | { "max-requests", mu_c_uint, &maxrequests, 0, NULL, |
166 | N_("Maximum number of incoming requests per request control interval.") }, | 166 | N_("Maximum number of incoming requests per request control interval.") }, |
167 | { "request-control-interval", mu_cfg_time, &request_control_interval, | 167 | { "request-control-interval", mu_c_time, &request_control_interval, |
168 | 0, NULL, | 168 | 0, NULL, |
169 | N_("Set control interval.") }, | 169 | N_("Set control interval.") }, |
170 | { "overflow-control-interval", mu_cfg_time, &overflow_control_interval, | 170 | { "overflow-control-interval", mu_c_time, &overflow_control_interval, |
171 | 0, NULL, | 171 | 0, NULL, |
172 | N_("Set overflow control interval.") }, | 172 | N_("Set overflow control interval.") }, |
173 | { "overflow-delay-time", mu_cfg_time, &overflow_delay_time, | 173 | { "overflow-delay-time", mu_c_time, &overflow_delay_time, |
174 | 0, NULL, | 174 | 0, NULL, |
175 | N_("Time to sleep after the first overflow occurs.") }, | 175 | N_("Time to sleep after the first overflow occurs.") }, |
176 | { ".server", mu_cfg_section, NULL, 0, NULL, | 176 | { ".server", mu_cfg_section, NULL, 0, NULL, | ... | ... |
... | @@ -122,11 +122,11 @@ parse_opt (int key, char *arg, struct argp_state *state) | ... | @@ -122,11 +122,11 @@ parse_opt (int key, char *arg, struct argp_state *state) |
122 | 122 | ||
123 | 123 | ||
124 | struct mu_cfg_param dotlock_cfg_param[] = { | 124 | struct mu_cfg_param dotlock_cfg_param[] = { |
125 | { "force", mu_cfg_time, &force, 0, NULL, | 125 | { "force", mu_c_time, &force, 0, NULL, |
126 | N_("Forcibly break an existing lock older than the specified time.") }, | 126 | N_("Forcibly break an existing lock older than the specified time.") }, |
127 | { "retry", mu_cfg_int, &retries, 0, NULL, | 127 | { "retry", mu_c_int, &retries, 0, NULL, |
128 | N_("Number of times to retry acquiring the lock.") }, | 128 | N_("Number of times to retry acquiring the lock.") }, |
129 | { "debug", mu_cfg_bool, &debug, 0, NULL, | 129 | { "debug", mu_c_bool, &debug, 0, NULL, |
130 | N_("Print details of failure reasons to stderr.") }, | 130 | N_("Print details of failure reasons to stderr.") }, |
131 | { NULL } | 131 | { NULL } |
132 | }; | 132 | }; | ... | ... |
... | @@ -321,7 +321,7 @@ cb_tls_required (void *data, mu_config_value_t *val) | ... | @@ -321,7 +321,7 @@ cb_tls_required (void *data, mu_config_value_t *val) |
321 | 321 | ||
322 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | 322 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) |
323 | return 1; | 323 | return 1; |
324 | if (mu_cfg_parse_boolean (val->v.string, &bv)) | 324 | if (mu_str_to_c (val->v.string, mu_c_bool, &bv, NULL)) |
325 | mu_error (_("Not a boolean value")); | 325 | mu_error (_("Not a boolean value")); |
326 | else if (bv) | 326 | else if (bv) |
327 | { | 327 | { |
... | @@ -384,28 +384,28 @@ static struct mu_cfg_param imap4d_srv_param[] = { | ... | @@ -384,28 +384,28 @@ static struct mu_cfg_param imap4d_srv_param[] = { |
384 | }; | 384 | }; |
385 | 385 | ||
386 | static struct mu_cfg_param imap4d_cfg_param[] = { | 386 | static struct mu_cfg_param imap4d_cfg_param[] = { |
387 | { "allow-users", MU_CFG_LIST_OF(mu_cfg_string), &auth_allow_user_list, | 387 | { "allow-users", MU_CFG_LIST_OF(mu_c_string), &auth_allow_user_list, |
388 | 0, NULL, | 388 | 0, NULL, |
389 | N_("Allow access to users from this list.") }, | 389 | N_("Allow access to users from this list.") }, |
390 | { "deny-users", MU_CFG_LIST_OF(mu_cfg_string), &auth_deny_user_list, | 390 | { "deny-users", MU_CFG_LIST_OF(mu_c_string), &auth_deny_user_list, |
391 | 0, NULL, | 391 | 0, NULL, |
392 | N_("Deny access to users from this list.") }, | 392 | N_("Deny access to users from this list.") }, |
393 | { "allow-groups", MU_CFG_LIST_OF(mu_cfg_string), &auth_allow_group_list, | 393 | { "allow-groups", MU_CFG_LIST_OF(mu_c_string), &auth_allow_group_list, |
394 | 0, NULL, | 394 | 0, NULL, |
395 | N_("Allow access if the user group is in this list.") }, | 395 | N_("Allow access if the user group is in this list.") }, |
396 | { "deny-groups", MU_CFG_LIST_OF(mu_cfg_string), &auth_deny_group_list, | 396 | { "deny-groups", MU_CFG_LIST_OF(mu_c_string), &auth_deny_group_list, |
397 | 0, NULL, | 397 | 0, NULL, |
398 | N_("Deny access if the user group is in this list.") }, | 398 | N_("Deny access if the user group is in this list.") }, |
399 | 399 | ||
400 | { "homedir", mu_cfg_string, &modify_homedir, 0, NULL, | 400 | { "homedir", mu_c_string, &modify_homedir, 0, NULL, |
401 | N_("Modify home directory.") }, | 401 | N_("Modify home directory.") }, |
402 | { "personal-namespace", MU_CFG_LIST_OF(mu_cfg_string), &namespace[NS_PRIVATE], | 402 | { "personal-namespace", MU_CFG_LIST_OF(mu_c_string), &namespace[NS_PRIVATE], |
403 | 0, NULL, | 403 | 0, NULL, |
404 | N_("Set personal namespace.") }, | 404 | N_("Set personal namespace.") }, |
405 | { "other-namespace", MU_CFG_LIST_OF(mu_cfg_string), &namespace[NS_OTHER], | 405 | { "other-namespace", MU_CFG_LIST_OF(mu_c_string), &namespace[NS_OTHER], |
406 | 0, NULL, | 406 | 0, NULL, |
407 | N_("Set other users' namespace.") }, | 407 | N_("Set other users' namespace.") }, |
408 | { "shared-namespace", MU_CFG_LIST_OF(mu_cfg_string), &namespace[NS_SHARED], | 408 | { "shared-namespace", MU_CFG_LIST_OF(mu_c_string), &namespace[NS_SHARED], |
409 | 0, NULL, | 409 | 0, NULL, |
410 | N_("Set shared namespace.") }, | 410 | N_("Set shared namespace.") }, |
411 | { "other-mailbox-mode", mu_cfg_callback, &mailbox_mode[NS_OTHER], 0, | 411 | { "other-mailbox-mode", mu_cfg_callback, &mailbox_mode[NS_OTHER], 0, |
... | @@ -414,9 +414,9 @@ static struct mu_cfg_param imap4d_cfg_param[] = { | ... | @@ -414,9 +414,9 @@ static struct mu_cfg_param imap4d_cfg_param[] = { |
414 | { "shared-mailbox-mode", mu_cfg_callback, &mailbox_mode[NS_SHARED], 0, | 414 | { "shared-mailbox-mode", mu_cfg_callback, &mailbox_mode[NS_SHARED], 0, |
415 | cb_mailbox_mode, | 415 | cb_mailbox_mode, |
416 | N_("File mode for mailboxes in shared namespace.") }, | 416 | N_("File mode for mailboxes in shared namespace.") }, |
417 | { "login-disabled", mu_cfg_bool, &login_disabled, 0, NULL, | 417 | { "login-disabled", mu_c_bool, &login_disabled, 0, NULL, |
418 | N_("Disable LOGIN command.") }, | 418 | N_("Disable LOGIN command.") }, |
419 | { "create-home-dir", mu_cfg_bool, &create_home_dir, 0, NULL, | 419 | { "create-home-dir", mu_c_bool, &create_home_dir, 0, NULL, |
420 | N_("If true, create non-existing user home directories.") }, | 420 | N_("If true, create non-existing user home directories.") }, |
421 | { "home-dir-mode", mu_cfg_callback, NULL, 0, cb_mode, | 421 | { "home-dir-mode", mu_cfg_callback, NULL, 0, cb_mode, |
422 | N_("File mode for creating user home directories (octal)."), | 422 | N_("File mode for creating user home directories (octal)."), |
... | @@ -437,19 +437,19 @@ static struct mu_cfg_param imap4d_cfg_param[] = { | ... | @@ -437,19 +437,19 @@ static struct mu_cfg_param imap4d_cfg_param[] = { |
437 | " ident[://:<port: string-or-number>]\n" | 437 | " ident[://:<port: string-or-number>]\n" |
438 | " stdio"), | 438 | " stdio"), |
439 | N_("mode") }, | 439 | N_("mode") }, |
440 | { "preauth-only", mu_cfg_bool, &preauth_only, 0, NULL, | 440 | { "preauth-only", mu_c_bool, &preauth_only, 0, NULL, |
441 | N_("Use only preauth mode. If unable to setup it, disconnect " | 441 | N_("Use only preauth mode. If unable to setup it, disconnect " |
442 | "immediately.") }, | 442 | "immediately.") }, |
443 | { "ident-keyfile", mu_cfg_string, &ident_keyfile, 0, NULL, | 443 | { "ident-keyfile", mu_c_string, &ident_keyfile, 0, NULL, |
444 | N_("Name of DES keyfile for decoding encrypted ident responses.") }, | 444 | N_("Name of DES keyfile for decoding encrypted ident responses.") }, |
445 | { "ident-encrypt-only", mu_cfg_bool, &ident_encrypt_only, 0, NULL, | 445 | { "ident-encrypt-only", mu_c_bool, &ident_encrypt_only, 0, NULL, |
446 | N_("Use only encrypted ident responses.") }, | 446 | N_("Use only encrypted ident responses.") }, |
447 | { "id-fields", MU_CFG_LIST_OF(mu_cfg_string), &imap4d_id_list, 0, NULL, | 447 | { "id-fields", MU_CFG_LIST_OF(mu_c_string), &imap4d_id_list, 0, NULL, |
448 | N_("List of fields to return in response to ID command.") }, | 448 | N_("List of fields to return in response to ID command.") }, |
449 | { "mandatory-locking", mu_cfg_section }, | 449 | { "mandatory-locking", mu_cfg_section }, |
450 | { ".server", mu_cfg_section, NULL, 0, NULL, | 450 | { ".server", mu_cfg_section, NULL, 0, NULL, |
451 | N_("Server configuration.") }, | 451 | N_("Server configuration.") }, |
452 | { "transcript", mu_cfg_bool, &imap4d_transcript, 0, NULL, | 452 | { "transcript", mu_c_bool, &imap4d_transcript, 0, NULL, |
453 | N_("Set global transcript mode.") }, | 453 | N_("Set global transcript mode.") }, |
454 | TCP_WRAPPERS_CONFIG | 454 | TCP_WRAPPERS_CONFIG |
455 | { NULL } | 455 | { NULL } | ... | ... |
... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
22 | #include <mailutils/list.h> | 22 | #include <mailutils/list.h> |
23 | #include <mailutils/debug.h> | 23 | #include <mailutils/debug.h> |
24 | #include <mailutils/opool.h> | 24 | #include <mailutils/opool.h> |
25 | #include <mailutils/util.h> | ||
25 | #include <sys/socket.h> | 26 | #include <sys/socket.h> |
26 | #include <netinet/in.h> | 27 | #include <netinet/in.h> |
27 | #include <arpa/inet.h> | 28 | #include <arpa/inet.h> |
... | @@ -113,27 +114,6 @@ void mu_cfg_destroy_tree (mu_cfg_tree_t **tree); | ... | @@ -113,27 +114,6 @@ void mu_cfg_destroy_tree (mu_cfg_tree_t **tree); |
113 | int mu_cfg_preorder (mu_list_t nodelist, struct mu_cfg_iter_closure *); | 114 | int mu_cfg_preorder (mu_list_t nodelist, struct mu_cfg_iter_closure *); |
114 | 115 | ||
115 | 116 | ||
116 | /* Table-driven parsing */ | ||
117 | enum mu_cfg_param_data_type | ||
118 | { | ||
119 | mu_cfg_string, | ||
120 | mu_cfg_short, | ||
121 | mu_cfg_ushort, | ||
122 | mu_cfg_int, | ||
123 | mu_cfg_uint, | ||
124 | mu_cfg_long, | ||
125 | mu_cfg_ulong, | ||
126 | mu_cfg_size, | ||
127 | mu_cfg_off, | ||
128 | mu_cfg_time, | ||
129 | mu_cfg_bool, | ||
130 | mu_cfg_ipv4, | ||
131 | mu_cfg_cidr, | ||
132 | mu_cfg_host, | ||
133 | mu_cfg_callback, | ||
134 | mu_cfg_section | ||
135 | }; | ||
136 | |||
137 | #define MU_CFG_LIST_MASK 0x8000 | 117 | #define MU_CFG_LIST_MASK 0x8000 |
138 | #define MU_CFG_LIST_OF(t) ((t) | MU_CFG_LIST_MASK) | 118 | #define MU_CFG_LIST_OF(t) ((t) | MU_CFG_LIST_MASK) |
139 | #define MU_CFG_TYPE(t) ((t) & ~MU_CFG_LIST_MASK) | 119 | #define MU_CFG_TYPE(t) ((t) & ~MU_CFG_LIST_MASK) |
... | @@ -141,10 +121,16 @@ enum mu_cfg_param_data_type | ... | @@ -141,10 +121,16 @@ enum mu_cfg_param_data_type |
141 | 121 | ||
142 | typedef int (*mu_cfg_callback_t) (void *, mu_config_value_t *); | 122 | typedef int (*mu_cfg_callback_t) (void *, mu_config_value_t *); |
143 | 123 | ||
124 | enum mu_cfg_param_type | ||
125 | { | ||
126 | mu_cfg_section = mu_c_void + 1, | ||
127 | mu_cfg_callback | ||
128 | }; | ||
129 | |||
144 | struct mu_cfg_param | 130 | struct mu_cfg_param |
145 | { | 131 | { |
146 | const char *ident; | 132 | const char *ident; |
147 | enum mu_cfg_param_data_type type; | 133 | int type; /* One of enum mu_c_type or mu_cfg_param_type values */ |
148 | void *data; | 134 | void *data; |
149 | size_t offset; | 135 | size_t offset; |
150 | mu_cfg_callback_t callback; | 136 | mu_cfg_callback_t callback; |
... | @@ -197,14 +183,6 @@ struct mu_cfg_cont | ... | @@ -197,14 +183,6 @@ struct mu_cfg_cont |
197 | } v; | 183 | } v; |
198 | }; | 184 | }; |
199 | 185 | ||
200 | typedef struct mu_cfg_cidr mu_cfg_cidr_t; | ||
201 | |||
202 | struct mu_cfg_cidr | ||
203 | { | ||
204 | struct in_addr addr; | ||
205 | unsigned long mask; | ||
206 | }; | ||
207 | |||
208 | #define MU_CFG_PATH_DELIM '.' | 186 | #define MU_CFG_PATH_DELIM '.' |
209 | #define MU_CFG_PATH_DELIM_STR "." | 187 | #define MU_CFG_PATH_DELIM_STR "." |
210 | 188 | ||
... | @@ -271,8 +249,6 @@ int mu_parse_config (const char *file, const char *progname, | ... | @@ -271,8 +249,6 @@ int mu_parse_config (const char *file, const char *progname, |
271 | struct mu_cfg_param *progparam, int flags, | 249 | struct mu_cfg_param *progparam, int flags, |
272 | void *target_ptr) MU_CFG_DEPRECATED; | 250 | void *target_ptr) MU_CFG_DEPRECATED; |
273 | 251 | ||
274 | int mu_cfg_parse_boolean (const char *str, int *res); | ||
275 | |||
276 | extern int mu_cfg_parser_verbose; | 252 | extern int mu_cfg_parser_verbose; |
277 | extern size_t mu_cfg_error_count; | 253 | extern size_t mu_cfg_error_count; |
278 | 254 | ... | ... |
... | @@ -173,10 +173,11 @@ enum mu_c_type | ... | @@ -173,10 +173,11 @@ enum mu_c_type |
173 | mu_c_host, | 173 | mu_c_host, |
174 | mu_c_incr, /* C int value, incremented each time mu_str_to_c is | 174 | mu_c_incr, /* C int value, incremented each time mu_str_to_c is |
175 | invoked */ | 175 | invoked */ |
176 | mu_c_void /* No type. Keep it the last */ | ||
176 | }; | 177 | }; |
177 | 178 | ||
178 | typedef enum mu_c_type mu_c_type_t; | 179 | typedef enum mu_c_type mu_c_type_t; |
179 | 180 | extern char const *mu_c_type_str[]; | |
180 | int mu_str_to_c (char const *string, mu_c_type_t type, void *tgt, | 181 | int mu_str_to_c (char const *string, mu_c_type_t type, void *tgt, |
181 | char **errmsg); | 182 | char **errmsg); |
182 | 183 | ... | ... |
... | @@ -185,9 +185,9 @@ manlock_open_mailbox (mu_mailbox_t *pmbox, const char *mailbox_name, int def, | ... | @@ -185,9 +185,9 @@ manlock_open_mailbox (mu_mailbox_t *pmbox, const char *mailbox_name, int def, |
185 | 185 | ||
186 | 186 | ||
187 | struct mu_cfg_param manlock_param[] = { | 187 | struct mu_cfg_param manlock_param[] = { |
188 | { "enable", mu_cfg_bool, &manlock_mandatory_locking, 0, NULL, | 188 | { "enable", mu_c_bool, &manlock_mandatory_locking, 0, NULL, |
189 | N_("Enable mandatory locking.") }, | 189 | N_("Enable mandatory locking.") }, |
190 | { "lock-directory", mu_cfg_string, &manlock_lock_dir, 0, NULL, | 190 | { "lock-directory", mu_c_string, &manlock_lock_dir, 0, NULL, |
191 | N_("Set directory for mandatory lock files.") }, | 191 | N_("Set directory for mandatory lock files.") }, |
192 | { NULL } | 192 | { NULL } |
193 | }; | 193 | }; | ... | ... |
... | @@ -53,17 +53,17 @@ mu_tcpwrapper_access (int fd) | ... | @@ -53,17 +53,17 @@ mu_tcpwrapper_access (int fd) |
53 | } | 53 | } |
54 | 54 | ||
55 | struct mu_cfg_param tcpwrapper_param[] = { | 55 | struct mu_cfg_param tcpwrapper_param[] = { |
56 | { "enable", mu_cfg_bool, &mu_tcp_wrapper_enable, 0, NULL, | 56 | { "enable", mu_c_bool, &mu_tcp_wrapper_enable, 0, NULL, |
57 | N_("Enable TCP wrapper access control. Default is \"yes\".") }, | 57 | N_("Enable TCP wrapper access control. Default is \"yes\".") }, |
58 | { "daemon", mu_cfg_string, &mu_tcp_wrapper_daemon, 0, NULL, | 58 | { "daemon", mu_c_string, &mu_tcp_wrapper_daemon, 0, NULL, |
59 | N_("Set daemon name for TCP wrapper lookups. Default is program name."), | 59 | N_("Set daemon name for TCP wrapper lookups. Default is program name."), |
60 | N_("name") }, | 60 | N_("name") }, |
61 | { "allow-table", mu_cfg_string, &hosts_allow_table, | 61 | { "allow-table", mu_c_string, &hosts_allow_table, |
62 | 0, NULL, | 62 | 0, NULL, |
63 | N_("Use file for positive client address access control " | 63 | N_("Use file for positive client address access control " |
64 | "(default: /etc/hosts.allow)."), | 64 | "(default: /etc/hosts.allow)."), |
65 | N_("file") }, | 65 | N_("file") }, |
66 | { "deny-table", mu_cfg_string, &hosts_deny_table, | 66 | { "deny-table", mu_c_string, &hosts_deny_table, |
67 | 0, NULL, | 67 | 0, NULL, |
68 | N_("Use file for negative client address access control " | 68 | N_("Use file for negative client address access control " |
69 | "(default: /etc/hosts.deny)."), | 69 | "(default: /etc/hosts.deny)."), | ... | ... |
... | @@ -263,35 +263,38 @@ mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node, int flags) | ... | @@ -263,35 +263,38 @@ mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node, int flags) |
263 | 263 | ||
264 | 264 | ||
265 | const char * | 265 | const char * |
266 | mu_cfg_data_type_string (enum mu_cfg_param_data_type type) | 266 | mu_c_type_string (int type) |
267 | { | 267 | { |
268 | switch (type) | 268 | switch (type) |
269 | { | 269 | { |
270 | case mu_cfg_string: | 270 | case mu_c_string: |
271 | return N_("string"); | 271 | return N_("string"); |
272 | case mu_cfg_short: | 272 | case mu_c_short: |
273 | case mu_cfg_ushort: | 273 | case mu_c_ushort: |
274 | case mu_cfg_int: | 274 | case mu_c_int: |
275 | case mu_cfg_uint: | 275 | case mu_c_uint: |
276 | case mu_cfg_long: | 276 | case mu_c_long: |
277 | case mu_cfg_ulong: | 277 | case mu_c_ulong: |
278 | case mu_cfg_size: | 278 | case mu_c_size: |
279 | case mu_cfg_off: | 279 | case mu_c_off: |
280 | case mu_c_incr: | ||
280 | return N_("number"); | 281 | return N_("number"); |
281 | case mu_cfg_time: | 282 | case mu_c_time: |
282 | return N_("time"); | 283 | return N_("time"); |
283 | case mu_cfg_bool: | 284 | case mu_c_bool: |
284 | return N_("boolean"); | 285 | return N_("boolean"); |
285 | case mu_cfg_ipv4: | 286 | case mu_c_ipv4: |
286 | return N_("ipv4"); | 287 | return N_("ipv4"); |
287 | case mu_cfg_cidr: | 288 | case mu_c_cidr: |
288 | return N_("cidr"); | 289 | return N_("cidr"); |
289 | case mu_cfg_host: | 290 | case mu_c_host: |
290 | return N_("host"); | 291 | return N_("host"); |
291 | case mu_cfg_callback: | ||
292 | return N_("string"); | ||
293 | case mu_cfg_section: | 292 | case mu_cfg_section: |
294 | return N_("section"); | 293 | return N_("section"); |
294 | case mu_cfg_callback: | ||
295 | return N_("callback"); | ||
296 | default: | ||
297 | break; | ||
295 | } | 298 | } |
296 | return N_("unknown"); | 299 | return N_("unknown"); |
297 | } | 300 | } |
... | @@ -361,13 +364,13 @@ format_param (mu_stream_t stream, struct mu_cfg_param *param, int level) | ... | @@ -361,13 +364,13 @@ format_param (mu_stream_t stream, struct mu_cfg_param *param, int level) |
361 | param->ident, | 364 | param->ident, |
362 | gettext (param->argname ? | 365 | gettext (param->argname ? |
363 | param->argname : N_("arg")), | 366 | param->argname : N_("arg")), |
364 | gettext (mu_cfg_data_type_string (MU_CFG_TYPE (param->type)))); | 367 | gettext (mu_c_type_string (MU_CFG_TYPE (param->type)))); |
365 | else | 368 | else |
366 | mu_stream_printf (stream, "%s <%s: %s>;\n", | 369 | mu_stream_printf (stream, "%s <%s: %s>;\n", |
367 | param->ident, | 370 | param->ident, |
368 | gettext (param->argname ? | 371 | gettext (param->argname ? |
369 | param->argname : N_("arg")), | 372 | param->argname : N_("arg")), |
370 | gettext (mu_cfg_data_type_string (param->type))); | 373 | gettext (mu_c_type_string (param->type))); |
371 | } | 374 | } |
372 | 375 | ||
373 | static void format_container (mu_stream_t stream, struct mu_cfg_cont *cont, | 376 | static void format_container (mu_stream_t stream, struct mu_cfg_cont *cont, | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -890,24 +890,24 @@ _cb_port (void *data, mu_config_value_t *val) | ... | @@ -890,24 +890,24 @@ _cb_port (void *data, mu_config_value_t *val) |
890 | } | 890 | } |
891 | 891 | ||
892 | static struct mu_cfg_param dot_server_cfg_param[] = { | 892 | static struct mu_cfg_param dot_server_cfg_param[] = { |
893 | { "max-children", mu_cfg_size, | 893 | { "max-children", mu_c_size, |
894 | NULL, mu_offsetof (struct _mu_m_server,max_children), NULL, | 894 | NULL, mu_offsetof (struct _mu_m_server,max_children), NULL, |
895 | N_("Maximum number of children processes to run simultaneously.") }, | 895 | N_("Maximum number of children processes to run simultaneously.") }, |
896 | { "mode", mu_cfg_callback, | 896 | { "mode", mu_cfg_callback, |
897 | NULL, mu_offsetof (struct _mu_m_server,mode), _cb_daemon_mode, | 897 | NULL, mu_offsetof (struct _mu_m_server,mode), _cb_daemon_mode, |
898 | N_("Set daemon mode (either inetd (or interactive) or daemon)."), | 898 | N_("Set daemon mode (either inetd (or interactive) or daemon)."), |
899 | N_("mode") }, | 899 | N_("mode") }, |
900 | { "foreground", mu_cfg_bool, | 900 | { "foreground", mu_c_bool, |
901 | NULL, mu_offsetof (struct _mu_m_server, foreground), NULL, | 901 | NULL, mu_offsetof (struct _mu_m_server, foreground), NULL, |
902 | N_("Run in foreground.") }, | 902 | N_("Run in foreground.") }, |
903 | { "pidfile", mu_cfg_string, | 903 | { "pidfile", mu_c_string, |
904 | NULL, mu_offsetof (struct _mu_m_server,pidfile), NULL, | 904 | NULL, mu_offsetof (struct _mu_m_server,pidfile), NULL, |
905 | N_("Store PID of the master process in this file."), | 905 | N_("Store PID of the master process in this file."), |
906 | N_("file") }, | 906 | N_("file") }, |
907 | { "port", mu_cfg_callback, | 907 | { "port", mu_cfg_callback, |
908 | NULL, mu_offsetof (struct _mu_m_server, hints), _cb_port, | 908 | NULL, mu_offsetof (struct _mu_m_server, hints), _cb_port, |
909 | N_("Default port number.") }, | 909 | N_("Default port number.") }, |
910 | { "timeout", mu_cfg_time, | 910 | { "timeout", mu_c_time, |
911 | NULL, mu_offsetof (struct _mu_m_server,timeout), NULL, | 911 | NULL, mu_offsetof (struct _mu_m_server,timeout), NULL, |
912 | N_("Set idle timeout.") }, | 912 | N_("Set idle timeout.") }, |
913 | { "server", mu_cfg_section, NULL, 0, NULL, | 913 | { "server", mu_cfg_section, NULL, 0, NULL, |
... | @@ -918,13 +918,13 @@ static struct mu_cfg_param dot_server_cfg_param[] = { | ... | @@ -918,13 +918,13 @@ static struct mu_cfg_param dot_server_cfg_param[] = { |
918 | }; | 918 | }; |
919 | 919 | ||
920 | static struct mu_cfg_param server_cfg_param[] = { | 920 | static struct mu_cfg_param server_cfg_param[] = { |
921 | { "single-process", mu_cfg_bool, | 921 | { "single-process", mu_c_bool, |
922 | NULL, mu_offsetof (struct mu_srv_config, single_process), NULL, | 922 | NULL, mu_offsetof (struct mu_srv_config, single_process), NULL, |
923 | N_("Do not spawn sub-process to handle requests in this server.") }, | 923 | N_("Do not spawn sub-process to handle requests in this server.") }, |
924 | { "transcript", mu_cfg_bool, | 924 | { "transcript", mu_c_bool, |
925 | NULL, mu_offsetof (struct mu_srv_config, transcript), NULL, | 925 | NULL, mu_offsetof (struct mu_srv_config, transcript), NULL, |
926 | N_("Log the session transcript.") }, | 926 | N_("Log the session transcript.") }, |
927 | { "timeout", mu_cfg_time, | 927 | { "timeout", mu_c_time, |
928 | NULL, mu_offsetof (struct mu_srv_config, timeout), NULL, | 928 | NULL, mu_offsetof (struct mu_srv_config, timeout), NULL, |
929 | N_("Set idle timeout.") }, | 929 | N_("Set idle timeout.") }, |
930 | { "acl", mu_cfg_section, | 930 | { "acl", mu_cfg_section, | ... | ... |
... | @@ -179,6 +179,7 @@ to_time_t (void *tgt, char const *string, char **errmsg) | ... | @@ -179,6 +179,7 @@ to_time_t (void *tgt, char const *string, char **errmsg) |
179 | 179 | ||
180 | if (rc) | 180 | if (rc) |
181 | { | 181 | { |
182 | if (errmsg) | ||
182 | mu_asprintf (errmsg, _("invalid time specification near %s"), string); | 183 | mu_asprintf (errmsg, _("invalid time specification near %s"), string); |
183 | return EINVAL; | 184 | return EINVAL; |
184 | } | 185 | } |
... | @@ -262,9 +263,29 @@ static str_to_c_t str_to_c[] = { | ... | @@ -262,9 +263,29 @@ static str_to_c_t str_to_c[] = { |
262 | [mu_c_incr] = to_incr | 263 | [mu_c_incr] = to_incr |
263 | }; | 264 | }; |
264 | 265 | ||
266 | char const *mu_c_type_str[] = { | ||
267 | [mu_c_string] = "mu_c_string", | ||
268 | [mu_c_short] = "mu_c_short", | ||
269 | [mu_c_ushort] = "mu_c_ushort", | ||
270 | [mu_c_int] = "mu_c_int", | ||
271 | [mu_c_uint] = "mu_c_uint", | ||
272 | [mu_c_long] = "mu_c_long", | ||
273 | [mu_c_ulong] = "mu_c_ulong", | ||
274 | [mu_c_size] = "mu_c_size", | ||
275 | [mu_c_off] = "mu_c_off", | ||
276 | [mu_c_time] = "mu_c_time", | ||
277 | [mu_c_bool] = "mu_c_bool", | ||
278 | [mu_c_ipv4] = "mu_c_ipv4", | ||
279 | [mu_c_cidr] = "mu_c_cidr", | ||
280 | [mu_c_host] = "mu_c_host", | ||
281 | [mu_c_incr] = "mu_c_incr", | ||
282 | [mu_c_void] = "mu_c_void" | ||
283 | }; | ||
284 | |||
265 | int | 285 | int |
266 | mu_str_to_c (char const *string, enum mu_c_type type, void *tgt, char **errmsg) | 286 | mu_str_to_c (char const *string, enum mu_c_type type, void *tgt, char **errmsg) |
267 | { | 287 | { |
288 | if (errmsg) | ||
268 | *errmsg = NULL; | 289 | *errmsg = NULL; |
269 | if ((size_t)type >= sizeof (str_to_c) / sizeof (str_to_c[0])) | 290 | if ((size_t)type >= sizeof (str_to_c) / sizeof (str_to_c[0])) |
270 | return EINVAL; | 291 | return EINVAL; | ... | ... |
... | @@ -62,6 +62,7 @@ noinst_PROGRAMS = \ | ... | @@ -62,6 +62,7 @@ noinst_PROGRAMS = \ |
62 | strftime\ | 62 | strftime\ |
63 | strin\ | 63 | strin\ |
64 | strout\ | 64 | strout\ |
65 | strtoc\ | ||
65 | tempfile\ | 66 | tempfile\ |
66 | url-comp\ | 67 | url-comp\ |
67 | url-parse\ | 68 | url-parse\ |
... | @@ -109,6 +110,7 @@ TESTSUITE_AT = \ | ... | @@ -109,6 +110,7 @@ TESTSUITE_AT = \ |
109 | strerr.at\ | 110 | strerr.at\ |
110 | strin.at\ | 111 | strin.at\ |
111 | strout.at\ | 112 | strout.at\ |
113 | strtoc.at\ | ||
112 | testsuite.at\ | 114 | testsuite.at\ |
113 | url.at\ | 115 | url.at\ |
114 | url-comp.at\ | 116 | url-comp.at\ | ... | ... |
libmailutils/tests/strtoc.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2016 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP([mu_str_to_c]) | ||
18 | |||
19 | AT_CHECK([strtoc]) | ||
20 | |||
21 | AT_CLEANUP |
libmailutils/tests/strtoc.c
0 → 100644
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | ||
2 | Copyright (C) 2016 Free Software Foundation, Inc. | ||
3 | |||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 3, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | GNU Mailutils is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <mailutils/mailutils.h> | ||
18 | |||
19 | union value | ||
20 | { | ||
21 | char *v_string; | ||
22 | signed short v_short; | ||
23 | unsigned short v_ushort; | ||
24 | int v_int; | ||
25 | unsigned v_uint; | ||
26 | long v_long; | ||
27 | unsigned long v_ulong; | ||
28 | size_t v_size; | ||
29 | time_t v_time; | ||
30 | struct mu_cidr v_cidr; | ||
31 | }; | ||
32 | |||
33 | struct value_handler | ||
34 | { | ||
35 | void (*format) (union value *, FILE *); | ||
36 | int (*compare) (union value *, union value *); | ||
37 | }; | ||
38 | |||
39 | static void | ||
40 | v_string_format (union value *val, FILE *fp) | ||
41 | { | ||
42 | char *p; | ||
43 | |||
44 | fputc ('"', fp); | ||
45 | for (p = val->v_string; *p; p++) | ||
46 | { | ||
47 | if (*p == '\\' || *p == '"') | ||
48 | fputc ('\\', fp); | ||
49 | fputc (*p, fp); | ||
50 | } | ||
51 | fputc ('"', fp); | ||
52 | } | ||
53 | |||
54 | static int | ||
55 | v_string_compare (union value *a, union value *b) | ||
56 | { | ||
57 | return strcmp (a->v_string, b->v_string); | ||
58 | } | ||
59 | |||
60 | static void | ||
61 | v_short_format (union value *val, FILE *fp) | ||
62 | { | ||
63 | fprintf (fp, "%hd", val->v_short); | ||
64 | } | ||
65 | |||
66 | static int | ||
67 | v_short_compare (union value *a, union value *b) | ||
68 | { | ||
69 | return a->v_short != b->v_short; | ||
70 | } | ||
71 | |||
72 | static void | ||
73 | v_ushort_format (union value *val, FILE *fp) | ||
74 | { | ||
75 | fprintf (fp, "%hu", val->v_short); | ||
76 | } | ||
77 | |||
78 | static int | ||
79 | v_ushort_compare (union value *a, union value *b) | ||
80 | { | ||
81 | return a->v_ushort != b->v_ushort; | ||
82 | } | ||
83 | |||
84 | static void | ||
85 | v_int_format (union value *val, FILE *fp) | ||
86 | { | ||
87 | fprintf (fp, "%d", val->v_int); | ||
88 | } | ||
89 | |||
90 | static int | ||
91 | v_int_compare (union value *a, union value *b) | ||
92 | { | ||
93 | return a->v_int != b->v_int; | ||
94 | } | ||
95 | |||
96 | static void | ||
97 | v_uint_format (union value *val, FILE *fp) | ||
98 | { | ||
99 | fprintf (fp, "%u", val->v_uint); | ||
100 | } | ||
101 | |||
102 | static int | ||
103 | v_uint_compare (union value *a, union value *b) | ||
104 | { | ||
105 | return a->v_uint != b->v_uint; | ||
106 | } | ||
107 | |||
108 | static void | ||
109 | v_long_format (union value *val, FILE *fp) | ||
110 | { | ||
111 | fprintf (fp, "%ld", val->v_long); | ||
112 | } | ||
113 | |||
114 | static int | ||
115 | v_long_compare (union value *a, union value *b) | ||
116 | { | ||
117 | return a->v_long != b->v_long; | ||
118 | } | ||
119 | |||
120 | static void | ||
121 | v_ulong_format (union value *val, FILE *fp) | ||
122 | { | ||
123 | fprintf (fp, "%lu", val->v_long); | ||
124 | } | ||
125 | |||
126 | static int | ||
127 | v_ulong_compare (union value *a, union value *b) | ||
128 | { | ||
129 | return a->v_ulong != b->v_ulong; | ||
130 | } | ||
131 | |||
132 | static void | ||
133 | v_size_format (union value *val, FILE *fp) | ||
134 | { | ||
135 | size_t v = val->v_size; | ||
136 | char buf[80]; | ||
137 | size_t buflen = 80; | ||
138 | char *p = buf + buflen; | ||
139 | *--p = 0; | ||
140 | do | ||
141 | { | ||
142 | int n = v % 10; | ||
143 | *--p = n + '0'; | ||
144 | v /= 10; | ||
145 | } | ||
146 | while (v && p > buf); | ||
147 | |||
148 | if (v) | ||
149 | fputs ("[overflow]", fp); | ||
150 | else | ||
151 | fputs (p, fp); | ||
152 | } | ||
153 | |||
154 | static int | ||
155 | v_size_compare (union value *a, union value *b) | ||
156 | { | ||
157 | return a->v_size != b->v_size; | ||
158 | } | ||
159 | |||
160 | static void | ||
161 | v_cidr_format (union value *val, FILE *fp) | ||
162 | { | ||
163 | char *buf; | ||
164 | |||
165 | mu_cidr_format (&val->v_cidr, 0, &buf); | ||
166 | fprintf (fp, "%s", buf); | ||
167 | free (buf); | ||
168 | } | ||
169 | |||
170 | static int | ||
171 | v_cidr_compare (union value *a, union value *b) | ||
172 | { | ||
173 | if (a->v_cidr.family != b->v_cidr.family) | ||
174 | return 1; | ||
175 | if (a->v_cidr.len != b->v_cidr.len) | ||
176 | return 1; | ||
177 | if (memcmp (a->v_cidr.address, b->v_cidr.address, a->v_cidr.len)) | ||
178 | return 1; | ||
179 | if (memcmp (a->v_cidr.netmask, b->v_cidr.netmask, a->v_cidr.len)) | ||
180 | return 1; | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | struct value_handler value_handler[] = { | ||
185 | [mu_c_string] = { v_string_format, v_string_compare }, | ||
186 | [mu_c_short] = { v_short_format, v_short_compare }, | ||
187 | [mu_c_ushort] = { v_ushort_format, v_ushort_compare }, | ||
188 | [mu_c_int] = { v_int_format, v_int_compare }, | ||
189 | [mu_c_uint] = { v_uint_format, v_uint_compare }, | ||
190 | [mu_c_long] = { v_long_format, v_long_compare }, | ||
191 | [mu_c_ulong] = { v_ulong_format, v_ulong_compare }, | ||
192 | [mu_c_size] = { v_size_format, v_size_compare }, | ||
193 | #if 0 | ||
194 | mu_c_time, | ||
195 | #endif | ||
196 | [mu_c_bool] = { v_int_format, v_int_compare }, | ||
197 | [mu_c_cidr] = { v_cidr_format, v_cidr_compare }, | ||
198 | [mu_c_incr] = { v_int_format, v_int_compare }, | ||
199 | }; | ||
200 | |||
201 | int | ||
202 | valcmp (mu_c_type_t type, union value *a, union value *b) | ||
203 | { | ||
204 | if ((size_t)type < sizeof (value_handler) / sizeof (value_handler[0]) | ||
205 | && value_handler[type].compare) | ||
206 | return value_handler[type].compare (a, b); | ||
207 | else | ||
208 | { | ||
209 | fprintf (stderr, "unsupported value type: %d\n", type); | ||
210 | abort (); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | void | ||
215 | valprint (FILE *fp, mu_c_type_t type, union value *val) | ||
216 | { | ||
217 | if ((size_t)type < sizeof (value_handler) / sizeof (value_handler[0]) | ||
218 | && value_handler[type].format) | ||
219 | value_handler[type].format (val, fp); | ||
220 | else | ||
221 | { | ||
222 | fprintf (stderr, "unsupported value type: %d\n", type); | ||
223 | abort (); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | struct testdata | ||
228 | { | ||
229 | mu_c_type_t type; | ||
230 | char const *input; | ||
231 | int err; | ||
232 | union value val; | ||
233 | }; | ||
234 | |||
235 | struct testdata tests[] = { | ||
236 | { mu_c_string, "now is the time", 0, { .v_string = "now is the time" } }, | ||
237 | { mu_c_short, "115", 0, { .v_short = 115 } }, | ||
238 | { mu_c_short, "-400", 0, { .v_short = -400 } }, | ||
239 | { mu_c_short, "1a", EINVAL, }, | ||
240 | |||
241 | { mu_c_ushort, "110", 0, { .v_ushort = 110 } }, | ||
242 | { mu_c_ushort, "-110", ERANGE }, | ||
243 | |||
244 | { mu_c_int, "10568", 0, { .v_int = 10568 } }, | ||
245 | { mu_c_int, "-10568", 0, { .v_int = -10568 } }, | ||
246 | |||
247 | { mu_c_uint, "10568", 0, { .v_uint = 10568 } }, | ||
248 | |||
249 | { mu_c_long, "10568", 0, { .v_long = 10568 } }, | ||
250 | { mu_c_long, "-10568", 0, { .v_long = -10568 } }, | ||
251 | |||
252 | { mu_c_ulong, "10568", 0, { .v_ulong = 10568 } }, | ||
253 | |||
254 | { mu_c_bool, "true", 0, { .v_int = 1 } }, | ||
255 | { mu_c_bool, "false", 0, { .v_int = 0 } }, | ||
256 | |||
257 | { mu_c_cidr, "127.0.0.0/8", 0, { .v_cidr = { | ||
258 | .family = 2, | ||
259 | .len = 4, | ||
260 | .address = { 127, 0, 0, 0 }, | ||
261 | .netmask = { 255 } } } }, | ||
262 | { mu_c_cidr, "fe80::4a5b:39ff:fe09:97f0/64", 0, { .v_cidr = { | ||
263 | .family = 10, | ||
264 | .len = 16, | ||
265 | .address = { 0xfe, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, | ||
266 | 0x4a, 0x5b, 0x39, 0xff, 0xfe, 0x9, 0x97, 0xf0 }, | ||
267 | .netmask = { 255, 255, 255, 255, 255, 255, 255, 255, | ||
268 | 0, 0, 0, 0, 0, 0, 0, 0 } } } }, | ||
269 | |||
270 | { mu_c_incr, NULL, 0, { .v_int = 1 } }, | ||
271 | { mu_c_void } | ||
272 | }; | ||
273 | |||
274 | void | ||
275 | print_test_id (int i, FILE *fp) | ||
276 | { | ||
277 | fprintf (fp, "%d: %s:%s: ", i, mu_c_type_str[tests[i].type], | ||
278 | tests[i].input ? tests[i].input : "NULL"); | ||
279 | } | ||
280 | |||
281 | void | ||
282 | usage (int code, FILE *fp, char const *argv0) | ||
283 | { | ||
284 | fprintf (fp, "usage: %s [-v]", argv0); | ||
285 | exit (code); | ||
286 | } | ||
287 | |||
288 | int | ||
289 | main (int argc, char **argv) | ||
290 | { | ||
291 | union value val; | ||
292 | char *errmsg; | ||
293 | int i; | ||
294 | unsigned failures = 0; | ||
295 | int verbose = 0; | ||
296 | |||
297 | for (i = 1; i < argc; i++) { | ||
298 | if (strcmp (argv[i], "-v") == 0) | ||
299 | verbose = 1; | ||
300 | else if (strcmp (argv[i], "-h") == 0) | ||
301 | usage (0, stdout, argv[0]); | ||
302 | else | ||
303 | usage (1, stderr, argv[0]); | ||
304 | } | ||
305 | |||
306 | if (i != argc) | ||
307 | usage (1, stderr, argv[0]); | ||
308 | |||
309 | for (i = 0; tests[i].type != mu_c_void; i++) | ||
310 | { | ||
311 | int rc; | ||
312 | |||
313 | memset (&val, 0, sizeof (val)); | ||
314 | rc = mu_str_to_c (tests[i].input, tests[i].type, &val, &errmsg); | ||
315 | if (rc) | ||
316 | { | ||
317 | if (tests[i].err == rc) | ||
318 | { | ||
319 | if (verbose) | ||
320 | { | ||
321 | print_test_id (i, stdout); | ||
322 | fprintf (stdout, "XFAIL\n"); | ||
323 | } | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | print_test_id (i, stderr); | ||
328 | fprintf (stderr, "FAIL: error %s", mu_strerror (rc)); | ||
329 | if (errmsg) | ||
330 | fprintf (stderr, ": %s", errmsg); | ||
331 | fputc ('\n', stderr); | ||
332 | free (errmsg); | ||
333 | ++failures; | ||
334 | } | ||
335 | } | ||
336 | else if (valcmp (tests[i].type, &tests[i].val, &val)) | ||
337 | { | ||
338 | fprintf (stderr, "%d: FAIL: %s value differ: ", | ||
339 | i, mu_c_type_str[tests[i].type]); | ||
340 | fprintf (stderr, "expected: "); | ||
341 | valprint (stderr, tests[i].type, &tests[i].val); | ||
342 | fprintf (stderr, ", but got: "); | ||
343 | valprint (stderr, tests[i].type, &val); | ||
344 | fputc ('\n', stderr); | ||
345 | ++failures; | ||
346 | } | ||
347 | else if (verbose) | ||
348 | { | ||
349 | print_test_id (i, stdout); | ||
350 | fprintf (stdout, "OK\n"); | ||
351 | } | ||
352 | } | ||
353 | exit (!!failures); | ||
354 | } |
... | @@ -53,6 +53,9 @@ AT_CLEANUP | ... | @@ -53,6 +53,9 @@ AT_CLEANUP |
53 | 53 | ||
54 | AT_INIT | 54 | AT_INIT |
55 | 55 | ||
56 | AT_BANNER([Conversions]) | ||
57 | m4_include([strtoc.at]) | ||
58 | |||
56 | AT_BANNER([Standard streams]) | 59 | AT_BANNER([Standard streams]) |
57 | m4_include([strin.at]) | 60 | m4_include([strin.at]) |
58 | m4_include([strout.at]) | 61 | m4_include([strout.at]) | ... | ... |
... | @@ -138,7 +138,7 @@ mu_app_init (struct argp *myargp, const char **capa, | ... | @@ -138,7 +138,7 @@ mu_app_init (struct argp *myargp, const char **capa, |
138 | mu_stream_t stream; | 138 | mu_stream_t stream; |
139 | struct mu_cfg_cont *cont; | 139 | struct mu_cfg_cont *cont; |
140 | static struct mu_cfg_param dummy_include_param[] = { | 140 | static struct mu_cfg_param dummy_include_param[] = { |
141 | { "include", mu_cfg_string, NULL, 0, NULL, | 141 | { "include", mu_c_string, NULL, 0, NULL, |
142 | N_("Include contents of the given file. If a directory is given, " | 142 | N_("Include contents of the given file. If a directory is given, " |
143 | "include contents of the file <file>/<program>, where " | 143 | "include contents of the file <file>/<program>, where " |
144 | "<program> is the name of the program. This latter form is " | 144 | "<program> is the name of the program. This latter form is " | ... | ... |
... | @@ -49,14 +49,14 @@ _cb_folder (void *data, mu_config_value_t *val) | ... | @@ -49,14 +49,14 @@ _cb_folder (void *data, mu_config_value_t *val) |
49 | } | 49 | } |
50 | 50 | ||
51 | static struct mu_cfg_param mu_mailbox_param[] = { | 51 | static struct mu_cfg_param mu_mailbox_param[] = { |
52 | { "mail-spool", mu_cfg_string, &mailbox_settings.mail_spool, 0, NULL, | 52 | { "mail-spool", mu_c_string, &mailbox_settings.mail_spool, 0, NULL, |
53 | N_("Use specified URL as a mailspool directory."), | 53 | N_("Use specified URL as a mailspool directory."), |
54 | N_("url") }, | 54 | N_("url") }, |
55 | { "mailbox-pattern", mu_cfg_string, &mailbox_settings.mailbox_pattern, | 55 | { "mailbox-pattern", mu_c_string, &mailbox_settings.mailbox_pattern, |
56 | 0, NULL, | 56 | 0, NULL, |
57 | N_("Create mailbox URL using <pattern>."), | 57 | N_("Create mailbox URL using <pattern>."), |
58 | N_("pattern") }, | 58 | N_("pattern") }, |
59 | { "mailbox-type", mu_cfg_string, &mailbox_settings.mailbox_type, 0, NULL, | 59 | { "mailbox-type", mu_c_string, &mailbox_settings.mailbox_type, 0, NULL, |
60 | N_("Default mailbox type."), N_("protocol") }, | 60 | N_("Default mailbox type."), N_("protocol") }, |
61 | { "folder", mu_cfg_callback, NULL, 0, _cb_folder, | 61 | { "folder", mu_cfg_callback, NULL, 0, _cb_folder, |
62 | N_("Default user mail folder"), | 62 | N_("Default user mail folder"), |
... | @@ -73,17 +73,17 @@ DCL_CFG_CAPA (mailbox); | ... | @@ -73,17 +73,17 @@ DCL_CFG_CAPA (mailbox); |
73 | 73 | ||
74 | static struct mu_cfg_param mu_locking_param[] = { | 74 | static struct mu_cfg_param mu_locking_param[] = { |
75 | /* FIXME: Flags are superfluous. */ | 75 | /* FIXME: Flags are superfluous. */ |
76 | { "flags", mu_cfg_string, &locking_settings.lock_flags, 0, NULL, | 76 | { "flags", mu_c_string, &locking_settings.lock_flags, 0, NULL, |
77 | N_("Default locker flags (E=external, R=retry, T=time, P=pid).") }, | 77 | N_("Default locker flags (E=external, R=retry, T=time, P=pid).") }, |
78 | { "retry-timeout", mu_cfg_ulong, &locking_settings.lock_retry_timeout, | 78 | { "retry-timeout", mu_c_ulong, &locking_settings.lock_retry_timeout, |
79 | 0, NULL, | 79 | 0, NULL, |
80 | N_("Set timeout for acquiring the lock.") }, | 80 | N_("Set timeout for acquiring the lock.") }, |
81 | { "retry-count", mu_cfg_ulong, &locking_settings.lock_retry_count, 0, NULL, | 81 | { "retry-count", mu_c_ulong, &locking_settings.lock_retry_count, 0, NULL, |
82 | N_("Set the maximum number of times to retry acquiring the lock.") }, | 82 | N_("Set the maximum number of times to retry acquiring the lock.") }, |
83 | { "expire-timeout", mu_cfg_ulong, &locking_settings.lock_expire_timeout, | 83 | { "expire-timeout", mu_c_ulong, &locking_settings.lock_expire_timeout, |
84 | 0, NULL, | 84 | 0, NULL, |
85 | N_("Expire locks older than this amount of time.") }, | 85 | N_("Expire locks older than this amount of time.") }, |
86 | { "external-locker", mu_cfg_string, &locking_settings.external_locker, | 86 | { "external-locker", mu_c_string, &locking_settings.external_locker, |
87 | 0, NULL, | 87 | 0, NULL, |
88 | N_("Use external locker program."), | 88 | N_("Use external locker program."), |
89 | N_("prog") }, | 89 | N_("prog") }, |
... | @@ -98,11 +98,11 @@ DCL_CFG_CAPA (locking); | ... | @@ -98,11 +98,11 @@ DCL_CFG_CAPA (locking); |
98 | /* ************************************************************************* */ | 98 | /* ************************************************************************* */ |
99 | 99 | ||
100 | static struct mu_cfg_param mu_address_param[] = { | 100 | static struct mu_cfg_param mu_address_param[] = { |
101 | { "email-addr", mu_cfg_string, &address_settings.address, 0, NULL, | 101 | { "email-addr", mu_c_string, &address_settings.address, 0, NULL, |
102 | N_("Set the current user email address (default is " | 102 | N_("Set the current user email address (default is " |
103 | "loginname@defaultdomain)."), | 103 | "loginname@defaultdomain)."), |
104 | N_("email") }, | 104 | N_("email") }, |
105 | { "email-domain", mu_cfg_string, &address_settings.domain, 0, NULL, | 105 | { "email-domain", mu_c_string, &address_settings.domain, 0, NULL, |
106 | N_("Set e-mail domain for unqualified user names (default is this host)"), | 106 | N_("Set e-mail domain for unqualified user names (default is this host)"), |
107 | N_("domain") }, | 107 | N_("domain") }, |
108 | { NULL } | 108 | { NULL } |
... | @@ -116,7 +116,7 @@ DCL_CFG_CAPA (address); | ... | @@ -116,7 +116,7 @@ DCL_CFG_CAPA (address); |
116 | /* ************************************************************************* */ | 116 | /* ************************************************************************* */ |
117 | 117 | ||
118 | static struct mu_cfg_param mu_mailer_param[] = { | 118 | static struct mu_cfg_param mu_mailer_param[] = { |
119 | { "url", mu_cfg_string, &mailer_settings.mailer, 0, NULL, | 119 | { "url", mu_c_string, &mailer_settings.mailer, 0, NULL, |
120 | N_("Use this URL as the default mailer"), | 120 | N_("Use this URL as the default mailer"), |
121 | N_("url") }, | 121 | N_("url") }, |
122 | { NULL } | 122 | { NULL } |
... | @@ -160,9 +160,9 @@ cb_severity (void *data, mu_config_value_t *val) | ... | @@ -160,9 +160,9 @@ cb_severity (void *data, mu_config_value_t *val) |
160 | } | 160 | } |
161 | 161 | ||
162 | static struct mu_cfg_param mu_logging_param[] = { | 162 | static struct mu_cfg_param mu_logging_param[] = { |
163 | { "syslog", mu_cfg_bool, &mu_log_syslog, 0, NULL, | 163 | { "syslog", mu_c_bool, &mu_log_syslog, 0, NULL, |
164 | N_("Send diagnostics to syslog.") }, | 164 | N_("Send diagnostics to syslog.") }, |
165 | { "print-severity", mu_cfg_bool, &mu_log_print_severity, 0, NULL, | 165 | { "print-severity", mu_c_bool, &mu_log_print_severity, 0, NULL, |
166 | N_("Print message severity levels.") }, | 166 | N_("Print message severity levels.") }, |
167 | { "severity", mu_cfg_callback, NULL, 0, cb_severity, | 167 | { "severity", mu_cfg_callback, NULL, 0, cb_severity, |
168 | N_("Output only messages with a severity equal to or greater than " | 168 | N_("Output only messages with a severity equal to or greater than " |
... | @@ -171,9 +171,9 @@ static struct mu_cfg_param mu_logging_param[] = { | ... | @@ -171,9 +171,9 @@ static struct mu_cfg_param mu_logging_param[] = { |
171 | N_("Set syslog facility. Arg is one of the following: user, daemon, " | 171 | N_("Set syslog facility. Arg is one of the following: user, daemon, " |
172 | "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), " | 172 | "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), " |
173 | "or a facility number.") }, | 173 | "or a facility number.") }, |
174 | { "session-id", mu_cfg_bool, &mu_log_session_id, 0, NULL, | 174 | { "session-id", mu_c_bool, &mu_log_session_id, 0, NULL, |
175 | N_("Log session ID") }, | 175 | N_("Log session ID") }, |
176 | { "tag", mu_cfg_string, &mu_log_tag, 0, NULL, | 176 | { "tag", mu_c_string, &mu_log_tag, 0, NULL, |
177 | N_("Tag syslog messages with this string.") }, | 177 | N_("Tag syslog messages with this string.") }, |
178 | { NULL } | 178 | { NULL } |
179 | }; | 179 | }; |
... | @@ -204,7 +204,7 @@ static struct mu_cfg_param mu_debug_param[] = { | ... | @@ -204,7 +204,7 @@ static struct mu_cfg_param mu_debug_param[] = { |
204 | N_("Set Mailutils debugging level. Argument is a colon-separated list " | 204 | N_("Set Mailutils debugging level. Argument is a colon-separated list " |
205 | "of debugging specifications in the form:\n" | 205 | "of debugging specifications in the form:\n" |
206 | " <object: string>[[:]=<level: number>].") }, | 206 | " <object: string>[[:]=<level: number>].") }, |
207 | { "line-info", mu_cfg_bool, &debug_settings.line_info, 0, NULL, | 207 | { "line-info", mu_c_bool, &debug_settings.line_info, 0, NULL, |
208 | N_("Prefix debug messages with Mailutils source locations.") }, | 208 | N_("Prefix debug messages with Mailutils source locations.") }, |
209 | { NULL } | 209 | { NULL } |
210 | }; | 210 | }; | ... | ... |
... | @@ -26,21 +26,21 @@ | ... | @@ -26,21 +26,21 @@ |
26 | static struct mu_gsasl_module_data gsasl_settings; | 26 | static struct mu_gsasl_module_data gsasl_settings; |
27 | 27 | ||
28 | static struct mu_cfg_param mu_gsasl_param[] = { | 28 | static struct mu_cfg_param mu_gsasl_param[] = { |
29 | { "enable", mu_cfg_bool, &gsasl_settings.enable, 0, NULL, | 29 | { "enable", mu_c_bool, &gsasl_settings.enable, 0, NULL, |
30 | N_("Enable GSASL (default)") }, | 30 | N_("Enable GSASL (default)") }, |
31 | { "cram-passwd", mu_cfg_string, &gsasl_settings.cram_md5_pwd, 0, NULL, | 31 | { "cram-passwd", mu_c_string, &gsasl_settings.cram_md5_pwd, 0, NULL, |
32 | N_("Name of GSASL password file."), | 32 | N_("Name of GSASL password file."), |
33 | N_("file") }, | 33 | N_("file") }, |
34 | { "service", mu_cfg_string, &gsasl_settings.service, 0, NULL, | 34 | { "service", mu_c_string, &gsasl_settings.service, 0, NULL, |
35 | N_("SASL service name."), | 35 | N_("SASL service name."), |
36 | N_("name") }, | 36 | N_("name") }, |
37 | { "realm", mu_cfg_string, &gsasl_settings.realm, 0, NULL, | 37 | { "realm", mu_c_string, &gsasl_settings.realm, 0, NULL, |
38 | N_("SASL realm name."), | 38 | N_("SASL realm name."), |
39 | N_("name") }, | 39 | N_("name") }, |
40 | { "hostname", mu_cfg_string, &gsasl_settings.hostname, 0, NULL, | 40 | { "hostname", mu_c_string, &gsasl_settings.hostname, 0, NULL, |
41 | N_("SASL host name."), | 41 | N_("SASL host name."), |
42 | N_("name") }, | 42 | N_("name") }, |
43 | { "anonymous-user", mu_cfg_string, &gsasl_settings.anon_user, 0, NULL, | 43 | { "anonymous-user", mu_c_string, &gsasl_settings.anon_user, 0, NULL, |
44 | N_("Anonymous user name."), | 44 | N_("Anonymous user name."), |
45 | N_("name") }, | 45 | N_("name") }, |
46 | 46 | ... | ... |
... | @@ -43,22 +43,22 @@ cb_field_map (void *data, mu_config_value_t *val) | ... | @@ -43,22 +43,22 @@ cb_field_map (void *data, mu_config_value_t *val) |
43 | } | 43 | } |
44 | 44 | ||
45 | static struct mu_cfg_param mu_ldap_param[] = { | 45 | static struct mu_cfg_param mu_ldap_param[] = { |
46 | { "enable", mu_cfg_bool, &ldap_settings.enable, 0, NULL, | 46 | { "enable", mu_c_bool, &ldap_settings.enable, 0, NULL, |
47 | N_("Enable LDAP lookups.") }, | 47 | N_("Enable LDAP lookups.") }, |
48 | { "url", mu_cfg_string, &ldap_settings.url, 0, NULL, | 48 | { "url", mu_c_string, &ldap_settings.url, 0, NULL, |
49 | N_("Set URL of the LDAP server."), | 49 | N_("Set URL of the LDAP server."), |
50 | N_("url") }, | 50 | N_("url") }, |
51 | { "base", mu_cfg_string, &ldap_settings.base, 0, NULL, | 51 | { "base", mu_c_string, &ldap_settings.base, 0, NULL, |
52 | N_("Base DN for LDAP lookups."), | 52 | N_("Base DN for LDAP lookups."), |
53 | N_("dn") }, | 53 | N_("dn") }, |
54 | { "binddn", mu_cfg_string, &ldap_settings.binddn, 0, NULL, | 54 | { "binddn", mu_c_string, &ldap_settings.binddn, 0, NULL, |
55 | N_("DN for accessing LDAP database."), | 55 | N_("DN for accessing LDAP database."), |
56 | N_("dn") }, | 56 | N_("dn") }, |
57 | { "passwd", mu_cfg_string, &ldap_settings.passwd, 0, NULL, | 57 | { "passwd", mu_c_string, &ldap_settings.passwd, 0, NULL, |
58 | N_("Password for use with binddn.") }, | 58 | N_("Password for use with binddn.") }, |
59 | { "tls", mu_cfg_bool, &ldap_settings.tls, 0, NULL, | 59 | { "tls", mu_c_bool, &ldap_settings.tls, 0, NULL, |
60 | N_("Use TLS encryption.") }, | 60 | N_("Use TLS encryption.") }, |
61 | { "debug", mu_cfg_int, &ldap_settings.debug, 0, NULL, | 61 | { "debug", mu_c_int, &ldap_settings.debug, 0, NULL, |
62 | N_("Set LDAP debugging level.") }, | 62 | N_("Set LDAP debugging level.") }, |
63 | { "field-map", mu_cfg_callback, NULL, 0, cb_field_map, | 63 | { "field-map", mu_cfg_callback, NULL, 0, cb_field_map, |
64 | N_("Set a field-map for parsing LDAP replies. The map is a " | 64 | N_("Set a field-map for parsing LDAP replies. The map is a " |
... | @@ -69,10 +69,10 @@ static struct mu_cfg_param mu_ldap_param[] = { | ... | @@ -69,10 +69,10 @@ static struct mu_cfg_param mu_ldap_param[] = { |
69 | "gecos, dir, shell, mailbox, quota, and <attr> is the name of " | 69 | "gecos, dir, shell, mailbox, quota, and <attr> is the name of " |
70 | "the corresponding LDAP attribute."), | 70 | "the corresponding LDAP attribute."), |
71 | N_("map") }, | 71 | N_("map") }, |
72 | { "getpwnam", mu_cfg_string, &ldap_settings.getpwnam_filter, 0, NULL, | 72 | { "getpwnam", mu_c_string, &ldap_settings.getpwnam_filter, 0, NULL, |
73 | N_("LDAP filter to use for getpwnam requests."), | 73 | N_("LDAP filter to use for getpwnam requests."), |
74 | N_("filter") }, | 74 | N_("filter") }, |
75 | { "getpwuid", mu_cfg_string, &ldap_settings.getpwuid_filter, 0, NULL, | 75 | { "getpwuid", mu_c_string, &ldap_settings.getpwuid_filter, 0, NULL, |
76 | N_("LDAP filter to use for getpwuid requests."), | 76 | N_("LDAP filter to use for getpwuid requests."), |
77 | N_("filter") }, | 77 | N_("filter") }, |
78 | { NULL } | 78 | { NULL } | ... | ... |
... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
25 | static char *pam_settings; | 25 | static char *pam_settings; |
26 | 26 | ||
27 | static struct mu_cfg_param mu_pam_param[] = { | 27 | static struct mu_cfg_param mu_pam_param[] = { |
28 | { "service", mu_cfg_string, &pam_settings, 0, NULL, | 28 | { "service", mu_c_string, &pam_settings, 0, NULL, |
29 | N_("Set PAM service name."), | 29 | N_("Set PAM service name."), |
30 | N_("name") }, | 30 | N_("name") }, |
31 | { NULL } | 31 | { NULL } | ... | ... |
... | @@ -26,16 +26,16 @@ | ... | @@ -26,16 +26,16 @@ |
26 | static struct mu_radius_module_data radius_settings; | 26 | static struct mu_radius_module_data radius_settings; |
27 | 27 | ||
28 | static struct mu_cfg_param mu_radius_param[] = { | 28 | static struct mu_cfg_param mu_radius_param[] = { |
29 | { "auth", mu_cfg_string, &radius_settings.auth_request, 0, NULL, | 29 | { "auth", mu_c_string, &radius_settings.auth_request, 0, NULL, |
30 | N_("Radius request for authorization."), | 30 | N_("Radius request for authorization."), |
31 | N_("request") }, | 31 | N_("request") }, |
32 | { "getpwnam", mu_cfg_string, &radius_settings.getpwnam_request, 0, NULL, | 32 | { "getpwnam", mu_c_string, &radius_settings.getpwnam_request, 0, NULL, |
33 | N_("Radius request for getpwnam."), | 33 | N_("Radius request for getpwnam."), |
34 | N_("request") }, | 34 | N_("request") }, |
35 | { "getpwuid", mu_cfg_string, &radius_settings.getpwuid_request, 0, NULL, | 35 | { "getpwuid", mu_c_string, &radius_settings.getpwuid_request, 0, NULL, |
36 | N_("Radius request for getpwuid."), | 36 | N_("Radius request for getpwuid."), |
37 | N_("request") }, | 37 | N_("request") }, |
38 | { "directory", mu_cfg_string, &radius_settings.config_dir, 0, NULL, | 38 | { "directory", mu_c_string, &radius_settings.config_dir, 0, NULL, |
39 | N_("Set radius configuration directory.") }, | 39 | N_("Set radius configuration directory.") }, |
40 | { NULL } | 40 | { NULL } |
41 | }; | 41 | }; | ... | ... |
... | @@ -32,7 +32,7 @@ cb_clear_library_path (void *data, mu_config_value_t *val) | ... | @@ -32,7 +32,7 @@ cb_clear_library_path (void *data, mu_config_value_t *val) |
32 | 32 | ||
33 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | 33 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) |
34 | return 1; | 34 | return 1; |
35 | if (mu_cfg_parse_boolean (val->v.string, &flag)) | 35 | if (mu_str_to_c (val->v.string, mu_c_bool, &flag, NULL)) |
36 | { | 36 | { |
37 | mu_error (_("not a boolean")); | 37 | mu_error (_("not a boolean")); |
38 | return 1; | 38 | return 1; |
... | @@ -49,7 +49,7 @@ cb_clear_include_path (void *data, mu_config_value_t *val) | ... | @@ -49,7 +49,7 @@ cb_clear_include_path (void *data, mu_config_value_t *val) |
49 | 49 | ||
50 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | 50 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) |
51 | return 1; | 51 | return 1; |
52 | if (mu_cfg_parse_boolean (val->v.string, &flag)) | 52 | if (mu_str_to_c (val->v.string, mu_c_bool, &flag, NULL)) |
53 | { | 53 | { |
54 | mu_error (_("not a boolean")); | 54 | mu_error (_("not a boolean")); |
55 | return 1; | 55 | return 1; | ... | ... |
... | @@ -57,31 +57,31 @@ cb_field_map (void *data, mu_config_value_t *val) | ... | @@ -57,31 +57,31 @@ cb_field_map (void *data, mu_config_value_t *val) |
57 | } | 57 | } |
58 | 58 | ||
59 | static struct mu_cfg_param mu_sql_param[] = { | 59 | static struct mu_cfg_param mu_sql_param[] = { |
60 | { "interface", mu_cfg_string, &sql_settings.interface, 0, NULL, | 60 | { "interface", mu_c_string, &sql_settings.interface, 0, NULL, |
61 | N_("Set SQL interface to use (one of: mysql, odbc, or postgres).") }, | 61 | N_("Set SQL interface to use (one of: mysql, odbc, or postgres).") }, |
62 | { "getpwnam", mu_cfg_string, &sql_settings.getpwnam_query, 0, NULL, | 62 | { "getpwnam", mu_c_string, &sql_settings.getpwnam_query, 0, NULL, |
63 | N_("SQL query to use for getpwnam requests."), | 63 | N_("SQL query to use for getpwnam requests."), |
64 | N_("query") }, | 64 | N_("query") }, |
65 | { "getpwuid", mu_cfg_string, &sql_settings.getpwuid_query, 0, NULL, | 65 | { "getpwuid", mu_c_string, &sql_settings.getpwuid_query, 0, NULL, |
66 | N_("SQL query to use for getpwuid requests."), | 66 | N_("SQL query to use for getpwuid requests."), |
67 | N_("query") }, | 67 | N_("query") }, |
68 | { "getpass", mu_cfg_string, &sql_settings.getpass_query, 0, NULL, | 68 | { "getpass", mu_c_string, &sql_settings.getpass_query, 0, NULL, |
69 | N_("SQL query returning the user's password."), | 69 | N_("SQL query returning the user's password."), |
70 | N_("query") }, | 70 | N_("query") }, |
71 | { "host", mu_cfg_string, &sql_settings.host, 0, NULL, | 71 | { "host", mu_c_string, &sql_settings.host, 0, NULL, |
72 | N_("SQL server host name.") }, | 72 | N_("SQL server host name.") }, |
73 | { "user", mu_cfg_string, &sql_settings.user, 0, NULL, | 73 | { "user", mu_c_string, &sql_settings.user, 0, NULL, |
74 | N_("SQL user name.") }, | 74 | N_("SQL user name.") }, |
75 | { "passwd", mu_cfg_string, &sql_settings.passwd, 0, NULL, | 75 | { "passwd", mu_c_string, &sql_settings.passwd, 0, NULL, |
76 | N_("Password for the SQL user.") }, | 76 | N_("Password for the SQL user.") }, |
77 | { "port", mu_cfg_int, &sql_settings.port, 0, NULL, | 77 | { "port", mu_c_int, &sql_settings.port, 0, NULL, |
78 | N_("SQL server port.") }, | 78 | N_("SQL server port.") }, |
79 | { "db", mu_cfg_string, &sql_settings.db, 0, NULL, | 79 | { "db", mu_c_string, &sql_settings.db, 0, NULL, |
80 | N_("Database name.") }, | 80 | N_("Database name.") }, |
81 | { "password-type", mu_cfg_callback, NULL, 0, cb_password_type, | 81 | { "password-type", mu_cfg_callback, NULL, 0, cb_password_type, |
82 | N_("Type of password returned by getpass query (one of: plain, hash, " | 82 | N_("Type of password returned by getpass query (one of: plain, hash, " |
83 | "scrambled).") }, | 83 | "scrambled).") }, |
84 | { "positional", mu_cfg_bool, &sql_settings.positional, 0, NULL, | 84 | { "positional", mu_c_bool, &sql_settings.positional, 0, NULL, |
85 | N_("Use positional (v1.0 compatible) field interface.") }, | 85 | N_("Use positional (v1.0 compatible) field interface.") }, |
86 | { "field-map", mu_cfg_callback, NULL, 0, cb_field_map, | 86 | { "field-map", mu_cfg_callback, NULL, 0, cb_field_map, |
87 | N_("Set a field-map for parsing SQL replies. The map is a " | 87 | N_("Set a field-map for parsing SQL replies. The map is a " | ... | ... |
... | @@ -77,18 +77,18 @@ cb_safety_checks (void *data, mu_config_value_t *arg) | ... | @@ -77,18 +77,18 @@ cb_safety_checks (void *data, mu_config_value_t *arg) |
77 | } | 77 | } |
78 | 78 | ||
79 | static struct mu_cfg_param mu_tls_param[] = { | 79 | static struct mu_cfg_param mu_tls_param[] = { |
80 | { "enable", mu_cfg_bool, &tls_settings.enable, 0, NULL, | 80 | { "enable", mu_c_bool, &tls_settings.enable, 0, NULL, |
81 | N_("Enable TLS encryption.") }, | 81 | N_("Enable TLS encryption.") }, |
82 | { "ssl-cert", mu_cfg_string, &tls_settings.ssl_cert, 0, NULL, | 82 | { "ssl-cert", mu_c_string, &tls_settings.ssl_cert, 0, NULL, |
83 | N_("Specify SSL certificate file."), | 83 | N_("Specify SSL certificate file."), |
84 | N_("file") }, | 84 | N_("file") }, |
85 | { "ssl-key", mu_cfg_string, &tls_settings.ssl_key, 0, NULL, | 85 | { "ssl-key", mu_c_string, &tls_settings.ssl_key, 0, NULL, |
86 | N_("Specify SSL certificate key file."), | 86 | N_("Specify SSL certificate key file."), |
87 | N_("file") }, | 87 | N_("file") }, |
88 | { "ssl-cafile", mu_cfg_string, &tls_settings.ssl_cafile, 0, NULL, | 88 | { "ssl-cafile", mu_c_string, &tls_settings.ssl_cafile, 0, NULL, |
89 | N_("Specify trusted CAs file."), | 89 | N_("Specify trusted CAs file."), |
90 | N_("file") }, | 90 | N_("file") }, |
91 | { "ssl-priorities", mu_cfg_string, &tls_settings.priorities, 0, NULL, | 91 | { "ssl-priorities", mu_c_string, &tls_settings.priorities, 0, NULL, |
92 | N_("Set the priorities to use on the ciphers, key exchange methods, " | 92 | N_("Set the priorities to use on the ciphers, key exchange methods, " |
93 | "macs and compression methods."), | 93 | "macs and compression methods."), |
94 | NULL }, | 94 | NULL }, | ... | ... |
... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
25 | static struct mu_gocs_virtual virtdomain_settings; | 25 | static struct mu_gocs_virtual virtdomain_settings; |
26 | 26 | ||
27 | static struct mu_cfg_param mu_virtdomain_param[] = { | 27 | static struct mu_cfg_param mu_virtdomain_param[] = { |
28 | { "passwd-dir", mu_cfg_string, &virtdomain_settings, 0, NULL, | 28 | { "passwd-dir", mu_c_string, &virtdomain_settings, 0, NULL, |
29 | N_("Name of the directory where virtual domain password files are " | 29 | N_("Name of the directory where virtual domain password files are " |
30 | "located."), | 30 | "located."), |
31 | N_("dir") }, | 31 | N_("dir") }, | ... | ... |
... | @@ -284,7 +284,7 @@ cb_stderr (void *data, mu_config_value_t *val) | ... | @@ -284,7 +284,7 @@ cb_stderr (void *data, mu_config_value_t *val) |
284 | 284 | ||
285 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | 285 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) |
286 | return 1; | 286 | return 1; |
287 | if (mu_cfg_parse_boolean (val->v.string, &res)) | 287 | if (mu_str_to_c (val->v.string, mu_c_bool, &res, NULL)) |
288 | mu_error (_("not a boolean")); | 288 | mu_error (_("not a boolean")); |
289 | else | 289 | else |
290 | mu_log_syslog = !res; | 290 | mu_log_syslog = !res; |
... | @@ -415,24 +415,24 @@ struct mu_cfg_param maidag_cfg_param[] = { | ... | @@ -415,24 +415,24 @@ struct mu_cfg_param maidag_cfg_param[] = { |
415 | { "delivery-mode", mu_cfg_callback, NULL, 0, cb_delivery_mode, | 415 | { "delivery-mode", mu_cfg_callback, NULL, 0, cb_delivery_mode, |
416 | N_("Set delivery mode"), | 416 | N_("Set delivery mode"), |
417 | N_("mode: {mda | url | lmtp}") }, | 417 | N_("mode: {mda | url | lmtp}") }, |
418 | { "exit-multiple-delivery-success", mu_cfg_bool, &multiple_delivery, 0, NULL, | 418 | { "exit-multiple-delivery-success", mu_c_bool, &multiple_delivery, 0, NULL, |
419 | N_("In case of multiple delivery, exit with code 0 if at least one " | 419 | N_("In case of multiple delivery, exit with code 0 if at least one " |
420 | "delivery succeeded.") }, | 420 | "delivery succeeded.") }, |
421 | { "exit-quota-tempfail", mu_cfg_bool, &ex_quota_tempfail, 0, NULL, | 421 | { "exit-quota-tempfail", mu_c_bool, &ex_quota_tempfail, 0, NULL, |
422 | N_("Indicate temporary failure if the recipient is over his mail quota.") | 422 | N_("Indicate temporary failure if the recipient is over his mail quota.") |
423 | }, | 423 | }, |
424 | #ifdef ENABLE_DBM | 424 | #ifdef ENABLE_DBM |
425 | { "quota-db", mu_cfg_string, "adbname, 0, NULL, | 425 | { "quota-db", mu_c_string, "adbname, 0, NULL, |
426 | N_("Name of DBM quota database file."), | 426 | N_("Name of DBM quota database file."), |
427 | N_("file") }, | 427 | N_("file") }, |
428 | #endif | 428 | #endif |
429 | #ifdef USE_SQL | 429 | #ifdef USE_SQL |
430 | { "quota-query", mu_cfg_string, "a_query, 0, NULL, | 430 | { "quota-query", mu_c_string, "a_query, 0, NULL, |
431 | N_("SQL query to retrieve mailbox quota. This is deprecated, use " | 431 | N_("SQL query to retrieve mailbox quota. This is deprecated, use " |
432 | "sql { ... } instead."), | 432 | "sql { ... } instead."), |
433 | N_("query") }, | 433 | N_("query") }, |
434 | #endif | 434 | #endif |
435 | { "message-id-header", mu_cfg_string, &message_id_header, 0, NULL, | 435 | { "message-id-header", mu_c_string, &message_id_header, 0, NULL, |
436 | N_("When logging Sieve actions, identify messages by the value of " | 436 | N_("When logging Sieve actions, identify messages by the value of " |
437 | "this header."), | 437 | "this header."), |
438 | N_("name") }, | 438 | N_("name") }, |
... | @@ -445,12 +445,12 @@ struct mu_cfg_param maidag_cfg_param[] = { | ... | @@ -445,12 +445,12 @@ struct mu_cfg_param maidag_cfg_param[] = { |
445 | " l - sieve action logs\n") }, | 445 | " l - sieve action logs\n") }, |
446 | { "stderr", mu_cfg_callback, NULL, 0, cb_stderr, | 446 | { "stderr", mu_cfg_callback, NULL, 0, cb_stderr, |
447 | N_("Log to stderr instead of syslog.") }, | 447 | N_("Log to stderr instead of syslog.") }, |
448 | { "forward-file", mu_cfg_string, &forward_file, 0, NULL, | 448 | { "forward-file", mu_c_string, &forward_file, 0, NULL, |
449 | N_("Process forward file.") }, | 449 | N_("Process forward file.") }, |
450 | { "forward-file-checks", mu_cfg_callback, NULL, 0, cb_forward_file_checks, | 450 | { "forward-file-checks", mu_cfg_callback, NULL, 0, cb_forward_file_checks, |
451 | N_("Configure safety checks for the forward file."), | 451 | N_("Configure safety checks for the forward file."), |
452 | N_("arg: list") }, | 452 | N_("arg: list") }, |
453 | { "domain", mu_cfg_string, &default_domain, 0, NULL, | 453 | { "domain", mu_c_string, &default_domain, 0, NULL, |
454 | N_("Default email domain") }, | 454 | N_("Default email domain") }, |
455 | /* LMTP support */ | 455 | /* LMTP support */ |
456 | { "group", mu_cfg_callback, &lmtp_groups, 0, cb_group, | 456 | { "group", mu_cfg_callback, &lmtp_groups, 0, cb_group, |
... | @@ -463,7 +463,7 @@ struct mu_cfg_param maidag_cfg_param[] = { | ... | @@ -463,7 +463,7 @@ struct mu_cfg_param maidag_cfg_param[] = { |
463 | " file://<socket-file-name>\n" | 463 | " file://<socket-file-name>\n" |
464 | "or socket://<socket-file-name>"), | 464 | "or socket://<socket-file-name>"), |
465 | N_("url") }, | 465 | N_("url") }, |
466 | { "reuse-address", mu_cfg_bool, &reuse_lmtp_address, 0, NULL, | 466 | { "reuse-address", mu_c_bool, &reuse_lmtp_address, 0, NULL, |
467 | N_("Reuse existing address (LMTP mode). Default is \"yes\".") }, | 467 | N_("Reuse existing address (LMTP mode). Default is \"yes\".") }, |
468 | { "filter", mu_cfg_section, NULL, 0, NULL, | 468 | { "filter", mu_cfg_section, NULL, 0, NULL, |
469 | N_("Add a message filter") }, | 469 | N_("Add a message filter") }, | ... | ... |
... | @@ -164,10 +164,10 @@ struct mu_cfg_param mimeview_cfg_param[] = { | ... | @@ -164,10 +164,10 @@ struct mu_cfg_param mimeview_cfg_param[] = { |
164 | { "debug", mu_cfg_callback, NULL, 0, cb_debug, | 164 | { "debug", mu_cfg_callback, NULL, 0, cb_debug, |
165 | N_("Set debug verbosity level."), | 165 | N_("Set debug verbosity level."), |
166 | N_("flags") }, | 166 | N_("flags") }, |
167 | { "mimetypes", mu_cfg_string, &mimetypes_config, 0, NULL, | 167 | { "mimetypes", mu_c_string, &mimetypes_config, 0, NULL, |
168 | N_("Use this mime.types file."), | 168 | N_("Use this mime.types file."), |
169 | N_("file") }, | 169 | N_("file") }, |
170 | { "metamail", mu_cfg_string, &metamail, 0, NULL, | 170 | { "metamail", mu_c_string, &metamail, 0, NULL, |
171 | N_("Use this program to display files."), | 171 | N_("Use this program to display files."), |
172 | N_("prog") }, | 172 | N_("prog") }, |
173 | { NULL } | 173 | { NULL } | ... | ... |
... | @@ -371,17 +371,17 @@ cb_onerror (void *data, mu_config_value_t *val) | ... | @@ -371,17 +371,17 @@ cb_onerror (void *data, mu_config_value_t *val) |
371 | } | 371 | } |
372 | 372 | ||
373 | struct mu_cfg_param movemail_cfg_param[] = { | 373 | struct mu_cfg_param movemail_cfg_param[] = { |
374 | { "preserve", mu_cfg_bool, &preserve_mail, 0, NULL, | 374 | { "preserve", mu_c_bool, &preserve_mail, 0, NULL, |
375 | N_("Do not remove messages from the source mailbox.") }, | 375 | N_("Do not remove messages from the source mailbox.") }, |
376 | { "reverse", mu_cfg_bool, &reverse_order, 0, NULL, | 376 | { "reverse", mu_c_bool, &reverse_order, 0, NULL, |
377 | N_("Reverse message sorting order.") }, | 377 | N_("Reverse message sorting order.") }, |
378 | { "emacs", mu_cfg_bool, &emacs_mode, 0, NULL, | 378 | { "emacs", mu_c_bool, &emacs_mode, 0, NULL, |
379 | N_("Output information used by Emacs rmail interface.") }, | 379 | N_("Output information used by Emacs rmail interface.") }, |
380 | { "uidl", mu_cfg_bool, &uidl_option, 0, NULL, | 380 | { "uidl", mu_c_bool, &uidl_option, 0, NULL, |
381 | N_("Use UIDLs to avoid downloading the same message twice.") }, | 381 | N_("Use UIDLs to avoid downloading the same message twice.") }, |
382 | { "verbose", mu_cfg_int, &verbose_option, 0, NULL, | 382 | { "verbose", mu_c_int, &verbose_option, 0, NULL, |
383 | N_("Set verbosity level.") }, | 383 | N_("Set verbosity level.") }, |
384 | { "program-id", mu_cfg_string, &program_id_option, 0, NULL, | 384 | { "program-id", mu_c_string, &program_id_option, 0, NULL, |
385 | N_("Set program identifier string (default: program name)") }, | 385 | N_("Set program identifier string (default: program name)") }, |
386 | { "mailbox-ownership", mu_cfg_callback, NULL, 0, | 386 | { "mailbox-ownership", mu_cfg_callback, NULL, 0, |
387 | cb_mailbox_ownership, | 387 | cb_mailbox_ownership, |
... | @@ -392,10 +392,10 @@ struct mu_cfg_param movemail_cfg_param[] = { | ... | @@ -392,10 +392,10 @@ struct mu_cfg_param movemail_cfg_param[] = { |
392 | " set-id=UID[:GID] set supplied UID and GID\n" | 392 | " set-id=UID[:GID] set supplied UID and GID\n" |
393 | " set-name=USER make destination mailbox owned by USER"), | 393 | " set-name=USER make destination mailbox owned by USER"), |
394 | N_("methods: list") }, | 394 | N_("methods: list") }, |
395 | { "max-messages", mu_cfg_size, &max_messages_option, 0, NULL, | 395 | { "max-messages", mu_c_size, &max_messages_option, 0, NULL, |
396 | N_("Copy at most <count> messages."), | 396 | N_("Copy at most <count> messages."), |
397 | N_("count") }, | 397 | N_("count") }, |
398 | { "ignore-errors", mu_cfg_bool, &ignore_errors, 0, NULL, | 398 | { "ignore-errors", mu_c_bool, &ignore_errors, 0, NULL, |
399 | N_("Continue after an error.") }, | 399 | N_("Continue after an error.") }, |
400 | { "onerror", mu_cfg_callback, NULL, 0, cb_onerror, | 400 | { "onerror", mu_cfg_callback, NULL, 0, cb_onerror, |
401 | N_("What to do after an error. Argument is a comma-separated list of:\n" | 401 | N_("What to do after an error. Argument is a comma-separated list of:\n" | ... | ... |
... | @@ -182,7 +182,7 @@ cb_tls_required (void *data, mu_config_value_t *val) | ... | @@ -182,7 +182,7 @@ cb_tls_required (void *data, mu_config_value_t *val) |
182 | 182 | ||
183 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | 183 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) |
184 | return 1; | 184 | return 1; |
185 | if (mu_cfg_parse_boolean (val->v.string, &bv)) | 185 | if (mu_str_to_c (val->v.string, mu_c_bool, &bv, NULL)) |
186 | mu_error (_("Not a boolean value")); | 186 | mu_error (_("Not a boolean value")); |
187 | else if (bv) | 187 | else if (bv) |
188 | { | 188 | { |
... | @@ -210,16 +210,16 @@ static struct mu_cfg_param pop3d_srv_param[] = { | ... | @@ -210,16 +210,16 @@ static struct mu_cfg_param pop3d_srv_param[] = { |
210 | }; | 210 | }; |
211 | 211 | ||
212 | static struct mu_cfg_param pop3d_cfg_param[] = { | 212 | static struct mu_cfg_param pop3d_cfg_param[] = { |
213 | { "undelete", mu_cfg_bool, &undelete_on_startup, 0, NULL, | 213 | { "undelete", mu_c_bool, &undelete_on_startup, 0, NULL, |
214 | N_("On startup, clear deletion marks from all the messages.") }, | 214 | N_("On startup, clear deletion marks from all the messages.") }, |
215 | { "expire", mu_cfg_uint, &expire, 0, NULL, | 215 | { "expire", mu_c_uint, &expire, 0, NULL, |
216 | N_("Automatically expire read messages after the given number of days."), | 216 | N_("Automatically expire read messages after the given number of days."), |
217 | N_("days") }, | 217 | N_("days") }, |
218 | { "delete-expired", mu_cfg_bool, &expire_on_exit, 0, NULL, | 218 | { "delete-expired", mu_c_bool, &expire_on_exit, 0, NULL, |
219 | N_("Delete expired messages upon closing the mailbox.") }, | 219 | N_("Delete expired messages upon closing the mailbox.") }, |
220 | { "scan-lines", mu_cfg_bool, &pop3d_xlines, 0, NULL, | 220 | { "scan-lines", mu_c_bool, &pop3d_xlines, 0, NULL, |
221 | N_("Output the number of lines in the message in its scan listing.") }, | 221 | N_("Output the number of lines in the message in its scan listing.") }, |
222 | { "apop-database-file", mu_cfg_string, &apop_database_name, 0, NULL, | 222 | { "apop-database-file", mu_c_string, &apop_database_name, 0, NULL, |
223 | N_("set APOP database file name or URL") }, | 223 | N_("set APOP database file name or URL") }, |
224 | { "apop-database-owner", mu_cfg_callback, NULL, 0, cb_apop_database_owner, | 224 | { "apop-database-owner", mu_cfg_callback, NULL, 0, cb_apop_database_owner, |
225 | N_("Name or UID of the APOP database owner") }, | 225 | N_("Name or UID of the APOP database owner") }, |
... | @@ -247,9 +247,9 @@ static struct mu_cfg_param pop3d_cfg_param[] = { | ... | @@ -247,9 +247,9 @@ static struct mu_cfg_param pop3d_cfg_param[] = { |
247 | "Deprecated, use \"tls required\" instead.") }, | 247 | "Deprecated, use \"tls required\" instead.") }, |
248 | #endif | 248 | #endif |
249 | #ifdef ENABLE_LOGIN_DELAY | 249 | #ifdef ENABLE_LOGIN_DELAY |
250 | { "login-delay", mu_cfg_time, &login_delay, 0, NULL, | 250 | { "login-delay", mu_c_time, &login_delay, 0, NULL, |
251 | N_("Set the minimal allowed delay between two successive logins.") }, | 251 | N_("Set the minimal allowed delay between two successive logins.") }, |
252 | { "stat-file", mu_cfg_string, &login_stat_file, 0, NULL, | 252 | { "stat-file", mu_c_string, &login_stat_file, 0, NULL, |
253 | N_("Set the name of login statistics file (for login-delay).") }, | 253 | N_("Set the name of login statistics file (for login-delay).") }, |
254 | #endif | 254 | #endif |
255 | { "bulletin-source", mu_cfg_callback, NULL, 0, cb_bulletin_source, | 255 | { "bulletin-source", mu_cfg_callback, NULL, 0, cb_bulletin_source, |
... | @@ -260,12 +260,12 @@ static struct mu_cfg_param pop3d_cfg_param[] = { | ... | @@ -260,12 +260,12 @@ static struct mu_cfg_param pop3d_cfg_param[] = { |
260 | N_("Set the bulletin database file name."), | 260 | N_("Set the bulletin database file name."), |
261 | N_("file") }, | 261 | N_("file") }, |
262 | #endif | 262 | #endif |
263 | { "output-buffer-size", mu_cfg_size, &pop3d_output_bufsize, 0, NULL, | 263 | { "output-buffer-size", mu_c_size, &pop3d_output_bufsize, 0, NULL, |
264 | N_("Size of the output buffer.") }, | 264 | N_("Size of the output buffer.") }, |
265 | { "mandatory-locking", mu_cfg_section }, | 265 | { "mandatory-locking", mu_cfg_section }, |
266 | { ".server", mu_cfg_section, NULL, 0, NULL, | 266 | { ".server", mu_cfg_section, NULL, 0, NULL, |
267 | N_("Server configuration.") }, | 267 | N_("Server configuration.") }, |
268 | { "transcript", mu_cfg_bool, &pop3d_transcript, 0, NULL, | 268 | { "transcript", mu_c_bool, &pop3d_transcript, 0, NULL, |
269 | N_("Set global transcript mode.") }, | 269 | N_("Set global transcript mode.") }, |
270 | TCP_WRAPPERS_CONFIG | 270 | TCP_WRAPPERS_CONFIG |
271 | { NULL } | 271 | { NULL } | ... | ... |
... | @@ -126,21 +126,21 @@ readmsg_parse_opt (int key, char *arg, struct argp_state *astate) | ... | @@ -126,21 +126,21 @@ readmsg_parse_opt (int key, char *arg, struct argp_state *astate) |
126 | 126 | ||
127 | 127 | ||
128 | struct mu_cfg_param readmsg_cfg_param[] = { | 128 | struct mu_cfg_param readmsg_cfg_param[] = { |
129 | { "debug", mu_cfg_int, &dbug, 0, NULL, | 129 | { "debug", mu_c_int, &dbug, 0, NULL, |
130 | N_("Set debug verbosity level.") }, | 130 | N_("Set debug verbosity level.") }, |
131 | { "header", mu_cfg_bool, &all_header, 0, NULL, | 131 | { "header", mu_c_bool, &all_header, 0, NULL, |
132 | N_("Display entire headers.") }, | 132 | N_("Display entire headers.") }, |
133 | { "weedlist", mu_cfg_string, &weedlist, 0, NULL, | 133 | { "weedlist", mu_c_string, &weedlist, 0, NULL, |
134 | N_("Display only headers from this list. Argument is a list of header " | 134 | N_("Display only headers from this list. Argument is a list of header " |
135 | "names separated by whitespace or commas."), | 135 | "names separated by whitespace or commas."), |
136 | N_("list") }, | 136 | N_("list") }, |
137 | { "folder", mu_cfg_string, &mailbox_name, 0, NULL, | 137 | { "folder", mu_c_string, &mailbox_name, 0, NULL, |
138 | N_("Read messages from this folder.") }, | 138 | N_("Read messages from this folder.") }, |
139 | { "no-header", mu_cfg_bool, &no_header, 0, NULL, | 139 | { "no-header", mu_c_bool, &no_header, 0, NULL, |
140 | N_("Exclude all headers.") }, | 140 | N_("Exclude all headers.") }, |
141 | { "form-feeds", mu_cfg_bool, &form_feed, 0, NULL, | 141 | { "form-feeds", mu_c_bool, &form_feed, 0, NULL, |
142 | N_("Output formfeed character between messages.") }, | 142 | N_("Output formfeed character between messages.") }, |
143 | { "show-all-match", mu_cfg_bool, &show_all, 0, NULL, | 143 | { "show-all-match", mu_c_bool, &show_all, 0, NULL, |
144 | N_("Print all messages matching pattern, not only the first.") }, | 144 | N_("Print all messages matching pattern, not only the first.") }, |
145 | { NULL } | 145 | { NULL } |
146 | }; | 146 | }; | ... | ... |
... | @@ -281,12 +281,12 @@ cb_email (void *data, mu_config_value_t *val) | ... | @@ -281,12 +281,12 @@ cb_email (void *data, mu_config_value_t *val) |
281 | } | 281 | } |
282 | 282 | ||
283 | static struct mu_cfg_param sieve_cfg_param[] = { | 283 | static struct mu_cfg_param sieve_cfg_param[] = { |
284 | { "keep-going", mu_cfg_bool, &keep_going, 0, NULL, | 284 | { "keep-going", mu_c_bool, &keep_going, 0, NULL, |
285 | N_("Do not abort if execution fails on a message.") }, | 285 | N_("Do not abort if execution fails on a message.") }, |
286 | { "mbox-url", mu_cfg_string, &mbox_url, 0, NULL, | 286 | { "mbox-url", mu_c_string, &mbox_url, 0, NULL, |
287 | N_("Mailbox to sieve (defaults to user's mail spool)."), | 287 | N_("Mailbox to sieve (defaults to user's mail spool)."), |
288 | N_("url") }, | 288 | N_("url") }, |
289 | { "ticket", mu_cfg_string, &mu_ticket_file, 0, NULL, | 289 | { "ticket", mu_c_string, &mu_ticket_file, 0, NULL, |
290 | N_("Ticket file for user authentication."), | 290 | N_("Ticket file for user authentication."), |
291 | N_("ticket") }, | 291 | N_("ticket") }, |
292 | { "debug", mu_cfg_callback, NULL, 0, cb_debug, | 292 | { "debug", mu_cfg_callback, NULL, 0, cb_debug, |
... | @@ -297,9 +297,9 @@ static struct mu_cfg_param sieve_cfg_param[] = { | ... | @@ -297,9 +297,9 @@ static struct mu_cfg_param sieve_cfg_param[] = { |
297 | " P - network protocols (sieve.prot)\n" | 297 | " P - network protocols (sieve.prot)\n" |
298 | " t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n" | 298 | " t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n" |
299 | " i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR).") }, | 299 | " i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR).") }, |
300 | { "verbose", mu_cfg_bool, &verbose, 0, NULL, | 300 | { "verbose", mu_c_bool, &verbose, 0, NULL, |
301 | N_("Log all executed actions.") }, | 301 | N_("Log all executed actions.") }, |
302 | { "line-info", mu_cfg_bool, &sieve_print_locus, 0, NULL, | 302 | { "line-info", mu_c_bool, &sieve_print_locus, 0, NULL, |
303 | N_("Print source locations along with action logs (default).") }, | 303 | N_("Print source locations along with action logs (default).") }, |
304 | { "email", mu_cfg_callback, NULL, 0, cb_email, | 304 | { "email", mu_cfg_callback, NULL, 0, cb_email, |
305 | N_("Set user email address.") }, | 305 | N_("Set user email address.") }, | ... | ... |
-
Please register or sign in to post a comment