projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes q order problems and temporary file names when inchar > 'z'.
[unix-history]
/
usr
/
src
/
bin
/
rmail
/
rmail.c
diff --git
a/usr/src/bin/rmail/rmail.c
b/usr/src/bin/rmail/rmail.c
index
14f0f7e
..
aa114df
100644
(file)
--- a/
usr/src/bin/rmail/rmail.c
+++ b/
usr/src/bin/rmail/rmail.c
@@
-1,20
+1,25
@@
/*
/*
-** 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
-** same thing.
+** RMAIL -- UUCP mail server.
+**
+** This program reads the >From ... remote from ... lines that
+** UUCP is so fond of and turns them into something reasonable.
+** It calls sendmail giving it a -f option built from these
+** lines.
*/
# include <stdio.h>
# include <sysexits.h>
*/
# include <stdio.h>
# include <sysexits.h>
-# include "useful.h"
# include "conf.h"
# include "conf.h"
-
SCCSID(@(#)rmail.c 3.6 (Berkeley) %G%)
;
+
static char SccsId[] = "@(#)rmail.c 4.3 (Berkeley) %G%"
;
-extern FILE *popen();
-extern char *index();
+typedef char bool;
+#define TRUE 1
+#define FALSE 0
+
+extern FILE *popen();
+extern char *index();
+extern char *rindex();
bool Debug;
bool Debug;
@@
-32,6
+37,7
@@
main(argc, argv)
char cmd[2000];
register char *cp;
register char *uf; /* ptr into ufrom */
char cmd[2000];
register char *cp;
register char *uf; /* ptr into ufrom */
+ int i;
# ifdef DEBUG
if (argc > 1 && strcmp(argv[1], "-T") == 0)
# ifdef DEBUG
if (argc > 1 && strcmp(argv[1], "-T") == 0)
@@
-48,6
+54,9
@@
main(argc, argv)
exit(EX_USAGE);
}
exit(EX_USAGE);
}
+ (void) strcpy(from, "");
+ (void) strcpy(ufrom, "/dev/null");
+
for (;;)
{
(void) fgets(lbuf, sizeof lbuf, stdin);
for (;;)
{
(void) fgets(lbuf, sizeof lbuf, stdin);
@@
-66,7
+75,7
@@
main(argc, argv)
if (p != NULL)
{
*p = '\0';
if (p != NULL)
{
*p = '\0';
- strcpy(sys, uf);
+
(void)
strcpy(sys, uf);
uf = p + 1;
break;
}
uf = p + 1;
break;
}
@@
-81,21
+90,24
@@
main(argc, argv)
}
if (cp != NULL)
(void) sscanf(cp, "remote from %s", sys);
}
if (cp != NULL)
(void) sscanf(cp, "remote from %s", sys);
- strcat(from, sys);
- strcat(from, "!");
+
(void)
strcat(from, sys);
+
(void)
strcat(from, "!");
#ifdef DEBUG
if (Debug)
printf("ufrom='%s', sys='%s', from now '%s'\n", uf, sys, from);
#endif
}
#ifdef DEBUG
if (Debug)
printf("ufrom='%s', sys='%s', from now '%s'\n", uf, sys, from);
#endif
}
-
strcat(from, ufrom
);
+
(void) strcat(from, uf
);
(void) sprintf(cmd, "%s -em -f%s", MAILER, from);
while (*++argv != NULL)
{
(void) sprintf(cmd, "%s -em -f%s", MAILER, from);
while (*++argv != NULL)
{
- strcat(cmd, " '");
- strcat(cmd, *argv);
- strcat(cmd, "'");
+ (void) strcat(cmd, " '");
+ if (**argv == '(')
+ (void) strncat(cmd, *argv + 1, strlen(*argv) - 2);
+ else
+ (void) strcat(cmd, *argv);
+ (void) strcat(cmd, "'");
}
#ifdef DEBUG
if (Debug)
}
#ifdef DEBUG
if (Debug)
@@
-105,7
+117,12
@@
main(argc, argv)
fputs(lbuf, out);
while (fgets(lbuf, sizeof lbuf, stdin))
fputs(lbuf, out);
fputs(lbuf, out);
while (fgets(lbuf, sizeof lbuf, stdin))
fputs(lbuf, out);
- pclose(out);
+ i = pclose(out);
+ if ((i & 0377) != 0)
+ {
+ fprintf(stderr, "pclose: status 0%o\n", i);
+ exit(EX_OSERR);
+ }
- exit(
EX_OK
);
+ exit(
(i >> 8) & 0377
);
}
}