diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-07-09 11:50:53 +0200 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-07-09 11:50:53 +0200 |
commit | 71a7b2919d040048b61ecccefbbb208bfe90c806 (patch) | |
tree | 14fc498edbc516926ce841c6ea756d395f01ede6 /femtomail.c | |
parent | 2523835aaccc6663f9884b82c778abcccaddbd82 (diff) | |
download | femtomail-71a7b2919d040048b61ecccefbbb208bfe90c806.tar.gz |
Fix-up macro expansion of USERNAME and MAILBOX_PATH
Diffstat (limited to 'femtomail.c')
-rw-r--r-- | femtomail.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/femtomail.c b/femtomail.c index 6bc1fb8..4442b93 100644 --- a/femtomail.c +++ b/femtomail.c @@ -3,8 +3,8 @@ * Maildir box. Note: this program does not try to implement sendmail. * * Installation commands: - * $ cc -DUSERNAME=$USER femtomail.c -o femtomail - * (Optional override: -DMAILBOX_PATH=.Maildir/inbox) + * $ cc -DUSERNAME=\"$USER\" femtomail.c -o femtomail + * (Optional override: -DMAILBOX_PATH=\".Maildir/inbox\") * # install -m 755 femtomail /usr/bin/sendmail * # setcap cap_setuid,cap_setgid=ep /usr/bin/sendmail * @@ -38,15 +38,13 @@ #include <pwd.h> #include <sys/prctl.h> -#define STRINGIFY(str) #str - #ifndef USERNAME # error Please define the user to deliver mail to with USERNAME #endif /* Maildir directory relative to home dir of USERNAME (see above) */ #ifndef MAILBOX_PATH -# define MAILBOX_PATH .local/share/local-mail/inbox +# define MAILBOX_PATH ".local/share/local-mail/inbox" #endif /* change user/group context to username and fill in maildir path */ @@ -69,7 +67,7 @@ init_user(const char *username, char *maildir, size_t maildir_len) { return 1; } - snprintf(maildir, maildir_len, "%s/" STRINGIFY(MAILBOX_PATH) "/new", pwd->pw_dir); + snprintf(maildir, maildir_len, "%s/" MAILBOX_PATH "/new", pwd->pw_dir); return 0; } @@ -199,7 +197,7 @@ main(int argc, char **argv) { return (EXIT_FAILURE); } - if (init_user(STRINGIFY(USERNAME), maildir, sizeof(maildir))) { + if (init_user((USERNAME), maildir, sizeof(maildir))) { return (EXIT_FAILURE); } |