X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/8e58a1769ce5e492dd68904dfc81b6e077fc2a3a..e02c731dfbb288c736f2cd09a9b6df0507c59ddd:/keymerge.c diff --git a/keymerge.c b/keymerge.c deleted file mode 100644 index fb95c2d..0000000 --- a/keymerge.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * keymerge.c - Takes a key on stdin, merges it and outputs the difference. - * - * Jonathan McDowell - * - * Copyright 2002 Project Purple - */ - -#include -#include - -#include "armor.h" -#include "keydb.h" -#include "keyid.h" -#include "keystructs.h" -#include "mem.h" -#include "merge.h" -#include "parsekey.h" - -int stdin_getchar(void *ctx, size_t count, unsigned char *c) -{ - int ic; - - do { - ic = getchar(); - *c = ic; - c++; - } while ((ic != EOF) && (--count > 0)); - return (ic == EOF); -} - -int stdout_putchar(void *ctx, unsigned char c) -{ - return (putchar(c)); -} - - -int main(int argc, char *argv[]) -{ - struct openpgp_packet_list *packets = NULL; - struct openpgp_packet_list *list_end = NULL; - struct openpgp_publickey *keys = NULL; - int rc = EXIT_SUCCESS; - - dearmor_openpgp_stream(stdin_getchar, NULL, &packets); - if (packets != NULL) { - parse_keys(packets, &keys); - free_packet_list(packets); - packets = NULL; - - initdb(); - fprintf(stderr, "Got %d new keys.\n", - update_keys(&keys)); - cleanupdb(); - } else { - rc = 1; - fprintf(stderr, "No keys read.\n"); - } - - if (keys != NULL) { - flatten_publickey(keys, &packets, &list_end); - free_publickey(keys); - keys = NULL; - - armor_openpgp_stream(stdout_putchar, NULL, packets); - free_packet_list(packets); - packets = NULL; - } else { - rc = 1; - fprintf(stderr, "No changes.\n"); - } - - return rc; -}