static int
sendsbr(char **vec, int vecp, char *drft, struct stat *st)
{
- int status;
+ int status, dupfd;
char buffer[BUFSIZ];
char *original_draft;
status = sendaux(vec, vecp, drft, st) ? NOTOK : OK;
if (status == OK) {
/* move original draft to +trash folder */
- snprintf(buffer, sizeof buffer,
- "</dev/null refile -file %s +trash",
- original_draft);
- if (system(buffer) != 0) {
+ /* temporary close stdin, for refile not to ask */
+ dupfd = dup(0);
+ close(0);
+ if (execprogl("refile", "refile", "-file",
+ original_draft, "+trash",
+ (char *)NULL) != 0) {
advise(NULL, "unable to trash the draft");
}
+ dup2(dupfd, 0);
+ close(dupfd);
}
break;