Annotation of 43BSDReno/libexec/bugfiler/redist.c, revision 1.1.1.1

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[] = "@(#)redist.c   5.10 (Berkeley) 6/1/90";
                     22: #endif /* not lint */
                     23: 
                     24: #include <sys/file.h>
                     25: #include <stdio.h>
                     26: #include <ctype.h>
                     27: #include <bug.h>
                     28: #include "pathnames.h"
                     29: 
                     30: /*
                     31:  * redist --
                     32:  *     Redistribute a bug report to those people indicated in the
                     33:  *     redistribution list file.
                     34:  */
                     35: redist()
                     36: {
                     37:        extern FILE     *dfp;           /* dist file fp */
                     38:        extern char     pfile[];        /* permanent bug file */
                     39:        register char   *C1, *C2;
                     40:        FILE    *pf, *popen();
                     41:        int     group;
                     42:        char    *index();
                     43: 
                     44:        (void)sprintf(bfr, "%s/%s", dir, DIST_FILE);
                     45:        if (!freopen(bfr, "r", stdin))
                     46:                return;
                     47:        for (pf = NULL, group = 0; gets(bfr);) {
                     48:                if (*bfr == COMMENT || isspace(*bfr) || !(C1 = index(bfr, ':')))
                     49:                        continue;
                     50:                *C1 = EOS;
                     51:                if (!strcmp(bfr, folder) || !strcmp(bfr, "all")) {
                     52:                        for (++C1; *C1 && (*C1 == ' ' || *C1 == '\t'); ++C1);
                     53:                        if (!*C1)                       /* if empty list */
                     54:                                continue;
                     55:                        if (!pf) {
                     56:                                if (!(pf = popen(MAIL_CMD, "w")))
                     57:                                        error("sendmail pipe failed.", CHN);
                     58:                                if (mailhead[SUBJ_TAG].found)
                     59:                                        fprintf(pf, "%s", mailhead[SUBJ_TAG].line);
                     60:                                else
                     61:                                        fputs("Subject: Untitled Bug Report\n", pf);
                     62:                                if (!mailhead[TO_TAG].line) {
                     63:                                        if (mailhead[APPAR_TO_TAG].line)
                     64:                                            fprintf(pf, "To%s",
                     65:                                              index(mailhead[APPAR_TO_TAG].line,
                     66:                                              ':'));
                     67:                                        else
                     68:                                            fprintf(pf, "To: %s\n",  BUGS_ID);
                     69:                                }
                     70:                                fputs("Resent-To: ", pf);
                     71:                        }
                     72:                        /*
                     73:                         * write out first entry, then succeeding entries
                     74:                         * backward compatible, handles back slashes at end
                     75:                         * of line
                     76:                         */
                     77:                        if (group++)
                     78:                                fputs(", ", pf);
                     79:                        for (;;) {
                     80:                                if (C2 = index(C1, '\\'))
                     81:                                        *C2 = EOS;
                     82:                                fputs(C1, pf);
                     83:                                if (!gets(bfr) || *bfr != ' ' && *bfr != '\t')
                     84:                                        break;
                     85:                                for (C1 = bfr; *C1 && (*C1 == ' ' || *C1 == '\t'); ++C1);
                     86:                        }
                     87:                }
                     88:        }
                     89:        if (!pf)
                     90:                return;
                     91: 
                     92:        putc('\n', pf);
                     93: 
                     94:        rewind(dfp);
                     95:        /* add Reference header and copy bug report out */
                     96:        while (fgets(bfr, sizeof(bfr), dfp) && *bfr != '\n')
                     97:                fputs(bfr, pf);
                     98:        fprintf(pf, "\n%sReference: %s\n\n", mailhead[INDX_TAG].line, pfile);
                     99:        while (fgets(bfr, sizeof(bfr), dfp))
                    100:                fputs(bfr, pf);
                    101:        (void)pclose(pf);
                    102: }

unix.superglobalmegacorp.com

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