post (not spost) had written into a temp file those addresses to which it
had delivered mail. annoaux() in send had read from this temp file and
annotated the original message with each of those addresses. Now, no
addresses at all get annotated, but only the date of the action.
static void armed_done(int) NORETURN;
static void alert(char *, int);
static int tmp_fd(void);
static void armed_done(int) NORETURN;
static void alert(char *, int);
static int tmp_fd(void);
-static void anno(int, struct stat *);
-static void annoaux(int);
+static void anno(struct stat *);
+static void annoaux(void);
static int sendaux(char **, int, char *, struct stat *);
static int attach(char *);
static void clean_up_temporary_files(void);
static int sendaux(char **, int, char *, struct stat *);
static int attach(char *);
static void clean_up_temporary_files(void);
sendaux(char **vec, int vecp, char *drft, struct stat *st)
{
pid_t child_id;
sendaux(char **vec, int vecp, char *drft, struct stat *st)
{
pid_t child_id;
- int i, status, fd, fd2;
+ /*
+ ** fd collects the output of postproc, and is used for the
+ ** failure notice if we need to send one in alert().
+ */
fd = pushsw ? tmp_fd() : NOTOK;
fd = pushsw ? tmp_fd() : NOTOK;
- if (annotext && (fd2 = tmp_fd()) == NOTOK) {
- admonish(NULL, "unable to create file for annotation list");
- }
if (distfile && distout(drft, distfile, backup) == NOTOK) {
done(1);
}
if (distfile && distout(drft, distfile, backup) == NOTOK) {
done(1);
}
for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) {
sleep(5);
}
for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) {
sleep(5);
}
switch (child_id) {
case -1:
/* oops -- fork error */
switch (child_id) {
case -1:
/* oops -- fork error */
default:
/* parent process -- wait for it */
if ((status = pidwait(child_id, NOTOK)) == OK) {
default:
/* parent process -- wait for it */
if ((status = pidwait(child_id, NOTOK)) == OK) {
- if (annotext && fd2 != NOTOK)
- anno(fd2, st);
+ if (annotext) {
+ anno(st);
+ }
} else {
/*
** If postproc failed, and we have good fd (which
} else {
/*
** If postproc failed, and we have good fd (which
} else {
advise(NULL, "message not delivered to anyone");
}
} else {
advise(NULL, "message not delivered to anyone");
}
- if (annotext && fd2 != NOTOK) {
- close(fd2);
- }
if (distfile) {
unlink(drft);
if (rename(backup, drft) == NOTOK) {
if (distfile) {
unlink(drft);
if (rename(backup, drft) == NOTOK) {
-anno(int fd, struct stat *st)
{
pid_t child_id;
sigset_t set, oset;
{
pid_t child_id;
sigset_t set, oset;
sigaddset(&set, SIGTERM);
SIGPROCMASK(SIG_BLOCK, &set, &oset);
sigaddset(&set, SIGTERM);
SIGPROCMASK(SIG_BLOCK, &set, &oset);
if (child_id == OK) {
_exit(0);
}
if (child_id == OK) {
_exit(0);
}
break;
default: /* no waiting... */
break;
default: /* no waiting... */
{
int fd2, fd3, msgnum;
char *cp, *folder, *maildir;
{
int fd2, fd3, msgnum;
char *cp, *folder, *maildir;
- char buffer[BUFSIZ], **ap;
- FILE *fp;
struct msgs *mp;
if (!(folder = getenv("mhfolder")) || !*folder) {
struct msgs *mp;
if (!(folder = getenv("mhfolder")) || !*folder) {
- lseek(fd, (off_t) 0, SEEK_SET);
- if ((fp = fdopen(fd, "r")) == NULL) {
- if (debugsw) {
- admonish(NULL, "unable to fdopen annotation list");
- }
- goto oops;
- }
- cp = NULL;
- while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- cp = add(buffer, cp);
- }
- fclose(fp);
-
- advise(NULL, "annotate%s with %s: \"%s\"",
- inplace ? " inplace" : "", annotext, cp);
+ advise(NULL, "annotate%s as `%s'", inplace ? " inplace" : "",
+ annotext);
}
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected(mp, msgnum)) {
if (debugsw) {
advise(NULL, "annotate message %d", msgnum);
}
}
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected(mp, msgnum)) {
if (debugsw) {
advise(NULL, "annotate message %d", msgnum);
}
- annotate(m_name(msgnum), annotext, cp, inplace,
+ annotate(m_name(msgnum), annotext, NULL, inplace,