#include "mlmmj-maintd.h"
#include "mlmmj.h"
#include "strgen.h"
+#include "chomp.h"
#include "log_error.h"
#include "mygetline.h"
char *discardedname = NULL;
char *dirname = concatstr(2, listdir, "/queue/");
FILE *ffrom, *fto, *f;
- size_t len;
pid_t pid;
struct stat st;
- time_t t;
int discarded = 0;
if(chdir(dirname) < 0) {
}
while((dp = readdir(queuedir)) != NULL) {
- if(strchr(dp->d_name, "."))
+ if(strchr(dp->d_name, '.'))
continue;
if(stat(dp->d_name, &st) < 0) {
log_error(LOG_ARGS, "Could not stat(%s)",dp->d_name);
} else {
log_error(LOG_ARGS, "Could not stat(%s)",
dp->d_name);
+ }
}
toname = concatstr(2, mailname, ".reciptto");
discarded = discardmail(mailname,
discardedname,
3600);
+ } else {
+ log_error(LOG_ARGS, "Could not stat(%s)",
+ dp->d_name);
}
}
}
from = myfgetline(ffrom);
+ chomp(from);
fclose(ffrom);
unlink(fromname);
free(fromname);
to = myfgetline(fto);
+ chomp(to);
fclose(fto);
unlink(toname);
free(toname);
repto = NULL;
} else {
repto = myfgetline(f);
+ chomp(repto);
fclose(f);
unlink(reptoname);
free(reptoname);
pid = fork();
if(pid == 0) {
- if(repto)
+ if(repto) {
+ printf("%s -l %s -m %s -F %s -T %s -R %s -a\n",
+ mlmmjsend, "1", mailname, from,
+ to, repto);
execlp(mlmmjsend, mlmmjsend,
"-l", "1",
"-m", mailname,
"-T", to,
"-R", repto,
"-a", 0);
- else
+ } else {
+ printf("%s -l %s -m %s -F %s -T %s -a\n",
+ mlmmjsend, "1", mailname, from, to);
execlp(mlmmjsend, mlmmjsend,
"-l", "1",
"-m", mailname,
"-F", from,
"-T", to,
"-a", 0);
+ }
}
+ }
return 0;
}