#include <errno.h>
#include <string.h>
#include <sys/types.h>
-
+#include <err.h>
#include "mlmmj.h"
}
if(listdir == NULL) {
- fprintf(stderr, "You have to specify -L\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L\n"
+ "%s -h for help\n", argv[0]);
}
/* Lets make sure no random user tries to send mail to the list */
"Have to invoke either as root "
"or as the user owning listdir "
"Invoked with uid = [%d]", (int)uid);
- writen(STDERR_FILENO,
- "Have to invoke either as root "
- "or as the user owning listdir\n", 60);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Have to invoke either as root "
+ "or as the user owning listdir");
}
} else {
log_error(LOG_ARGS, "Could not stat %s", listdir);
}
#define CHECKFULLPATH(name) if(strchr(name, '/') == NULL) { \
- fprintf(stderr, "All mlmmj binaries have to " \
- "be invoked with full path,\n" \
- "e.g. /usr/local/bin/%s\n", name); \
- exit(EXIT_FAILURE); \
+ errx(EXIT_FAILURE, "All mlmmj binaries have to " \
+ "be invoked with full path,\n" \
+ "e.g. /usr/local/bin/%s", name); \
};
/* make sure we use the wrappers */
#include <sys/mman.h>
#include <string.h>
#include <ctype.h>
+#include <err.h>
#include "getlistaddr.h"
#include "getlistdelim.h"
if(listdir == NULL || (address == NULL && dsnbounce == 0)
|| (number == NULL && probe == 0)) {
- fprintf(stderr,
- "You have to specify -L, -a or -d and -n or -p\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L, -a or -d and -n or -p\n"
+ "%s -h for help", argv[0]);
}
/* Lets make sure no random user tries to do bouncehandling */
log_error(LOG_ARGS,
"Have to invoke either as root "
"or as the user owning listdir");
- writen(STDERR_FILENO,
- "Have to invoke either as root "
- "or as the user owning listdir\n", 60);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Have to invoke either as root "
+ "or as the user owning listdir");
}
} else {
log_error(LOG_ARGS, "Could not stat %s", listdir);
address = lowcaseaddr;
if(number != NULL && probe != 0) {
- fprintf(stderr, "You can only specify one of -n or -p\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You can only specify one of -n or -p\n"
+ "%s -h for help", argv[0]);
}
if (probe) {
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <err.h>
#include "mlmmj.h"
#include "wrappers.h"
}
if(listdir == NULL) {
- fprintf(stderr, "You have to specify -L\n"
- "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L\n"
+ "%s -h for help", argv[0]);
}
switch(typesub) {
if(subdir) {
dirp = opendir(subdir);
if(dirp == NULL) {
- fprintf(stderr, "Could not opendir(%s);\n", subdir);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Could not opendir(%s);", subdir);
}
while((dp = readdir(dirp)) != NULL) {
if((strcmp(dp->d_name, "..") == 0) ||
}
if(listdir == NULL && dirlists == NULL) {
- fprintf(stderr, "You have to specify -d or -L\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -d or -L\n"
+ "%s -h for help", argv[0]);
}
if(listdir && dirlists) {
- fprintf(stderr, "You have to specify either -d or -L\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify either -d or -L\n"
+ "%s -h for help", argv[0]);
}
bindir = mydirname(argv[0]);
#include <sys/wait.h>
#include <libgen.h>
#include <regex.h>
+#include <err.h>
#include "mlmmj.h"
#include "wrappers.h"
}
if(listdir == NULL || mailfile == NULL) {
- fprintf(stderr, "You have to specify -L and -m\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L and -m\n"
+ "%s -h for help", argv[0]);
}
/* Lets make sure no random user tries to send mail to the list */
log_error(LOG_ARGS,
"Have to invoke either as root "
"or as the user owning listdir");
- writen(STDERR_FILENO,
- "Have to invoke either as root "
- "or as the user owning listdir\n", 60);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Have to invoke either as root "
+ "or as the user owning listdir");
}
} else {
log_error(LOG_ARGS, "Could not stat %s", listdir);
#include <sys/stat.h>
#include <fcntl.h>
#include <libgen.h>
+#include <err.h>
#include "mlmmj.h"
#include "wrappers.h"
}
if(listdir == NULL) {
- fprintf(stderr, "You have to specify -L\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L\n"
+ "%s -h for help", argv[0]);
}
/* Lets make sure no random user tries to send mail to the list */
"Have to invoke either as root "
"or as the user owning listdir "
"Invoked with uid = [%d]", (int)uid);
- writen(STDERR_FILENO,
- "Have to invoke either as root "
- "or as the user owning listdir\n", 60);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Have to invoke either as root "
+ "or as the user owning listdir");
}
} else {
log_error(LOG_ARGS, "Could not stat %s", listdir);
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
+#include <err.h>
#include "mlmmj.h"
#include "mlmmj-send.h"
}
if(mailfilename == NULL || (listdir == NULL && listctrl == NULL)) {
- fprintf(stderr, "You have to specify -m and -L or -l\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -m and -L or -l\n"
+ "%s -h for help", argv[0]);
}
/* Lets make sure no random user tries to send mail to the list */
log_error(LOG_ARGS,
"Have to invoke either as root "
"or as the user owning listdir");
- writen(STDERR_FILENO,
+ errx(EXIT_FAILURE,
"Have to invoke either as root "
- "or as the user owning listdir\n", 60);
- exit(EXIT_FAILURE);
+ "or as the user owning listdir");
}
} else {
log_error(LOG_ARGS, "Could not stat %s", listdir);
/* get the list address */
if(listctrl[0] == '1' && (bounceaddr == NULL || to_addr == NULL)) {
- fprintf(stderr, "With -l 1 you need -F and -T\n");
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "With -l 1 you need -F and -T");
}
if((listctrl[0] == '2' && (listdir == NULL || bounceaddr == NULL))) {
- fprintf(stderr, "With -l 2 you need -L and -F\n");
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "With -l 2 you need -L and -F");
}
if((listctrl[0] == '7' && listdir == NULL)) {
- fprintf(stderr, "With -l 7 you need -L\n");
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "With -l 7 you need -L");
}
verp = ctrlvalue(listdir, "verp");
#include <libgen.h>
#include <sys/wait.h>
#include <ctype.h>
+#include <err.h>
#include "mlmmj.h"
#include "mlmmj-sub.h"
}
if(listdir == NULL) {
- fprintf(stderr, "You have to specify -L\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L\n"
+ "%s -h for help", argv[0]);
}
if(address == NULL && modstr == NULL) {
- fprintf(stderr, "You have to specify -a or -m\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -a or -m\n"
+ "%s -h for help", argv[0]);
}
if(both + digest + nomail > 1) {
- fprintf(stderr, "Specify at most one of -b, -d and -n\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Specify at most one of -b, -d and -n\n"
+ "%s -h for help", argv[0]);
}
if(digest)
typesub = SUB_BOTH;
if(reasonsub == SUB_CONFIRM && subconfirm) {
- fprintf(stderr, "Cannot specify both -C and -R\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Cannot specify both -C and -R\n"
+ "%s -h for help", argv[0]);
}
if(modstr) {
if(setuid(st.st_uid) < 0) {
perror("setuid");
fprintf(stderr, "Continuing as uid %d\n",
- (int)uid);
+ (int)uid);
}
}
}
}
}
if(listdir == 0 || address == 0) {
- fprintf(stderr, "You have to specify -L and -a\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "You have to specify -L and -a\n"
+ "%s -h for help", argv[0]);
}
if(digest + nomail + normal > 1) {
- fprintf(stderr, "Specify at most one of -d, -n and -N\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Specify at most one of -d, -n and -N\n"
+ "%s -h for help", argv[0]);
}
if(digest)
typesub = SUB_NORMAL;
if(confirmunsub && unsubconfirm) {
- fprintf(stderr, "Cannot specify both -C and -c\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Cannot specify both -C and -c\n"
+ "%s -h for help", argv[0]);
}
if(reasonsub == SUB_CONFIRM && unsubconfirm) {
- fprintf(stderr, "Cannot specify both -C and -R\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Cannot specify both -C and -R\n"
+ "%s -h for help", argv[0]);
}
if(reasonsub == SUB_BOUNCING && unsubconfirm) {
- fprintf(stderr, "Cannot specify both -C and -b\n");
- fprintf(stderr, "%s -h for help\n", argv[0]);
- exit(EXIT_FAILURE);
+ errx(EXIT_FAILURE, "Cannot specify both -C and -b\n"
+ "%s -h for help", argv[0]);
}
/* Make the address lowercase */