summaryrefslogtreecommitdiff
path: root/femtomail.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-09-09 00:03:39 +0200
committerPeter Wu <peter@lekensteyn.nl>2015-09-09 00:11:23 +0200
commit7c6e845bc7443d3222c9e363b9cc5436bb5b36ae (patch)
treee608c5a48a0fcfb7966a0737beb8a19f2334a942 /femtomail.c
parenta646eb75a5639d942865ad402983f27ded1eac70 (diff)
downloadfemtomail-7c6e845bc7443d3222c9e363b9cc5436bb5b36ae.tar.gz
Support absolute paths for MAILBOX_PATH
And in case somebody decides to put a format specifier in MAILBOX_PATH, pass it as argument. Suggestion made by an anonymous user by email.
Diffstat (limited to 'femtomail.c')
-rw-r--r--femtomail.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/femtomail.c b/femtomail.c
index b07d7a7..2838463 100644
--- a/femtomail.c
+++ b/femtomail.c
@@ -42,7 +42,8 @@
# error Please define the user to deliver mail to with USERNAME
#endif
-/* Maildir directory relative to home dir of USERNAME (see above) */
+/* Maildir; either absolute (starting with a forward slash) or
+ * a directory relative to home dir of USERNAME (see above) */
#ifndef MAILBOX_PATH
# define MAILBOX_PATH ".local/share/local-mail/inbox"
#endif
@@ -67,7 +68,11 @@ init_user(const char *username, char *maildir, size_t maildir_len) {
return 1;
}
- snprintf(maildir, maildir_len, "%s/" MAILBOX_PATH "/new", pwd->pw_dir);
+ if ((MAILBOX_PATH)[0] == '/') {
+ snprintf(maildir, maildir_len, "%s/new", MAILBOX_PATH);
+ } else {
+ snprintf(maildir, maildir_len, "%s/%s/new", pwd->pw_dir, MAILBOX_PATH);
+ }
return 0;
}