X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/4b8483ae278577a3adc8d84da81d77019704466f..a2e1e2dba007fbef7046852f333c510fbf3b4307:/main.c?ds=sidebyside diff --git a/main.c b/main.c index 1f86873..f9c7c8e 100644 --- a/main.c +++ b/main.c @@ -4,57 +4,50 @@ #include #include "armor.h" +#include "charfuncs.h" #include "keydb.h" #include "keyid.h" #include "keyindex.h" #include "keystructs.h" #include "parsekey.h" -int getnextchar(void *ctx, size_t count, unsigned char *c) -{ - return (!read(0, c, count)); -} - -int putnextchar(void *ctx, unsigned char c) -{ - return (!write(1, &c, 1)); -} - - int main(int argc, char *argv[]) { - struct openpgp_packet_list *packets = NULL, *newpackets = NULL; + struct openpgp_packet_list *packets = NULL; +/* + , *newpackets = NULL; struct openpgp_packet_list *list_end = NULL; struct openpgp_publickey *keys = NULL; struct openpgp_publickey *newkeys = NULL; void *ctx = NULL; fputs("Doing read_openpgp_stream():\n", stderr); - read_openpgp_stream(getnextchar, ctx, &packets); - -// fputs("Doing dearmor_openpgp_stream():\n", stderr); -// dearmor_openpgp_stream(getnextchar, NULL, &packets); -// fputs("Doing armor_openpgp_stream():\n", stderr); -// armor_openpgp_stream(putnextchar, NULL, packets); - + read_openpgp_stream(getnextchar, ctx, &packets, 0); +*/ + fputs("Doing dearmor_openpgp_stream():\n", stderr); + dearmor_openpgp_stream(stdin_getchar, NULL, &packets); + fputs("Doing armor_openpgp_stream():\n", stderr); + armor_openpgp_stream(stdout_putchar, NULL, packets); + +/* fputs("Doing parse_keys():\n", stderr); parse_keys(packets, &keys); printf("Key id is 0x%llX\n", get_keyid(keys)); -// key_index(keys, true, false, false); + key_index(keys, true, false, false); - initdb(); + initdb(true); fetch_key(get_keyid(keys), &newkeys); cleanupdb(); printf("New key id is 0x%llX\n", get_keyid(newkeys)); -// fputs("Doing flatten_publickey():\n", stderr); -// flatten_publickey(keys, &newpackets, &list_end); - -// fputs("Doing write_openpgp_stream():\n", stderr); -// write_openpgp_stream(putnextchar, ctx, newpackets); + fputs("Doing flatten_publickey():\n", stderr); + flatten_publickey(keys, &newpackets, &list_end); + fputs("Doing write_openpgp_stream():\n", stderr); + write_openpgp_stream(putnextchar, ctx, newpackets); +*/ return 0; }