2 * splitkeys.c - Split a keyring into smaller chunks.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2003 Project Purple
12 #include <sys/types.h>
15 #include "charfuncs.h"
16 #include "keystructs.h"
19 #include "onak-conf.h"
22 int main(int argc, char *argv[])
24 struct openpgp_packet_list *packets = NULL;
25 struct openpgp_packet_list *list_end = NULL;
26 struct openpgp_packet_list *tmp = NULL;
34 maxkeys = atoi(argv[1]);
37 "Couldn't parse %s as a number of keys!\n",
44 initlogthing("splitkeys", config.logfile);
47 result = read_openpgp_stream(stdin_getchar, NULL,
49 if (packets != NULL) {
51 while (list_end->next != NULL) {
53 list_end = list_end->next;
54 if (list_end->next == NULL &&
55 list_end->packet->tag == 6) {
59 if (tmp->next != NULL) {
63 snprintf(splitfile, 1023, "splitfile-%d.pgp", count);
64 outfd = open(splitfile, O_WRONLY | O_CREAT, 0664);
65 write_openpgp_stream(file_putchar, &outfd,
68 free_packet_list(packets);
72 } while (packets != NULL);