ref: 8c81b45793912daa0c3a27eba1859b3b42bfeb38
parent: 90ad2b70ea5e6002adef90156c02881ef42927f4
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 19 18:11:55 EST 2020
add dump support (thanks phil9) Mailboxes will be dumped when 'Dump' is run.
--- a/mbox.c
+++ b/mbox.c
@@ -813,7 +813,7 @@
}
static void
-mbmain(void*)
+mbmain(void *cmd)
{
Event *ev;
Plumbmsg *psee, *pshow, *psend;
@@ -830,6 +830,7 @@
wininit(&mbox, mbox.path);
wintagwrite(&mbox, "Put Mail Delmesg Undelmesg Next ");
showlist();
+ fprint(mbox.ctl, "dump %s\n", cmd);
fprint(mbox.ctl, "clean\n");
procrfork(eventread, nil, Stack, RFNOTEG);
while(1){
@@ -864,8 +865,19 @@
void
threadmain(int argc, char **argv)
{
+ Fmt fmt;
+ char *cmd;
+ int i;
+
mbox.view = Vgroup;
+ fmtstrinit(&fmt);
+ for(i = 0; i < argc; i++)
+ fmtprint(&fmt, "%s ", argv[i]);
+ cmd = fmtstrflush(&fmt);
+ if(cmd == nil)
+ sysfatal("out of memory");
+
ARGBEGIN{
case 'f':
maildir = EARGF(usage());
@@ -915,6 +927,6 @@
procrfork(plumbsendmail, nil, Stack, RFNOTEG);
}
threadcreate(execlog, nil, Stack);
- threadcreate(mbmain, nil, Stack);
+ threadcreate(mbmain, cmd, Stack);
threadexits(nil);
}