- /* "remove" the SELECTED messages */
- folder_delmsgs(mp, unlink_msgs, 0);
+ /* remove by refiling. */
+
+ folder_free(mp);
+ fflush(stdout);
+
+ if (msgs.size+6 > MAXARGS) {
+ adios(NULL, "more than %d messages for refile exec",
+ MAXARGS - 6);
+ }
+ vec = (char **)mh_xmalloc((size_t)(msgs.size + 6) * sizeof(*vec));
+ vec[vecp++] = "refile";
+ vec[vecp++] = "-src";
+ vec[vecp++] = concat("+", folder, NULL);
+ vec[vecp++] = "-nolink";
+ vec[vecp++] = concat("+", trashfolder, NULL);
+ for (msgnum = 0; msgnum < msgs.size; msgnum++) {
+ vec[vecp++] = msgs.msgs[msgnum];
+ }
+ 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);
+ }