* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.proprietary.c%
static char sccsid
[] = "@(#)mailst.c 8.1 (Berkeley) %G%";
* mailst - this routine will fork and execute
* a mail command sending string (str) to user (user).
* If file is non-null, the file is also sent.
* (this is used for mail returned to sender.)
sprintf(buf
, "IFS=\" \t\n\";%s '%s'", MAIL
, user
);
if ((fp
= popen(buf
, "w")) != NULL
) {
fprintf(fp
, "From: uucp\nTo: %s\nSubject: %s\n\n", user
, str
);
if (file
&& *file
!= '\0' && (fi
= fopen(subfile(file
), "r")) != NULL
) {
while ((c
= getc(fi
)) != EOF
)