summaryrefslogtreecommitdiff
path: root/mailbox/mutil.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2005-06-23 13:23:37 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2005-06-23 13:23:37 +0000
commit554755172702ace341b4ed113408804984270789 (patch)
tree91690d9d85e506676ea6bfe98e948b7be09d2cb6 /mailbox/mutil.c
parent8c6fcf1e76574f20010acf98f77169c3afc6e443 (diff)
downloadmailutils-554755172702ace341b4ed113408804984270789.tar.gz
mailutils-554755172702ace341b4ed113408804984270789.tar.bz2
Use mu_mail_directory, mu_folder_directory and related calls.
Diffstat (limited to 'mailbox/mutil.c')
-rw-r--r--mailbox/mutil.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/mailbox/mutil.c b/mailbox/mutil.c
index ca7089cc6..f1c770978 100644
--- a/mailbox/mutil.c
+++ b/mailbox/mutil.c
@@ -518,25 +518,33 @@ mu_normalize_path (char *path, const char *delim)
return path;
}
-char *
-mu_normalize_maildir (const char *dir)
+int
+mu_normalize_mailbox_url (char **pout, const char *dir)
{
- int len = strlen (dir);
+ int len;
+
+ if (!pout)
+ return MU_ERR_OUT_PTR_NULL;
+
+ len = strlen (dir);
if (dir[len-1] == '/')
- return strdup (dir);
+ *pout = strdup (dir);
else if (strncasecmp (dir, "mbox:", 5) == 0 && dir[len-1] == '=')
{
if (len > 5 && strcmp (dir + len - 5, "user=") == 0)
- return strdup (dir);
+ *pout = strdup (dir);
else
- return NULL;
+ return MU_ERR_BAD_FILENAME;
}
else
{
- char *p = malloc (strlen (dir) + 2);
- strcat (strcpy (p, dir), "/");
- return p;
+ *pout = malloc (strlen (dir) + 2);
+ if (*pout)
+ strcat (strcpy (*pout, dir), "/");
}
+
+ /* Final check */
+ return (*pout == NULL) ? errno : 0;
}
/* Create and open a temporary file. Be very careful about it, since we

Return to:

Send suggestions and report system problems to the System administrator.