|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1986, 1987 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that: (1) source distributions retain this entire copyright ! 7: * notice and comment, and (2) distributions including binaries display ! 8: * the following acknowledgement: ``This product includes software ! 9: * developed by the University of California, Berkeley and its contributors'' ! 10: * in the documentation or other materials provided with the distribution ! 11: * and in all advertising materials mentioning features or use of this ! 12: * software. Neither the name of the University nor the names of its ! 13: * contributors may be used to endorse or promote products derived ! 14: * from this software without specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: */ ! 19: ! 20: #ifndef lint ! 21: static char sccsid[] = "@(#)reply.c 5.8 (Berkeley) 6/1/90"; ! 22: #endif /* not lint */ ! 23: ! 24: #include <bug.h> ! 25: #include <sys/file.h> ! 26: #include <stdio.h> ! 27: #include "pathnames.h" ! 28: ! 29: /* ! 30: * reply -- ! 31: * tell the user we got their silly little bug report ! 32: */ ! 33: reply() ! 34: { ! 35: register char *C, /* traveling pointer */ ! 36: *to; /* who we're replying to */ ! 37: register int afd, /* ack file descriptor */ ! 38: rval; /* return value */ ! 39: FILE *pf, /* pipe pointer */ ! 40: *popen(); ! 41: char *index(); ! 42: ! 43: if (mailhead[RPLY_TAG].found) { ! 44: for (C = mailhead[RPLY_TAG].line + mailhead[RPLY_TAG].len;*C != '\n' && (*C == ' ' || *C == '\t');++C); ! 45: if (*C) ! 46: goto gotone; ! 47: } ! 48: if (mailhead[FROM_TAG].found) { ! 49: for (C = mailhead[FROM_TAG].line + mailhead[FROM_TAG].len;*C != '\n' && (*C == ' ' || *C == '\t');++C); ! 50: if (*C) ! 51: goto gotone; ! 52: } ! 53: if (mailhead[CFROM_TAG].found) { ! 54: for (C = mailhead[CFROM_TAG].line + mailhead[CFROM_TAG].len;*C != '\n' && (*C == ' ' || *C == '\t');++C); ! 55: if (*C) ! 56: goto gotone; ! 57: } ! 58: return; ! 59: ! 60: /* if it's a foo <XXX>, get the XXX, else get foo (first string) */ ! 61: gotone: if (to = index(C, '<')) ! 62: for (C = ++to;*C != '\n' && *C != ' ' && *C != '\t' && *C != '>';++C); ! 63: else { ! 64: to = C; ! 65: for (to = C++;*C != '\n' && *C != ' ' && *C != '\t';++C); ! 66: } ! 67: *C = EOS; ! 68: ! 69: if (!(pf = popen(MAIL_CMD, "w"))) ! 70: error("sendmail pipe failed.", CHN); ! 71: ! 72: fprintf(pf, "Reply-To: %s\nFrom: %s (Bugs Bunny)\nTo: %s\n", BUGS_HOME, BUGS_HOME, to); ! 73: if (mailhead[SUBJ_TAG].found) ! 74: fprintf(pf, "Subject: Re:%s", mailhead[SUBJ_TAG].line + mailhead[SUBJ_TAG].len); ! 75: else ! 76: fputs("Subject: Bug report acknowledgement.\n", pf); ! 77: if (mailhead[DATE_TAG].found) ! 78: fprintf(pf, "In-Acknowledgement-Of: Your message of %s", mailhead[DATE_TAG].line + mailhead[DATE_TAG].len); ! 79: if (mailhead[MSG_TAG].found) ! 80: fprintf(pf, "\t\t%s", mailhead[MSG_TAG].line); ! 81: fputs("Precedence: bulk\n\n", pf); /* vacation(1) uses this... */ ! 82: fflush(pf); ! 83: ! 84: (void)sprintf(bfr, "%s/%s", dir, ACK_FILE); ! 85: if ((afd = open(bfr, O_RDONLY, 0)) >= 0) { ! 86: while ((rval = read(afd, bfr, sizeof(bfr))) != ERR && rval) ! 87: (void)write(fileno(pf), bfr, rval); ! 88: (void)close(afd); ! 89: } ! 90: pclose(pf); ! 91: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.