1 /* $Id: cvtbatch.c 6135 2003-01-19 01:15:40Z rra $
3 ** Read file list on standard input and spew out batchfiles.
9 #include "inn/innconf.h"
10 #include "inn/messages.h"
19 main(int ac, char *av[]) {
32 /* First thing, set up our identity. */
33 message_program_name = "cvtbatch";
34 if (!innconf_read(NULL))
38 format = xstrdup("nm");
39 while ((i = getopt(ac, av, "w:")) != EOF)
45 for (p = format = optarg; *p; p++) {
53 warn("ignoring %c in -w flag", *p);
62 die("cannot initialize storage manager: %s", SMerrorstr);
64 /* Loop over all input. */
65 qp = QIOfdopen((int)fileno(stdin));
66 while ((line = QIOread(qp)) != NULL) {
67 for (p = line; *p; p++)
75 token = TextToToken(line);
76 if ((art = SMretrieve(token, RETR_HEAD)) == NULL)
78 text = wire_findheader(art->data, art->len, "Message-ID");
84 for (r = text; r < art->data + art->len; r++) {
85 if (*r == '\r' || *r == '\n')
88 if (r == art->data + art->len) {
92 q = xmalloc(r - text + 1);
93 memcpy(q, text, r - text);
97 /* Write the desired info. */
98 for (Dirty = false, p = format; *p; p++) {