#include <h/mime.h>
#include <h/tws.h>
#include <h/utils.h>
+#include <sysexits.h>
+#include <sys/wait.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#include <time.h>
int debugsw = 0; /* global */
+int verbosesw = 0;
char *altmsg = NULL;
char *annotext = NULL;
char *distfile = NULL;
static void clean_up_temporary_files(void);
static int get_line(void);
static void make_mime_composition_file_entry(char *);
+static char* strexit(int status);
static struct swit switches[] = {
debugsw++;
/* fall */
case VERBSW:
+ verbosesw += 2;
case NVERBSW:
+ verbosesw--;
vec[vecp++] = --cp;
continue;
}
default:
/* parent process -- wait for it */
- if ((status = pidwait(child_id, NOTOK)) == OK) {
+ status = pidwait(child_id, NOTOK);
+ if (WIFEXITED(status) && WEXITSTATUS(status) == EX_OK) {
if (annotext) {
anno(st);
}
- } else {
- /* spost failed */
- advise(NULL, "message not delivered to anyone");
+ }
+ else {
+ advise(NULL, "%s", strexit(status));
+ if (verbosesw <= 0) {
+ advise(NULL, "Try using -v to get better output");
+ }
if (distfile) {
unlink(drft);
if (rename(backup, drft) == NOTOK) {
}
}
}
- break;
}
+
return status;
}
}
+char*
+strexit(int status)
+{
+ if (WIFSIGNALED(status)) {
+ return "spost or sendmail killed by signal";
+ }
+ if (!WIFEXITED(status)) {
+ return "sendmail stopt for unknown reasen, message not deliverd to anyone";
+ }
+ switch (WEXITSTATUS(status)) {
+ case EX_TEMPFAIL:
+ return "Temporary error, maby the MTA hase queued the Mail";
+ default:
+ return "sendmail stopt for unknown reasen, message not deliverd to anyone";
+ }
+}
+
+
static void
armed_done(int status)
{