- /* "remove" the SELECTED messages */
- folder_delmsgs (mp, unlink_msgs, 0);
+ /* Mark that the sequence information has changed */
+ mp->msgflags |= SEQMOD;
+
+ if (mp->numsel+4 > MAXARGS)
+ adios(NULL, "more than %d messages for refile exec",
+ MAXARGS - 4);
+ vec = (char **)mh_xmalloc((size_t)(mp->numsel + 4) * sizeof(*vec));
+ vec[vecp++] = "refile";
+ vec[vecp++] = "-nolink";
+ vec[vecp++] = concat("+", trashfolder, NULL);
+ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
+ if (!is_selected(mp, msgnum)) {
+ continue;
+ }
+ if (!(vec[vecp++] = strdup(m_name(msgnum)))) {
+ adios(NULL, "strdup failed");
+ }
+ }
+ vec[vecp] = NULL;
+
+ fflush(stdout);
+ switch (pid = fork()) {
+ case -1:
+ adios("fork", "unable to");
+
+ case 0:
+ execvp(*vec, vec);
+ fprintf(stderr, "unable to exec ");
+ perror(*vec);
+ _exit(-1);
+
+ default:
+ pidwait(pid, -1);
+ }