bye bye DT_SYS variables.
[apps/madmutt.git] / init.c
diff --git a/init.c b/init.c
index 6cfbf6a..0d8b52b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -112,7 +112,6 @@ static void sort_to_string  (char* dst, ssize_t dstlen, struct option_t* option)
 static void rx_to_string    (char* dst, ssize_t dstlen, struct option_t* option);
 static void magic_to_string (char* dst, ssize_t dstlen, struct option_t* option);
 static void addr_to_string  (char* dst, ssize_t dstlen, struct option_t* option);
-static void sys_to_string   (char* dst, ssize_t dstlen, struct option_t* option);
 
 /* protos for config type handles: convert to value from string */
 static int bool_from_string  (struct option_t* dst, const char* val,
@@ -153,7 +152,6 @@ static struct {
    * but must define it as DT_ is used for indexing */
   { DT_SYN,     NULL,             NULL },
   { DT_ADDR,    addr_to_string,   addr_from_string },
-  { DT_SYS,     sys_to_string,    NULL },
 };
 
 static void bool_to_string (char* dst, ssize_t dstlen,
@@ -229,49 +227,6 @@ static void str_to_string (char* dst, ssize_t dstlen,
             NONULL (*((char**) option->data)));
 }
 
-static void sys_to_string (char* dst, ssize_t dstlen,
-                           struct option_t* option) {
-  char *val = NULL, *t = NULL;
-  int clean = 0;
-
-  /* get some $madmutt_ values dynamically */
-  if (m_strcmp("madmutt_pwd", option->option) == 0) {
-    val = p_new(char, _POSIX_PATH_MAX);
-    val = getcwd (val, _POSIX_PATH_MAX-1);
-    clean = 1;
-  } else if (m_strcmp("madmutt_folder_path", option->option) == 0 &&
-             CurrentFolder && *CurrentFolder) {
-    val = CurrentFolder;
-  } else if (m_strcmp("madmutt_folder_name", option->option) == 0 &&
-             CurrentFolder && *CurrentFolder) {
-
-    ssize_t Maildirlength = m_strlen(Maildir);
-
-    /*
-     * if name starts with $folder, just strip it to keep hierarchy
-     * $folder=imap://host, path=imap://host/inbox/b -> inbox/b
-     */
-    if (Maildirlength > 0 && m_strncmp(CurrentFolder, Maildir,
-                                      Maildirlength) == 0 &&
-       m_strlen(CurrentFolder) > Maildirlength) {
-     val = CurrentFolder + Maildirlength;
-     if (Maildir[Maildirlength]!='/')
-       val += 1;
-     /* if not $folder, just use everything after last / */
-    } else if ((t = strrchr (CurrentFolder, '/')) != NULL)
-      val = t+1;
-    /* default: use as-is */
-    else
-      val = (char *) CurrentFolder;
-
-  } else
-    val = (char *) option->init;
-
-  snprintf (dst, dstlen, "%s=\"%s\"", option->option, NONULL (val));
-  if (clean)
-    p_delete(&val);
-}
-
 static int path_from_string (struct option_t* dst, const char* val,
                              char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
   char path[_POSIX_PATH_MAX];
@@ -1665,14 +1620,13 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
              DTYPE (option->type) == DT_MAGIC ||
              DTYPE (option->type) == DT_NUM ||
              DTYPE (option->type) == DT_SORT ||
-             DTYPE (option->type) == DT_RX ||
-             DTYPE (option->type) == DT_SYS) {
-
+             DTYPE (option->type) == DT_RX)
+    {
       /* XXX maybe we need to get unset into handlers? */
       if (DTYPE (option->type) == DT_STR ||
           DTYPE (option->type) == DT_PATH ||
-          DTYPE (option->type) == DT_ADDR ||
-          DTYPE (option->type) == DT_SYS) {
+          DTYPE (option->type) == DT_ADDR)
+      {
         if (unset) {
           CHECK_PAGER;
           if (!FuncTable[DTYPE (option->type)].opt_fromstr) {
@@ -2261,12 +2215,7 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
 
   ConfigOptions = hash_create (sizeof(MuttVars) * 2);
   for (i = 0; MuttVars[i].option; i++) {
-    if (DTYPE (MuttVars[i].type) != DT_SYS)
-      hash_insert (ConfigOptions, MuttVars[i].option, &MuttVars[i], 0);
-    else
-      hash_insert (ConfigOptions, MuttVars[i].option,
-                   add_option (MuttVars[i].option, MuttVars[i].init,
-                               DT_SYS, 0), 0);
+    hash_insert (ConfigOptions, MuttVars[i].option, &MuttVars[i], 0);
   }
 
   /*