/* Given an email via stdin or filename, re-roll the headers and exit. */ #include #include #include #include #include #include int main(int argc, char *argv[]) { int fd = 0; eps_t *e = NULL; header_t *h = NULL; fd = 0; if (argc > 1) { fd = open(argv[1], O_RDONLY, 0600); if (fd == -1) { printf("cannot open %s\n", argv[1]); return 1; } } e = eps_begin(INTERFACE_STREAM, (int *)&fd); if (e == NULL) { printf("eps_begin failed\n"); return 1; } for (h = eps_next_header(e); h; h = eps_next_header(e)) { if ((h->name) && (h->data)) fold_fd(1, h->orig); } if (fd != 0) close(fd); eps_end(e); return 0; }