X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=onak.c;h=7a50d7a728feca5b019291eef9050c870be1b838;hb=556f51f104fbbb5bd0d51b61a18d7e5af2759079;hp=e7c74862c809c16c07828ddfdf76e0a99b4a586b;hpb=e02c731dfbb288c736f2cd09a9b6df0507c59ddd;p=onak.git diff --git a/onak.c b/onak.c index e7c7486..7a50d7a 100644 --- a/onak.c +++ b/onak.c @@ -76,6 +76,7 @@ void usage(void) { puts("\tCommands:\n"); puts("\tadd - read armored OpenPGP keys from stdin and add to the keyserver"); puts("\tdelete - delete a given key from the keyserver"); + puts("\tget - retrieves the key requested from the keyserver"); puts("\tindex - search for a key and list it"); puts("\tvindex - search for a key and list it and its signatures"); } @@ -91,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])) { @@ -125,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; @@ -166,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"); }