Cheap big-file mailing
Fred J. E. Long
flong at sdsu.UUCP
Wed Feb 22 16:33:16 AEST 1989
Below are the two programs I use to send big files (like GNU C) through
the mail. Here is how you would normally use them:
midgard % send flong%sdsu.UUCP at ucsd foobar.tar.Z
.
.
sdsu % extract /usr/spool/mail/flong > newmail
sdsu % cat x* > foobar.uue ; uudecode foobar.uue
sdsu % cp newmail /usr/spool/mail/flong (after checking that newmail is OK)
--fjel
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# extract.c
# send
sed 's/^X//' << 'SHAR_EOF' > extract.c
X#include <stdio.h>
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X char st[2000], name[200];
X int found = 0, count = 0;
X FILE *fi, *in;
X
X if (argc >= 2) {
X in = fopen(argv[1], "r");
X if (!in) {
X fprintf(stderr, "Could not open \"%\"\n", argv[1]);
X exit(-1);
X }
X }
X if (argc < 2 || !in) {
X fprintf(stderr, "\"extract\" filename\n");
X exit(-1);
X }
X while (fgets(st, 2000, in)) {
X
X st[strlen(st) - 1] = '\0';
X if (!found) {
X if (*st == 'x' && strlen(st) == 3) {
X sprintf(name,"%s%d", st, count++);
X if (!(fi = fopen(name, "w"))) {
X fprintf(stderr,
X "Could not open \"%\"\n", name);
X exit(-1);
X }
X found = 1;
X }
X else puts(st);
X }
X else {
X if (*st) fprintf(fi, "%s\n", st);
X else {
X fclose(fi);
X found = 0;
X }
X }
X }
X}
SHAR_EOF
sed 's/^X//' << 'SHAR_EOF' > send
X#!/bin/csh -fb
X#
X# send
X#
X# Fred Jon Edward Long
X#
X# Tue Feb 21 21:57:46 PST 1989
X#
X# "send" to-who filename
X#
Xif ($1 == "" || $2 == "") then
X echo "send to-who filename & (should be done in background)"
X exit 0
Xendif
X
Xmkdir .xxlkh48
Xcp $2 .xxlkh48/tmp8734
Xcd .xxlkh48
Xuuencode $2 < tmp8734 > uue
Xsplit -1500 uue
X
Xforeach i (`ls x*`)
X echo $i >& foo
X cat $i >> foo
X mail -s "$2" $1 < foo
X sleep 10
Xend
X
Xcd ..
Xrm -rf .xxlkh48
X
SHAR_EOF
exit
--
Fred J. E. Long
San Diego State University, San Diego, California 92093
ARPA: flong%midgard at ucscc.ucsc.edu
UUCP: ...!ucsd!sdsu!flong
More information about the Alt.sources
mailing list