{ "list", 0 },
#define SENDSW 4
{ "send [<switches>]", 0 },
-#define PUSHSW 5
- { "push [<switches>]", 0 },
-#define QUITSW 6
+#define QUITSW 5
{ "quit", 0 },
-#define DELETESW 7
+#define DELETESW 6
{ "delete", 0 },
-#define CDCMDSW 8
+#define CDCMDSW 7
{ "cd [directory]", 0 },
-#define PWDCMDSW 9
+#define PWDCMDSW 8
{ "pwd", 0 },
-#define LSCMDSW 10
+#define LSCMDSW 9
{ "ls", 0 },
-#define ATTACHCMDSW 11
+#define ATTACHCMDSW 10
{ "attach", 0 },
-#define DETACHCMDSW 12
+#define DETACHCMDSW 11
{ "detach [-n]", 0 },
-#define ALISTCMDSW 13
+#define ALISTCMDSW 12
{ "alist", 0 },
{ NULL, 0 }
};
*/
static int editfile(char **, char **, char *, int, struct msgs *,
char *, char *, int);
-static int sendfile(char **, char *, int);
+static int sendfile(char **, char *);
+static int refile(char **, char *);
static int removefile(char *);
static void writelscmd(char *, int, char **);
static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp);
removefile(drft);
done(1);
- case PUSHSW:
- /* Send draft in background */
- if (sendfile(++argp, drft, 1))
- done(1);
- break;
-
case SENDSW:
/* Send draft */
- sendfile(++argp, drft, 0);
+ sendfile(++argp, drft);
break;
case REFILEOPT:
/* Refile the draft */
- if (refile(++argp, drft) == 0)
+ if (refile(++argp, drft) == 0) {
done(0);
+ }
break;
case CDCMDSW:
else
snprintf(linkpath, sizeof(linkpath), "%s/%s",
cwd, altmsglink);
- }
-
- if (altmsg) {
unlink(linkpath);
#ifdef HAVE_LSTAT
if (link(altpath, linkpath) == NOTOK) {
default:
if ((status = pidwait(pid, NOTOK))) {
- if (((status & 0xff00) != 0xff00)
- && (!reedit || (status & 0x00ff))) {
- if (!use && (status & 0xff00) && (rename(file, cp = m_backup (file)) != NOTOK)) {
+ if (((status & 0xff00) != 0xff00) &&
+ (!reedit || (status & 0x00ff))) {
+ if (!use && (status & 0xff00) && (rename(file, cp = m_backup(file)) != NOTOK)) {
advise(NULL, "problems with edit--draft left in %s", cp);
} else {
advise(NULL, "problems with edit--%s preserved", file);
*/
static int
-sendfile(char **arg, char *file, int pushsw)
+sendfile(char **arg, char *file)
{
pid_t child_id;
int vecp;
case OK:
vecp = 0;
vec[vecp++] = invo_name;
- if (pushsw)
- vec[vecp++] = "-push";
if (arg)
while (*arg)
vec[vecp++] = *arg++;
/*
+** refile msg into another folder
+*/
+static int
+refile(char **arg, char *file)
+{
+ pid_t pid;
+ register int vecp;
+ char *vec[MAXARGS];
+
+ vecp = 0;
+ vec[vecp++] = "refile";
+ vec[vecp++] = "-nolink"; /* override bad .mh_profile defaults */
+ vec[vecp++] = "-file";
+ vec[vecp++] = file;
+
+ while (arg && *arg) {
+ vec[vecp++] = *arg++;
+ }
+ vec[vecp] = NULL;
+
+ context_save(); /* save the context file */
+ fflush(stdout);
+
+ switch (pid = fork()) {
+ case -1:
+ advise("fork", "unable to");
+ return -1;
+
+ case 0:
+ execvp(*vec, vec);
+ fprintf(stderr, "unable to exec ");
+ perror(*vec);
+ _exit(-1);
+
+ default:
+ return (pidwait(pid, -1));
+ }
+}
+
+
+/*
** Remove the draft file
*/