/*
- * 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 this notice is preserved and that due credit is given
+ * to the University of California at 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'' without express or implied warranty.
*/
#ifndef lint
-static char sccsid[] = "@(#)gethead.c 5.2 (Berkeley) 87/04/11";
-#endif not lint
+static char sccsid[] = "@(#)gethead.c 5.5 (Berkeley) %G%";
+#endif /* not lint */
#include <bug.h>
#include <sys/stat.h>
#include <stdio.h>
-static int chk1();
+static int chk1(), pbuf();
#define ENT(X) sizeof(X) - 1, X
HEADER mailhead[] = { /* mail headers */
{ NO, YES, NULL, ENT("From:"), },
{ NO, NO, chk1, ENT("Index:"), },
{ NO, YES, NULL, ENT("Message-Id:"), },
- { NO, NO, NULL, ENT("Reply-To:"), },
- { NO, NO, NULL, ENT("Return-Path:"), },
- { NO, NO, NULL, ENT("Subject:"), },
- { NO, NO, NULL, ENT("To:"), },
+ { NO, YES, NULL, ENT("Reply-To:"), },
+ { NO, YES, NULL, ENT("Return-Path:"), },
+ { NO, NO, pbuf, ENT("Subject:"), },
+ { NO, YES, NULL, ENT("To:"), },
+ { NO, NO, NULL, ENT("Apparently-To:"), },
{ ERR, }
};
}
if (stat(dir, &sbuf) || (sbuf.st_mode & S_IFMT) != S_IFDIR)
return(NO);
+ (void)pbuf(line);
+ return(YES);
+}
+
+/*
+ * pbuf --
+ * kludge so that summary file looks pretty
+ */
+static
+pbuf(line)
+ char *line;
+{
+ register char *rp, /* tmp pointers */
+ *wp;
+
+ for (rp = line; *rp == ' ' || *rp == '\t'; ++rp);
+ for (wp = line; *rp; ++wp) {
+ if ((*wp = *rp++) != ' ' && *wp != '\t')
+ continue;
+ *wp = ' ';
+ while (*rp == ' ' || *rp == '\t')
+ ++rp;
+ }
+ if (wp[-1] == ' ') /* wp can't == line */
+ --wp;
+ *wp = EOS;
return(YES);
}