13 fprint(2, "usage: %s address-list-file listname\n", argv0);
18 main(int argc, char **argv)
34 if(Binit(&in, 0, OREAD) < 0)
35 sysfatal("opening input: %r");
39 /* discard the 'From ' line */
40 if(s_read_line(&in, msg) == nil)
41 sysfatal("reading input: %r");
43 /* read up to the first 128k of the message. more is redculous */
44 if(s_read(&in, s_restart(msg), 128*1024) <= 0)
45 sysfatal("reading input: %r");
47 /* parse the header */
48 yyinit(s_to_c(msg), s_len(msg));
56 sysfatal("message must contain From: or Sender:");
58 if(strstr(s_to_c(msg), "remove")||strstr(s_to_c(msg), "unsubscribe"))
59 writeaddr(alfile, s_to_c(from), 1, listname);
60 else if(strstr(s_to_c(msg), "subscribe"))
61 writeaddr(alfile, s_to_c(from), 0, listname);