-
- if ((cp = getenv("mhmessages")) == NULL || *cp == 0) {
- if (debugsw)
- admonish(NULL, "$mhmessages not set");
- goto oops;
- }
- if (!debugsw /* MOBY HACK... */
- && pushsw
- && (fd3 = open("/dev/null", O_RDWR)) != NOTOK
- && (fd2 = dup(fileno(stderr))) != NOTOK) {
- dup2(fd3, fileno(stderr));
- close(fd3);
- } else
- fd2 = NOTOK;
- for (ap = brkstring(cp = getcpy(cp), " ", NULL); *ap; ap++)
- m_convert(mp, *ap);
- free(cp);
- if (fd2 != NOTOK)
- dup2(fd2, fileno(stderr));
- if (mp->numsel == 0) {
- if (debugsw)
- admonish(NULL, "no messages to annotate");
- goto oops;
- }
-
- 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);
-
- if (debugsw)
- advise(NULL, "annotate%s with %s: \"%s\"",
- inplace ? " inplace" : "", annotext, cp);
- 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,
- 1, -2, 0);
- }
+ snprintf(buf, sizeof buf, "anno -comp '%s' '+%s' %s",
+ annotext, folder, msgs);
+ if (system(buf) != 0) {
+ advise(NULL, "unable to annotate");