Annotation of 42BSD/usr.bin/uucp/mailst.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char sccsid[] = "@(#)mailst.c   5.2 (Berkeley) 7/19/83";
                      3: #endif
                      4: 
                      5: #include "uucp.h"
                      6: 
                      7: /*******
                      8:  *     mailst(user, str, file)
                      9:  *
                     10:  *     mailst  -  this routine will fork and execute
                     11:  *     a mail command sending string (str) to user (user).
                     12:  *     If file is non-null, the file is also sent.
                     13:  *     (this is used for mail returned to sender.)
                     14:  */
                     15: 
                     16: mailst(user, str, file)
                     17: char *user, *str, *file;
                     18: {
                     19:        register FILE *fp, *fi;
                     20:        char cmd[100], buf[BUFSIZ];
                     21:        register int nc;
                     22: 
                     23:        sprintf(cmd, "mail %s", user);
                     24:        if ((fp = rpopen(cmd, "w")) == NULL)
                     25:                return;
                     26:        fprintf(fp, "%s", str);
                     27: 
                     28:        if (*file != '\0' && (fi = fopen(subfile(file), "r")) != NULL) {
                     29:                while ((nc = fread(buf, sizeof (char), BUFSIZ, fi)) > 0)
                     30:                        fwrite(buf, sizeof (char), nc, fp);
                     31:                fclose(fi);
                     32:        }
                     33: 
                     34:        pclose(fp);
                     35:        return;
                     36: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.