ref: 8a141b2e876cae0532bcd09a8d439d61e3c8a2a7
parent: cecb7780706ac93203bc94a43cf36708b89206c0
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Nov 23 23:24:25 EST 2020
Add support for '-o savebox' in nail When passing '-o', we save a copy of outgoing messages to the savebox passed.
--- a/comp.c
+++ b/comp.c
@@ -17,7 +17,8 @@
execmarshal(void *p)
{
Comp *c;
- char *dashr;
+ char *av[8];
+ int na;
c = p;
rfork(RFFDG);
@@ -24,8 +25,21 @@
dup(c->fd[0], 0);
close(c->fd[0]);
close(c->fd[1]);
- dashr = (c->rpath != nil) ? "-R" : nil;
- procexecl(c->sync, "/bin/upas/marshal", "marshal", "-8", dashr, c->rpath, nil);
+
+ na = 0;
+ av[na++] = "marshal";
+ av[na++] = "-8";
+ if(savebox != nil){
+ av[na++] = "-S";
+ av[na++] = savebox;
+ }
+ if(c->rpath != nil){
+ av[na++] = "-R";
+ av[na++] = c->rpath;
+ }
+ av[na] = nil;
+ assert(na < nelem(av));
+ procexec(c->sync, "/bin/upas/marshal", av);
}
static void
--- a/mail.h
+++ b/mail.h
@@ -147,13 +147,9 @@
};
extern Mbox mbox;
-extern int threadsort;
-extern int plumbsendfd;
-extern int plumbseemailfd;
-extern int plumbshowmailfd;
-extern int plumbsendmailfd;
extern Reprog *addrpat;
extern Reprog *mesgpat;
+extern char *savebox;
/* window management */
void wininit(Win*, char*);
--- a/mbox.c
+++ b/mbox.c
@@ -26,6 +26,7 @@
char *maildir = "/mail/fs";
char *mailbox = "mbox";
+char *savebox = nil;
char *listfmt = "%>40s\t<%f>";
Mesg dead = {.messageid="", .hash=42};
@@ -1008,6 +1009,9 @@
break;
case 'f':
listfmt = EARGF(usage());
+ break;
+ case 'o':
+ savebox = EARGF(usage());
break;
default:
usage();