+ return start;
+}
+\f/*
+** JUNKMAIL -- read the header and tell us if this is junk/bulk mail.
+**
+** Parameters:
+** from -- the Return-Path of the sender. We assume that
+** anything from "*-REQUEST@*" is bulk mail.
+**
+** Returns:
+** TRUE -- if this is junk or bulk mail (that is, if the
+** sender shouldn't receive a response).
+** FALSE -- if the sender deserves a response.
+**
+** Side Effects:
+** May read the header from standard input. When this
+** returns the position on stdin is undefined.
+*/
+
+bool
+junkmail(from)
+ char *from;
+{
+ register char *p;
+ char buf[MAXLINE+1];
+ extern char *index();
+ extern char *rindex();
+ extern bool sameword();
+
+ /* test for inhuman sender */
+ p = rindex(from, '@');
+ if (p != NULL)
+ {
+ *p = '\0';
+ if (sameword(&p[-8], "-REQUEST") ||
+ sameword(&p[-10], "Postmaster") ||
+ sameword(&p[-13], "MAILER-DAEMON"))
+ {
+ *p = '@';
+ return (TRUE);
+ }
+ *p = '@';
+ }
+
+ /* read the header looking for a "Precedence:" line */
+ while (fgets(buf, MAXLINE, stdin) != NULL && buf[0] != '\n')
+ {
+ /* should ignore case, but this is reasonably safe */
+ if (strncmp(buf, "Precedence", 10) != 0 ||
+ !(buf[10] == ':' || buf[10] == ' ' || buf[10] == '\t'))
+ {
+ continue;
+ }
+
+ /* find the value of this field */
+ p = index(buf, ':');
+ if (p == NULL)
+ continue;
+ while (*++p != '\0' && isspace(*p))
+ continue;
+ if (*p == '\0')
+ continue;
+
+ /* see if it is "junk" or "bulk" */
+ p[4] = '\0';
+ if (sameword(p, "junk") || sameword(p, "bulk"))
+ return (TRUE);
+ }
+ return (FALSE);