|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)mailst.c 5.7 (Berkeley) 4/5/88";
3: #endif
4:
5: #include <signal.h>
6: #include "uucp.h"
7: #ifdef USG
8: #include <fcntl.h>
9: #endif USG
10:
11: /*LINTLIBRARY*/
12:
13: /*
14: * mailst - this routine will fork and execute
15: * a mail command sending string (str) to user (user).
16: * If file is non-null, the file is also sent.
17: * (this is used for mail returned to sender.)
18: */
19:
20: mailst(user, str, file)
21: char *user, *str, *file;
22: {
23: register FILE *fp, *fi;
24: FILE *popen();
25: char buf[BUFSIZ];
26: register int c;
27:
28: sprintf(buf, "IFS=\" \t\n\";%s '%s'", MAIL, user);
29: if ((fp = popen(buf, "w")) != NULL) {
30: fprintf(fp, "From: uucp\nTo: %s\nSubject: %s\n\n", user, str);
31: if (file && *file != '\0' && (fi = fopen(subfile(file), "r")) != NULL) {
32: while ((c = getc(fi)) != EOF)
33: putc(c, fp);
34: putc('\n', fp);
35: fclose(fi);
36: }
37: pclose(fp);
38: }
39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.