X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=init.c;h=079ecc7a0261e990a07f2aa04263000e93b9500c;hp=6e0d902d8c6888f1b4f731b224fae41560e3fe17;hb=e39e529e5df06cd4148de4614073b66a23be0b26;hpb=96d53ff49c308769efbf708e1e65819077cb7af6 diff --git a/init.c b/init.c index 6e0d902..079ecc7 100644 --- a/init.c +++ b/init.c @@ -32,6 +32,7 @@ #include "lib/intl.h" #include "lib/str.h" #include "lib/rx.h" +#include "lib/list.h" #include "lib/debug.h" #include @@ -485,7 +486,7 @@ static int remove_from_rx_list (list2_t** l, const char *str) int i = 0; if (mutt_strcmp ("*", str) == 0) { - list_del (l, rx_free); + list_del (l, (list_del_t*) rx_free); return (0); } else { @@ -698,7 +699,7 @@ static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data, /* "*" is a special case. */ if (!mutt_strcmp (buf->data, "*")) { mutt_free_spam_list (&SpamList); - list_del (&NoSpamList, rx_free); + list_del (&NoSpamList, (list_del_t*) rx_free); return 0; } @@ -2325,3 +2326,50 @@ int mutt_get_hook_type (const char *name) return c->data; return 0; } + +static int opt_cmp (const void* a, const void* b) { + return (mutt_strcmp ((*(struct option_t**) a)->option, + (*(struct option_t**) b)->option)); +} + +/* dump out the value of all the variables we have */ +int mutt_dump_variables (void) { + int i; + + char errbuff[STRING]; + char command[STRING]; + list2_t* tmp = NULL; + + BUFFER err, token; + + memset (&err, 0, sizeof (err)); + memset (&token, 0, sizeof (token)); + + err.data = errbuff; + err.dsize = sizeof (errbuff); + + /* get all non-synonyms into list... */ + for (i = 0; MuttVars[i].option; i++) { + if (MuttVars[i].type == DT_SYN) + continue; + list_push_back (&tmp, &MuttVars[i]); + } + if (!list_empty(tmp)) { + /* ...and dump list sorted */ + qsort (tmp->data, tmp->length, sizeof (void*), opt_cmp); + for (i = 0; i < tmp->length; i++) { + snprintf (command, sizeof (command), "set ?%s\n", + ((struct option_t*) tmp->data[i])->option); + if (mutt_parse_rc_line (command, &token, &err) == -1) { + fprintf (stderr, "%s\n", err.data); + FREE (&token.data); + list_del (&tmp, NULL); + return 1; + } + printf("%s\n", err.data); + } + } + FREE (&token.data); + list_del (&tmp, NULL); + return 0; +}