]> git.marmaro.de Git - mmh/blobdiff - uip/mhstoresbr.c
Replaced second line of Content-Tyhpe of -attachformat 0 example.
[mmh] / uip / mhstoresbr.c
index 2e88df231c11b601eaad5d101afe369e476ae6b6..5776ef357859f4e492e87ae0b275303e5219aa37 100644 (file)
@@ -20,8 +20,8 @@
 #include <h/tws.h>
 #include <h/mime.h>
 #include <h/mhparse.h>
 #include <h/tws.h>
 #include <h/mime.h>
 #include <h/mhparse.h>
+#include <h/utils.h>
 
 
-extern int errno;
 
 /*
  * The list of top-level contents to display
 
 /*
  * The list of top-level contents to display
@@ -75,7 +75,6 @@ static int store_external (CT);
 static int ct_compar (CT *, CT *);
 static int store_content (CT, CT);
 static int output_content_file (CT, int);
 static int ct_compar (CT *, CT *);
 static int store_content (CT, CT);
 static int output_content_file (CT, int);
-static int check_folder (char *);
 static int output_content_folder (char *, char *);
 static int parse_format_string (CT, char *, char *, int, char *);
 static void get_storeproc (CT);
 static int output_content_folder (char *, char *);
 static int parse_format_string (CT, char *, char *, int, char *);
 static void get_storeproc (CT);
@@ -571,8 +570,7 @@ store_content (CT ct, CT p)
            folder = getfolder (1);
 
        /* Check if folder exists */
            folder = getfolder (1);
 
        /* Check if folder exists */
-       if (check_folder (folder) == NOTOK)
-           return NOTOK;
+       create_folder(folder, 0, exit);
 
        /* Record the folder name */
        ct->c_folder = add (folder, NULL);
 
        /* Record the folder name */
        ct->c_folder = add (folder, NULL);
@@ -863,47 +861,6 @@ losing:
 }
 
 
 }
 
 
-/*
- * Check if folder exists, and create
- * if necessary.
- */
-
-static int
-check_folder (char *folder)
-{
-    char *folderdir;
-    struct stat st;
-
-    /* expand path to the folder */
-    folderdir = m_mailpath (folder);
-
-    /* Check if folder exists */
-    if (stat (folderdir, &st) == NOTOK) {
-       int answer;
-       char *ep;
-
-       if (errno != ENOENT) {
-           advise (folderdir, "error on folder");
-           return NOTOK;
-       }
-
-       ep = concat ("Create folder \"", folderdir, "\"? ", NULL);
-       answer = getanswer (ep);
-       free (ep);
-
-       if (!answer)
-           return NOTOK;
-
-       if (!makedir (folderdir)) {
-           advise (NULL, "unable to create folder %s", folderdir);
-           return NOTOK;
-       }
-    }
-
-    return OK;
-}
-
-
 /*
  * Add a file to a folder.
  *
 /*
  * Add a file to a folder.
  *
@@ -921,7 +878,7 @@ output_content_folder (char *folder, char *filename)
     /* Read the folder. */
     if ((mp = folder_read (folder))) {
        /* Link file into folder */
     /* Read the folder. */
     if ((mp = folder_read (folder))) {
        /* Link file into folder */
-       msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0);
+       msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0, (char *)0);
     } else {
        advise (NULL, "unable to read folder %s", folder);
        return NOTOK;
     } else {
        advise (NULL, "unable to read folder %s", folder);
        return NOTOK;