New option --clearpath
Showing
1 changed file
with
15 additions
and
0 deletions
... | @@ -28,12 +28,16 @@ mu_list_t mu_sieve_library_path = NULL; | ... | @@ -28,12 +28,16 @@ mu_list_t mu_sieve_library_path = NULL; |
28 | 28 | ||
29 | static error_t sieve_argp_parser (int key, char *arg, struct argp_state *state); | 29 | static error_t sieve_argp_parser (int key, char *arg, struct argp_state *state); |
30 | 30 | ||
31 | #define CLEARPATH_OPTION 256 | ||
32 | |||
31 | /* Options used by programs that use extended authentication mechanisms. */ | 33 | /* Options used by programs that use extended authentication mechanisms. */ |
32 | static struct argp_option sieve_argp_option[] = { | 34 | static struct argp_option sieve_argp_option[] = { |
33 | { "includedir", 'I', N_("DIR"), 0, | 35 | { "includedir", 'I', N_("DIR"), 0, |
34 | N_("Append directory DIR to the list of directories searched for include files"), 0 }, | 36 | N_("Append directory DIR to the list of directories searched for include files"), 0 }, |
35 | { "libdir", 'L', N_("DIR"), 0, | 37 | { "libdir", 'L', N_("DIR"), 0, |
36 | N_("Append directory DIR to the list of directories searched for library files"), 0 }, | 38 | N_("Append directory DIR to the list of directories searched for library files"), 0 }, |
39 | { "clearpath", CLEARPATH_OPTION, NULL, 0, | ||
40 | N_("Clear Sieve load path"), 0 }, | ||
37 | { NULL, 0, NULL, 0, NULL, 0 } | 41 | { NULL, 0, NULL, 0, NULL, 0 } |
38 | }; | 42 | }; |
39 | 43 | ||
... | @@ -49,6 +53,12 @@ static struct argp_child sieve_argp_child = { | ... | @@ -49,6 +53,12 @@ static struct argp_child sieve_argp_child = { |
49 | 0 | 53 | 0 |
50 | }; | 54 | }; |
51 | 55 | ||
56 | static void | ||
57 | destroy_string (void *str) | ||
58 | { | ||
59 | free (str); | ||
60 | } | ||
61 | |||
52 | static error_t | 62 | static error_t |
53 | sieve_argp_parser (int key, char *arg, struct argp_state *state) | 63 | sieve_argp_parser (int key, char *arg, struct argp_state *state) |
54 | { | 64 | { |
... | @@ -64,6 +74,10 @@ sieve_argp_parser (int key, char *arg, struct argp_state *state) | ... | @@ -64,6 +74,10 @@ sieve_argp_parser (int key, char *arg, struct argp_state *state) |
64 | plist = &mu_sieve_library_path; | 74 | plist = &mu_sieve_library_path; |
65 | break; | 75 | break; |
66 | 76 | ||
77 | case CLEARPATH_OPTION: | ||
78 | mu_list_destroy (&mu_sieve_library_path); | ||
79 | break; | ||
80 | |||
67 | case ARGP_KEY_INIT: | 81 | case ARGP_KEY_INIT: |
68 | #ifdef SIEVE_MODDIR | 82 | #ifdef SIEVE_MODDIR |
69 | plist = &mu_sieve_library_path; | 83 | plist = &mu_sieve_library_path; |
... | @@ -90,6 +104,7 @@ sieve_argp_parser (int key, char *arg, struct argp_state *state) | ... | @@ -90,6 +104,7 @@ sieve_argp_parser (int key, char *arg, struct argp_state *state) |
90 | mu_strerror (rc)); | 104 | mu_strerror (rc)); |
91 | exit (1); | 105 | exit (1); |
92 | } | 106 | } |
107 | mu_list_set_destroy_item (plist, destroy_string); | ||
93 | } | 108 | } |
94 | mu_list_append (*plist, strdup (arg)); | 109 | mu_list_append (*plist, strdup (arg)); |
95 | } | 110 | } | ... | ... |
-
Please register or sign in to post a comment