summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-11-06 18:15:15 -0800
committerOri Bernstein <ori@eigenstate.org>2020-11-06 18:15:15 -0800
commit4257a5292af5a9a3ff8fbbc76a00fdeffc75bfd2 (patch)
tree7259870cc362fc4fac9e2099c8212733289c697b /sys
parent6f15a730f351b75f24286cb937a96db1ee9e5b82 (diff)
upas/marshal: add -S saveto to save outgoing mail, fix -F
Upas/marshal -F was broken with the '-8' command, and silly without it: It used aliases passed on the command line, so the destination address was ignored with -8 was passed. In addition, it would create a new mailbox for any aliases being sent to, instead of putting them all in one location. The new -S option is similar to -F, but specifies where the message should go.
Diffstat (limited to 'sys')
-rw-r--r--sys/man/1/marshal8
-rw-r--r--sys/src/cmd/upas/marshal/marshal.c14
2 files changed, 17 insertions, 5 deletions
diff --git a/sys/man/1/marshal b/sys/man/1/marshal
index ef654a1fb..e2fc8336c 100644
--- a/sys/man/1/marshal
+++ b/sys/man/1/marshal
@@ -15,6 +15,9 @@ marshal \- formatting and sending mail
] [
.B -Fr#xn
] [
+.B -S
+.I saveto
+] [
.B -p[es]
] [
.B -R
@@ -104,6 +107,11 @@ as a recipient.
.BI -F
file the message
.TP
+.BI -S saveto
+file the message into the
+.I saveto
+mailbox.
+.TP
.BI -n
intentionally no standard input
.TP
diff --git a/sys/src/cmd/upas/marshal/marshal.c b/sys/src/cmd/upas/marshal/marshal.c
index c40e3cfd6..3e26d9dbf 100644
--- a/sys/src/cmd/upas/marshal/marshal.c
+++ b/sys/src/cmd/upas/marshal/marshal.c
@@ -193,7 +193,7 @@ void
main(int argc, char **argv)
{
int ccargc, bccargc, flags, fd, noinput, headersrv;
- char *subject, *type, *boundary;
+ char *subject, *type, *boundary, *saveto;
char *ccargv[32], *bccargv[32];
Addr *to, *cc, *bcc;
Attach *first, **l, *a;
@@ -207,6 +207,7 @@ main(int argc, char **argv)
l = &first;
type = nil;
hdrstring = nil;
+ saveto = nil;
ccargc = bccargc = 0;
tmfmtinstall();
@@ -244,6 +245,9 @@ main(int argc, char **argv)
case 'F':
Fflag = 1; /* file message */
break;
+ case 'S':
+ saveto = EARGF(usage());
+ break;
case 'n': /* no standard input */
nflag = 1;
break;
@@ -336,7 +340,9 @@ main(int argc, char **argv)
}
}
- fd = sendmail(to, cc, bcc, &pid, Fflag ? argv[0] : nil);
+ if(Fflag)
+ saveto=argc>0?argv[0]:to->v;
+ fd = sendmail(to, cc, bcc, &pid, saveto);
if(fd < 0)
sysfatal("execing sendmail: %r\n:");
if(xflag || lbflag || dflag){
@@ -1079,10 +1085,8 @@ sendmail(Addr *to, Addr *cc, Addr *bcc, int *pid, char *rcvr)
break;
case 0:
close(pfd[0]);
- b = 0;
/* BOTCH; "From " time gets changed */
- if(rcvr)
- b = openfolder(foldername(nil, user, rcvr), time(0));
+ b = openfolder(foldername(nil, user, rcvr), time(0));
fd = b? Bfildes(b): -1;
printunixfrom(fd);
tee(0, pfd[1], fd);