shithub: Nail

Download patch

ref: 9a4891a5a4bbc409bc271dd4d8272dd810c06625
parent: 6fdb0c393d1a161ae45ce6090a185e57f9c516a6
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 5 18:06:08 EST 2020

implement -R flag for upas/marshal, tweak tags.

--- a/comp.c
+++ b/comp.c
@@ -17,6 +17,7 @@
 execmarshal(void *p)
 {
 	Comp *c;
+	char *dashr;
 
 	c = p;
 	rfork(RFFDG);
@@ -23,8 +24,8 @@
 	dup(c->fd[0], 0);
 	close(c->fd[0]);
 	close(c->fd[1]);
-	sendul(c->sync, 0);
-	procexecl(nil, "/bin/upas/marshal", "marshal", "-8", nil);
+	dashr = (c->rpath != nil) ? "-R" : nil;
+	procexecl(c->sync, "/bin/upas/marshal", "marshal", "-8", dashr, c->rpath, nil);
 }
 
 static void
@@ -75,11 +76,18 @@
 		mbredraw(m, 0, 0);
 		free(path);
 	}
+	fprint(c->ctl, "clean\n");
+}
 
+static void
+compquit(Comp *c, char **, int)
+{
+	c->quitting = 1;
 }
 
 static Fn compfn[] = {
 	{"Post", postmesg},
+	{"Del", compquit},
 	{nil},
 };
 
@@ -139,6 +147,7 @@
 	free(c->replyto);
 	free(c->rname);
 	free(c->rdigest);
+	free(c->rpath);
 	threadexits(nil);
 }
 
@@ -157,7 +166,7 @@
 		c->path = esmprint("%sCompose.%d", mbox.path, ncompose++);
 	wininit(c, c->path);
 
-	wintagwrite(c, "Delmesg Save Post ");
+	wintagwrite(c, "Post ");
 	wfd = bwinopen(c, "body", OWRITE);
 	if(r == nil || !all)
 		Bprint(wfd, "To: %s\n", to);
@@ -170,10 +179,11 @@
 			Bprint(wfd, "CC: %s\n", r->cc);
 	}
 	if(r == nil){
-		Bprint(wfd, "\n");
+		Bprint(wfd, "Subject: \n\n");
 	}else{
 		if(r->messageid != nil)
 			c->replyto = estrdup(r->messageid);
+		c->rpath = estrjoin(mbox.path, r->name, nil);
 		c->rname = estrdup(r->name);
 		c->rdigest = estrdup(r->digest);
 		Bprint(wfd, "Subject: ");
--- a/mail.h
+++ b/mail.h
@@ -60,6 +60,7 @@
 	/* to relate back the message */
 	char	*replyto;
 	char	*rname;
+	char	*rpath;
 	char	*rdigest;
 	char	*path;
 
--- a/mesg.c
+++ b/mesg.c
@@ -191,7 +191,8 @@
 	dup(m->fd[1], 1);
 	close(m->fd[0]);
 	close(m->fd[1]);
-	procexecl(m->sync, "/bin/htmlfmt", "htmlfmt", "-a", "-cutf-8", m->path, nil);
+	sendul(m->sync, 0);
+	procexecl(nil, "/bin/htmlfmt", "-a", "-cutf-8", m->path, nil);
 }
 
 static int
@@ -283,6 +284,7 @@
 	}
 	close(wfd);
 	free(home);
+	fprint(m->ctl, "clean\n");
 	return 0;
 }
 
@@ -290,7 +292,7 @@
 reply(Mesg *m, char **f, int nf)
 {
 	if(nf >= 2
-	|| nf >= 1 &&  strcmp(f[0], "All") != 0){
+	|| nf >= 1 &&  strcmp(f[0], "all") != 0){
 		fprint(2, "Q: invaid args\n");
 		return;
 	}
--- a/win.c
+++ b/win.c
@@ -271,7 +271,7 @@
 static char*
 expandaddr(Win *w, Event *e)
 {
-	static char *delim = "/[ \t\\n<>()\\[\\]]/";
+	static char *delim = "/[ \t\\n<>«»()\\[\\]]/";
 	char *s;
 	int q0, q1, ns;