X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=onak.c;h=7a50d7a728feca5b019291eef9050c870be1b838;hb=refs%2Ftags%2F0.1.0;hp=87b65e806ade99f0bc3cfb94dedfad709333070e;hpb=870ceebb3ffd90a47102ff04c8f7779177573216;p=onak.git diff --git a/onak.c b/onak.c index 87b65e8..7a50d7a 100644 --- a/onak.c +++ b/onak.c @@ -92,21 +92,27 @@ int main(int argc, char *argv[]) uint64_t keyid = 0; bool ishex = false; bool verbose = false; + bool update = false; bool binary = false; int optchar; - while ((optchar = getopt(argc, argv, "bv")) != -1 ) { + while ((optchar = getopt(argc, argv, "buv")) != -1 ) { switch (optchar) { case 'b': binary = true; break; + case 'u': + update = true; + break; case 'v': verbose = true; break; } } + readconfig(); + if ((argc - optind) < 1) { usage(); } else if (!strcmp("add", argv[optind])) { @@ -126,6 +132,16 @@ int main(int argc, char *argv[]) initdb(); fprintf(stderr, "Got %d new keys.\n", update_keys(&keys, verbose)); + if (keys != NULL && update) { + flatten_publickey(keys, + &packets, + &list_end); + armor_openpgp_stream(stdout_putchar, + NULL, + packets); + free_packet_list(packets); + packets = NULL; + } cleanupdb(); } else { rc = 1; @@ -167,6 +183,8 @@ int main(int argc, char *argv[]) armor_openpgp_stream(stdout_putchar, NULL, packets); + free_packet_list(packets); + packets = NULL; } else { puts("Key not found"); }