2 * b2m - a filter for Babyl -> Unix mail files
4 * usage: b2m < babyl > mailbox
6 * I find this useful whenever I have to use a
7 * system which - shock horror! - doesn't run
8 * Gnu emacs. At least now I can read all my
9 * Gnumacs Babyl format mail files!
11 * it's not much but it's free!
14 * E.Wilkinson@massey.ac.nz
15 * Mon Nov 7 15:54:06 PDT 1988
20 #include <sys/types.h>
22 #include <../src/config.h>
30 /* BSD's strings.h does not declare the type of strtok. */
31 extern char *strtok ();
40 int header
= FALSE
, printing
;
42 char from
[256], labels
[256], data
[256], *p
, *today
;
49 today
= ctime(<oday
);
52 if (strcmp(data
, "BABYL OPTIONS:")) {
53 fprintf(stderr
, "b2m: not a Babyl mailfile!\n");
65 /* What was this for? Does somebody have something against blank
67 if (!strcmp(data
, ""))
71 if (!strcmp(data
, "*** EOOH ***") && !printing
) {
72 printing
= header
= TRUE
;
73 printf("From b2m %s", today
);
77 if (!strcmp(data
, "\f")) {
80 p
= strtok(data
, " ,\r\n\t");
81 strcpy(labels
, "X-Babyl-Labels: ");
83 while (p
= strtok(NULL
, " ,\r\n\t")) {
88 labels
[strlen(labels
) - 2] = '\0';
89 printing
= header
= FALSE
;
93 if (!strlen(data
) && header
) {
95 if (strcmp(labels
, "X-Babyl-Labels"))