file reorg, pathnames.h, paths.h
[unix-history] / usr / src / libexec / bugfiler / reply.c
index 041b954..38b8dc3 100644 (file)
@@ -1,22 +1,32 @@
 /*
 /*
- * Copyright (c) 1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1986, 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)reply.c    5.1 (Berkeley) 86/11/25";
-#endif not lint
+static char sccsid[] = "@(#)reply.c    5.7 (Berkeley) %G%";
+#endif /* not lint */
 
 #include <bug.h>
 #include <sys/file.h>
 #include <stdio.h>
 
 #include <bug.h>
 #include <sys/file.h>
 #include <stdio.h>
-
-extern HEADER  mailhead[];                     /* mail headers */
+#include "pathnames.h"
 
 /*
  * reply --
 
 /*
  * reply --
- *     tell the user we got their bug report
+ *     tell the user we got their silly little bug report
  */
 reply()
 {
  */
 reply()
 {
@@ -26,7 +36,7 @@ reply()
                        rval;                   /* return value */
        FILE    *pf,                            /* pipe pointer */
                *popen();
                        rval;                   /* return value */
        FILE    *pf,                            /* pipe pointer */
                *popen();
-       char    *mktemp(), *strcpy(), *index();
+       char    *index();
 
        if (mailhead[RPLY_TAG].found) {
                for (C = mailhead[RPLY_TAG].line + mailhead[RPLY_TAG].len;*C != '\n' && (*C == ' ' || *C == '\t');++C);
 
        if (mailhead[RPLY_TAG].found) {
                for (C = mailhead[RPLY_TAG].line + mailhead[RPLY_TAG].len;*C != '\n' && (*C == ' ' || *C == '\t');++C);
@@ -46,7 +56,7 @@ reply()
        return;
 
        /* if it's a foo <XXX>, get the XXX, else get foo (first string) */
        return;
 
        /* if it's a foo <XXX>, get the XXX, else get foo (first string) */
-gotone:        if (to = index(C,'<'))
+gotone:        if (to = index(C, '<'))
                for (C = ++to;*C != '\n' && *C != ' ' && *C != '\t' && *C != '>';++C);
        else {
                to = C;
                for (C = ++to;*C != '\n' && *C != ' ' && *C != '\t' && *C != '>';++C);
        else {
                to = C;
@@ -54,26 +64,26 @@ gotone:     if (to = index(C,'<'))
        }
        *C = EOS;
 
        }
        *C = EOS;
 
-       if (!(pf = popen(MAIL_CMD,"w")))
-               error("sendmail pipe failed.",CHN);
+       if (!(pf = popen(MAIL_CMD, "w")))
+               error("sendmail pipe failed.", CHN);
 
 
-       fprintf(pf,"Reply-To: %s\nFrom: %s (Bugs Bunny)\nTo: %s\n",BUGS_HOME,BUGS_HOME,to);
+       fprintf(pf, "Reply-To: %s\nFrom: %s (Bugs Bunny)\nTo: %s\n", BUGS_HOME, BUGS_HOME, to);
        if (mailhead[SUBJ_TAG].found)
        if (mailhead[SUBJ_TAG].found)
-               fprintf(pf,"Subject: Re:%s",mailhead[SUBJ_TAG].line + mailhead[SUBJ_TAG].len);
+               fprintf(pf, "Subject: Re:%s", mailhead[SUBJ_TAG].line + mailhead[SUBJ_TAG].len);
        else
        else
-               fputs("Subject: Bug report acknowledgement.\n",pf);
+               fputs("Subject: Bug report acknowledgement.\n", pf);
        if (mailhead[DATE_TAG].found)
        if (mailhead[DATE_TAG].found)
-               fprintf(pf,"In-Acknowledgement-Of: Your message of %s",mailhead[DATE_TAG].line + mailhead[DATE_TAG].len);
+               fprintf(pf, "In-Acknowledgement-Of: Your message of %s", mailhead[DATE_TAG].line + mailhead[DATE_TAG].len);
        if (mailhead[MSG_TAG].found)
        if (mailhead[MSG_TAG].found)
-               fprintf(pf,"\t\t%s",mailhead[MSG_TAG].line);
-       putc('\n',pf);
+               fprintf(pf, "\t\t%s", mailhead[MSG_TAG].line);
+       fputs("Precedence: bulk\n\n", pf);      /* vacation(1) uses this... */
        fflush(pf);
 
        fflush(pf);
 
-       if ((afd = open(ACK_FILE,O_RDONLY,0)) >= 0) {
-               while ((rval = read(afd,bfr,sizeof(bfr))) != ERR && rval)
-                       write(fileno(pf),bfr,rval);
-               close(afd);
+       (void)sprintf(bfr, "%s/%s", dir, ACK_FILE);
+       if ((afd = open(bfr, O_RDONLY, 0)) >= 0) {
+               while ((rval = read(afd, bfr, sizeof(bfr))) != ERR && rval)
+                       (void)write(fileno(pf), bfr, rval);
+               (void)close(afd);
        }
        }
-
        pclose(pf);
 }
        pclose(pf);
 }