uip_comp_LDADD = $(LDADD) $(ICONVLIB)
uip_dist_SOURCES = uip/dist.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
- uip/annosbr.c uip/distsbr.c
+ uip/annosbr.c uip/distsbr.c uip/forwsbr.c
+uip_dist_LDADD = $(LDADD) $(ICONVLIB)
uip_flist_SOURCES = uip/flist.c
@echo 's,%manext1%,$(manext1),g' >> $@
@echo 's,%manext5%,$(manext5),g' >> $@
@echo 's,%manext8%,$(manext8),g' >> $@
- @echo '/%components%/r $(top_srcdir)/etc/components' >> $@
- @echo ' s,%components%,,g' >> $@
- @echo '/%distcomps%/r $(top_srcdir)/etc/distcomps' >> $@
- @echo ' s,%distcomps%,,g' >> $@
- @echo '/%forwcomps%/r $(top_srcdir)/etc/forwcomps' >> $@
- @echo ' s,%forwcomps%,,g' >> $@
@echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
@echo ' s,%mhl_forward%,,g' >> $@
@echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
-Resent-To:
-Resent-cc:
-Resent-fcc:
+%;
+%; distcomps - Our components file for "dist"
+%;
+%; This is modeled after the components file for forw, so check that
+%; file for more explanation as to what is going on here.
+%;
+%; When using "dist" we have to use the special Resent- headers, since
+%; we're keeping the original headers of the message intact.
+%;
+%; All of the header components from the original message are available
+%; if you wish to use them.
+%;
+%<{nmh-from}%|%(void(localmbox))%>%(void(width))%(putaddr Resent-From: )
+%<{nmh-to}%(void(width))%(putaddr Resent-To: )%|Resent-To: %(msg) %{subject}%>
+%<{nmh-cc}%(void(width))%(putaddr Resent-cc: )%|Resent-cc:%>
+%<{nmh-fcc}%(void(width))%(putaddr Resent-fcc: )%|Resent-fcc:%>
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
+.RB [ \-width
+.IR columns ]
+.RB [ \-from
+.IR address ]
+.RB [ \-to
+.IR address ]
+.RB [ \-cc
+.IR address ]
+.RB [ \-fcc
+.IR +folder ]
.RB [ \-whatnowproc
.IR program ]
.RB [ \-nowhatnowproc ]
.PP
.RS 5
.nf
-%distcomps%
+Resent-From: {from switch} or <Local-Mailbox> or <username@hostname>
+Resent-To: {to switch} or blank
+Resent-cc: {cc switch} or blank
+Resent-fcc: {fcc switch} or blank
.fi
.RE
.PP
forms file with the switch
.B \-form
.IR formfile .
-The form used will be prepended to the message being resent.
+Forms are processed via the
+.B nmh
+template system; see
+.BR mh\-format (5)
+for details. Components from the redistributed message are available
+as standard component escapes in the forms file.
+.PP
+In addition to the standard
+.BR mh\-format (5)
+escapes, the following
+.I component
+escapes are also supported:
+.PP
+.RS 5
+.nf
+.ta \w'Escape 'u +\w'Returns 'u
+.I Escape Returns Description
+fcc string Any folders specified with `\-fcc\ folder'
+nmh\-from string Addresses specified with `\-from\ address'
+nmh\-to string Addresses specified with `\-to\ address'
+nmh\-cc string Addresses specified with `\-cc\ address'
+.fi
+.RE
+.PP
+See the
+.BR forw (1)
+man page for descriptions of the
+.BR \-from ,
+.BR \-to ,
+.BR \-cc ,
+and
+.B \-fcc
+switches.
.PP
If the draft already exists,
.B dist
{ "help", 0 },
#define FILESW 14
{ "file file", -4 }, /* interface from msh */
+#define FROMSW 15
+ { "from address", 0 },
+#define TOSW 16
+ { "to address", 0 },
+#define CCSW 17
+ { "cc address", 0 },
+#define FCCSW 18
+ { "fcc mailbox", 0 },
+#define WIDTHSW 19
+ { "width columns", 0 },
{ NULL, 0 }
};
{
int anot = 0, inplace = 1, nedit = 0;
int nwhat = 0, i, in, isdf = 0, out;
+ int outputlinelen = OUTPUTLINELEN;
+ int dat[5];
char *cp, *cwd, *maildir, *msgnam, *dfolder = NULL;
char *dmsg = NULL, *ed = NULL, *file = NULL, *folder = NULL;
char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
+ char *from = NULL, *to = NULL, *cc = NULL, *fcc = NULL;
char **argp, **arguments;
struct msgs *mp = NULL;
struct stat st;
dfolder = NULL;
isdf = NOTOK;
continue;
+
+ case FROMSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ from = addlist(from, cp);
+ continue;
+ case TOSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ to = addlist(to, cp);
+ continue;
+ case CCSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ cc = addlist(cc, cp);
+ continue;
+ case FCCSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ fcc = addlist(fcc, cp);
+ continue;
+
+ case WIDTHSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ if ((outputlinelen = atoi(cp)) < 10)
+ adios (NULL, "impossible width %d", outputlinelen);
+ continue;
}
}
if (*cp == '+' || *cp == '@') {
if (file && (msg || folder))
adios (NULL, "can't mix files and folders/msgs");
- in = open_form(&form, distcomps);
-
try_it_again:
strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft));
}
}
}
- if ((out = creat (drft, m_gmprot ())) == NOTOK)
- adios (drft, "unable to create");
-
- cpydata (in, out, form, drft);
- close (in);
- close (out);
if (file) {
/*
}
msgnam = file ? file : getcpy (m_name (mp->lowsel));
+
+ dat[0] = mp->lowsel;
+ dat[1] = 0;
+ dat[2] = 0;
+ dat[3] = outputlinelen;
+ dat[4] = 0;
+
+ if (!form)
+ form = distcomps;
+
+ in = build_form(form, NULL, dat, from, to, cc, fcc, NULL, msgnam);
+
+ if ((out = creat (drft, m_gmprot ())) == NOTOK)
+ adios (drft, "unable to create");
+
+ cpydata (in, out, form, drft);
+ close (in);
+ close (out);
+
if ((in = open (msgnam, O_RDONLY)) == NOTOK)
adios (msgnam, "unable to open message");