* rmail: front end for mail to stack up those stupid >From ... remote from ...
* lines and make a correct return address. This works with the -f option
* to /usr/lib/sendmail so it won't work on systems without sendmail.
* However, it ought to be easy to modify a standard /bin/mail to do the
* NOTE: Rmail is SPECIFICALLY INTENDED for ERNIE COVAX because of its
* physical position as a gateway between the uucp net and the arpanet.
* By default, other sites will probably want /bin/rmail to be a link
* to /bin/mail, as it was intended by BTL. However, other than the
* (somewhat annoying) loss of information about when the mail was
* originally sent, rmail should work OK on other systems running uucp.
* If you don't run uucp you don't even need any rmail.
static char SccsId
[] = "@(#)rmail.c 3.2 %G%";
# define MAILER "/usr/lib/sendmail"
FILE *out
; /* output to sendmail */
char lbuf
[512]; /* one line of the message */
char from
[512]; /* accumulated path of sender */
char ufrom
[64]; /* user on remote system */
char sys
[64]; /* a system in path */
char junk
[512]; /* scratchpad */
if (argc
> 1 && strcmp(argv
[1], "-T") == 0)
fprintf(stderr
, "Usage: rmail user ...\n");
fgets(lbuf
, sizeof lbuf
, stdin
);
if (strncmp(lbuf
, "From ", 5) != 0 && strncmp(lbuf
, ">From ", 6) != 0)
sscanf(lbuf
, "%s %s", junk
, ufrom
);
cp
= "remote from somewhere";
if (strncmp(cp
, "remote from ", 12)==0)
sscanf(cp
, "remote from %s", sys
);
printf("ufrom='%s', sys='%s', from now '%s'\n", ufrom
, sys
, from
);
sprintf(cmd
, "%s -em -f%s", MAILER
, from
);
printf("cmd='%s'\n", cmd
);
while (fgets(lbuf
, sizeof lbuf
, stdin
))