checks for write failures.
* Unlink temporary file properly in uip/rcvtty.c.
* Moved viamail from bindir to libdir.
* Changed sendfiles into sendfiles.in, so that path to viamail
is patched in.
* Added gzip support to sendfiles.
* Added References header to replcomps and replgroupcomps.
+Sun May 28 14:58:49 CEST 2000 Ruud de Rooij <ruud@ruud.org>
+
+ * Applied patch from Peter Maydell to uip/scansbr.c for more
+ checks for write failures.
+ * Unlink temporary file properly in uip/rcvtty.c.
+ * Moved viamail from bindir to libdir.
+ * Changed sendfiles into sendfiles.in, so that path to viamail
+ is patched in.
+ * Added gzip support to sendfiles.
+ * Added References header to replcomps and replgroupcomps.
+
Sun May 28 14:39:31 CEST 2000 Ruud de Rooij <ruud@ruud.org>
* Fixed m_getfld bug which caused segmentation faults when
replcomps replgroupcomps MailAliases
# format and configuration files to generate
-GEN_FILES = mhn.defaults mts.conf
+GEN_FILES = mhn.defaults mts.conf sendfiles
# data files we need to install
FILES = $(DIST_FILES) $(GEN_FILES)
-e 's,%masquerade%,$(masquerade),' \
-e 's,%smtpservers%,$(smtpservers),' < $(srcdir)/mts.conf.in > $@
+sendfiles: $(srcdir)/sendfiles.in Makefile
+ rm -f $@
+ $(SED) -e 's,%libdir%,$(libdir),' < $(srcdir)/sendfiles.in > $@
+
install: install-files install-scripts
install-files:
%<{date}In-Reply-To: Your message of "\
%<(nodate{date})%{date}%|%(pretty{date})%>."%<{message-id}
%{message-id}%>\n%>\
+%<{message-id}References: %<{references} %{references}%> %{message-id}\n%>\
--------
In-Reply-To: Message from %<{from}%{from}%?{sender}%{sender}%|%{return-path}%>\n\
of "%<(nodate{date})%{date}%|%(pretty{date})%>."\
%<{message-id} %{message-id}%>\n\
+%<{message-id}References: %<{references} %{references}%> %{message-id}\n%>\
--------
+++ /dev/null
-#!/bin/sh
-#
-# $Id$
-#
-# Send multiples files and/or directories as a tar/compressed
-# image, in a MIME message.
-#
-
-DELAY=0
-FROM=
-
-case "$1" in
- -*) DELAY="`echo $1 | sed -e 's%-%%'`"
- shift
- ;;
-esac
-
-if [ ! -z "$PERSON" ]; then
- FROM="-from $PERSON"
-fi
-
-if [ $# -lt 3 ]; then
- echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2
- exit 1;
-fi
-
-mailpath="$1"
-echo "mailpath = $mailpath" 1>&2
-shift
-
-subject="$1"
-echo "subject-string = $subject" 1>&2
-shift
-
-echo "files = $*" 1>&2
-
-tar cvf - "$@" | compress | \
- viamail -to "$mailpath" -subject "$subject" \
- -parameters "type=tar; x-conversions=compress" \
- -comment "extract with uncompress | tar xvpf -" \
- -delay "$DELAY" \
- -verbose $FROM
--- /dev/null
+#!/bin/sh
+#
+# $Id$
+#
+# Send multiples files and/or directories as a tar/compressed
+# image, in a MIME message.
+#
+
+DELAY=0
+FROM=
+
+# compression method (none, gzip or compress)
+METHOD=none
+# compression filter
+COMPRESS=cat
+# uncompression filter
+UNCOMPRESS=cat
+# compression description to append to content-type
+CONVERSION=
+
+# default compression method based on installed software
+# prefer compress over gzip for backward compatibility
+if command -v compress >/dev/null 2>&1 ; then
+ METHOD=compress
+elif command -v gzip >/dev/null 2>&1 ; then
+ METHOD=gzip
+fi
+
+# handle command-line options to override compression method and delay
+while [ $# -gt 3 ]; do
+ case "$1" in
+ -gzip) METHOD=gzip
+ shift
+ ;;
+ -compress) METHOD=compress
+ shift
+ ;;
+ -none) METHOD=none
+ shift
+ ;;
+ -*) DELAY="`echo $1 | sed -e 's%-%%'`"
+ shift
+ ;;
+ *) break
+ ;;
+ esac
+done
+
+# set variables based on chosen compression method
+if [ $METHOD = compress ]; then
+ COMPRESS=compress
+ UNCOMPRESS=uncompress
+ CONVERSION="; x-conversions=compress"
+elif [ $METHOD = gzip ]; then
+ COMPRESS="gzip -c"
+ UNCOMPRESS="gzip -dc"
+ CONVERSION="; x-conversions=gzip"
+fi
+
+if [ ! -z "$PERSON" ]; then
+ FROM="-from $PERSON"
+fi
+
+if [ $# -lt 3 ]; then
+ echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2
+ exit 1;
+fi
+
+mailpath="$1"
+echo "mailpath = $mailpath" 1>&2
+shift
+
+subject="$1"
+echo "subject-string = $subject" 1>&2
+shift
+
+echo "files = $*" 1>&2
+
+tar cvf - "$@" | $COMPRESS | \
+ %libdir%/viamail -to "$mailpath" -subject "$subject" \
+ -parameters "type=tar$CONVERSION" \
+ -comment "extract with $UNCOMPRESS | tar xvpf -" \
+ -delay "$DELAY" \
+ -verbose $FROM
CMDS = ali anno burst comp dist flist folder forw mark mhbuild \
mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk \
msh packf pick prompter refile repl rmf rmm scan send show \
- sortm viamail whatnow whom
+ sortm whatnow whom
## removed this from CMDS until I can fix it
## OTHERCMDS = vmh
# misc support binaries
MISC = ap conflict dp fmtdump install-mh mhl post rcvdist rcvpack \
- rcvstore rcvtty slocal spost mhtest
+ rcvstore rcvtty slocal spost viamail mhtest
# commands with 'S'pecial installation needs
SCMDS = inc
unlink (mktemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil))));
if ((fd = open (tmpfil, O_RDWR | O_CREAT | O_TRUNC, 0600)) == NOTOK)
return header_fd ();
- unlink (tmpfil);
#endif
+ unlink (tmpfil);
if ((child_id = vfork()) == NOTOK) {
/* fork error */
char *scanl = 0; /* text of most recent scanline */
+#define DIEWRERR() adios (scnmsg, "write error on")
+
#define FPUTS(buf) {\
if (mh_fputs(buf,scnout) == EOF)\
- adios (scnmsg, "write error on");\
+ DIEWRERR();\
}
/*
compnum++;
if (outnum) {
FPUTS (name);
- putc (':', scnout);
+ if ( putc (':', scnout) == EOF) DIEWRERR();
FPUTS (tmpbuf);
}
/*
state = FILEEOF; /* stop now if scan cmd */
goto finished;
}
- putc ('\n', scnout);
+ if (putc ('\n', scnout) == EOF) DIEWRERR();
FPUTS (tmpbuf);
/*
* performance hack: some people like to run "inc" on
if (scnout->_cnt <= 0) {
#endif
if (fflush(scnout) == EOF)
- adios (scnmsg, "write error on");
+ DIEWRERR ();
}
#ifdef LINUX_STDIO
state = m_getfld(state, name, scnout->_IO_write_ptr,
if (outnum) {
FPUTS ("\n\nBAD MSG:\n");
FPUTS (name);
- putc ('\n', scnout);
+ if (putc ('\n', scnout) == EOF) DIEWRERR();
state = BODY;
goto body;
}
if (size)
dat[2] = size;
else if (outnum > 0)
+ {
dat[2] = ftell(scnout);
+ if (dat[2] == EOF) DIEWRERR();
+ }
if ((datecomp && !datecomp->c_text) || (!size && !outnum)) {
struct stat st;
*--nxtbuf = tmpbuf;
if (outnum && (ferror(scnout) || fclose (scnout) == EOF))
- adios (scnmsg, "write error on");
+ DIEWRERR();
return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG);
}