106 #include <sys/stat.h>
107 #include <sys/wait.h>
142 msg_fatal(
"usage: %s [-c config_dir] [-l lock_style] [-v] folder command...", myname);
147 static void fatal_exit(
void)
156 int main(
int argc,
char **argv)
168 char *lock_style = 0;
187 for (fd = 0; fd < 3; fd++)
188 if (
fstat(fd, &st) == -1
189 && (close(fd), open(
"/dev/null", O_RDWR, 0)) != fd)
209 while ((ch =
GETOPT(argc, argv,
"c:l:v")) > 0) {
226 if (optind + 2 > argc)
228 folder = argv[optind];
229 command = argv + optind + 1;
248 if ((mp =
mbox_open(folder, O_APPEND | O_WRONLY | O_CREAT,
249 S_IRUSR | S_IWUSR, (
struct stat *) 0,
250 -1, -1, lock_mask,
"5.2.0", why)) == 0)
257 for (count = 1; (pid = fork()) == -1; count++) {
258 msg_warn(
"fork %s: %m", command[0]);
268 execvp(command[0], command);
271 if (waitpid(pid, &status, 0) < 0)
275 exit(WIFEXITED(status) ? WEXITSTATUS(status) : 1);
MAIL_VERSION_STAMP_DECLARE
DSN_BUF * dsb_create(void)
char * var_import_environ
ARGV * argv_free(ARGV *argvp)
#define VAR_IMPORT_ENVIRON
void(* MSG_CLEANUP_FN)(void)
void dsb_free(DSN_BUF *dsb)
void mail_conf_read(void)
ARGV * mail_parm_split(const char *name, const char *value)
int vstream_fclose(VSTREAM *stream)
int mbox_lock_mask(const char *string)
void msg_warn(const char *fmt,...)
void mbox_release(MBOX *mp)
#define MAIL_VERSION_STAMP_ALLOCATE
NORETURN msg_fatal(const char *fmt,...)
void update_env(char **preserve_list)
#define GETOPT(argc, argv, str)
int main(int argc, char **argv)
void msg_vstream_init(const char *name, VSTREAM *vp)
char * get_mail_conf_str(const char *, const char *, int, int)
MBOX * mbox_open(const char *path, int flags, mode_t mode, struct stat *st, uid_t chown_uid, gid_t chown_gid, int lock_style, const char *def_dsn, DSN_BUF *why)
MSG_CLEANUP_FN msg_cleanup(MSG_CLEANUP_FN cleanup_fn)