+/*
+ * prototypes
+ */
+static const struct mapping_t* get_sortmap (struct option_t* option);
+static int parse_sort (struct option_t* dst, const char *s,
+ const struct mapping_t *map,
+ char* errbuf, ssize_t errlen);
+
+static hash_t *ConfigOptions = NULL;
+
+/* for synonym warning reports: synonym found during parsing */
+typedef struct syn_t {
+ struct syn_t *next;
+ char* f; /* file */
+ int l; /* line */
+ struct option_t* n; /* new */
+ struct option_t* o; /* old */
+} syn_t;
+
+DO_INIT(syn_t, syn);
+static void syn_wipe(syn_t *syn) {
+ p_delete(&syn->f);
+}
+DO_NEW(syn_t, syn);
+DO_DELETE(syn_t, syn);
+DO_SLIST(syn_t, syn, syn_delete);
+
+/* for synonym warning reports: list of synonyms found */
+static syn_t *Synonyms = NULL;
+/* for synonym warning reports: current rc file */
+static const char* CurRCFile = NULL;
+/* for synonym warning reports: current rc line */
+static int CurRCLine = 0;
+
+/* prototypes for checking for special vars */
+static int check_history (const char* option, unsigned long val,
+ char* errbuf, ssize_t errlen);
+/* this checks that numbers are >= 0 */
+static int check_num (const char* option, unsigned long val,
+ char* errbuf, ssize_t errlen);
+
+/* use this to check only */
+static int check_special (const char* option, unsigned long val,
+ char* errbuf, ssize_t errlen);
+
+/* variable <-> sanity check function mappings
+ * when changing these, make sure the proper _from_string handler
+ * does this checking!
+ */
+static struct {
+ const char* name;
+ int (*check) (const char* option, unsigned long val,
+ char* errbuf, ssize_t errlen);
+} SpecialVars[] = {
+#if defined (USE_LIBESMTP) && (defined (USE_SSL) || defined (USE_GNUTLS))
+ { "smtp_use_tls", mutt_libesmtp_check_usetls },
+#endif
+ { "history", check_history },
+ { "pager_index_lines", check_num },
+ /* last */
+ { NULL, NULL }
+};
+
+static void bool_to_string (char* dst, ssize_t dstlen,
+ struct option_t* option) {
+ snprintf (dst, dstlen, "%s=%s", option->option,
+ option (option->data) ? "yes" : "no");