tools+libremail: Some refactoring
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "libremail/file.h"
|
||||
#include "libremail/common.h"
|
||||
|
||||
/* Maximum command components */
|
||||
#define CMD_MAX_CNP 6
|
||||
@@ -15,8 +16,6 @@
|
||||
/* Mailutil version */
|
||||
#define MAILUTIL_VERSION "0.0.1"
|
||||
|
||||
#define DEFAULT_MAILBOX_MODE 0600
|
||||
|
||||
/*
|
||||
* Macro used to assert that the command list count is not
|
||||
* zero to avoid code duplication.
|
||||
@@ -65,7 +64,8 @@ cmd_mailbox_create(const char *cmdlist[CMD_MAX_CNP], size_t count)
|
||||
|
||||
ASSERT_COUNT_N(count, 3);
|
||||
|
||||
snprintf(pathbuf, sizeof(pathbuf), "/var/mail/%s", cmdlist[2]);
|
||||
snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
|
||||
MAILBOX_PREFIX, cmdlist[2]);
|
||||
|
||||
/* Create the mailbox */
|
||||
if (try_mkdir(pathbuf, DEFAULT_MAILBOX_MODE) < 0) {
|
||||
@@ -74,9 +74,7 @@ cmd_mailbox_create(const char *cmdlist[CMD_MAX_CNP], size_t count)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("created mailbox '%s' @ %s\n",
|
||||
cmdlist[2], pathbuf);
|
||||
|
||||
printf("created mailbox '%s' @ %s\n", cmdlist[2], pathbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user