Add -1 to Debian package version
[onak.git] / onak.c
diff --git a/onak.c b/onak.c
index 3a6f62fad122af9e8103ce87eaab04d60c4610b1..b3cc27eb74bbc6203a1d12c8a5c2aec67cd8991f 100644 (file)
--- a/onak.c
+++ b/onak.c
@@ -21,7 +21,6 @@
 #include "charfuncs.h"
 #include "cleankey.h"
 #include "cleanup.h"
-#include "config.h"
 #include "keydb.h"
 #include "keyid.h"
 #include "keyindex.h"
@@ -32,6 +31,7 @@
 #include "onak-conf.h"
 #include "parsekey.h"
 #include "photoid.h"
+#include "version.h"
 
 void find_keys(char *search, uint64_t keyid, bool ishex,
                bool fingerprint, bool exact, bool verbose)
@@ -74,7 +74,7 @@ void dump_func(void *ctx, struct openpgp_publickey *key)
 
        state = (struct dump_ctx *) ctx;
 
-       if (state->fd == -1 || state->count > state->maxcount) {
+       if (state->fd == -1 || state->count++ > state->maxcount) {
                if (state->fd != -1) {
                        close(state->fd);
                        state->fd = -1;
@@ -93,7 +93,7 @@ void dump_func(void *ctx, struct openpgp_publickey *key)
 }
 
 void usage(void) {
-       puts("onak " PACKAGE_VERSION " - an OpenPGP keyserver.\n");
+       puts("onak " ONAK_VERSION " - an OpenPGP keyserver.\n");
        puts("Usage:\n");
        puts("\tonak [options] <command> <parameters>\n");
        puts("\tCommands:\n");
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
        } else if (!strcmp("dump", argv[optind])) {
                config.dbbackend->initdb(true);
                dumpstate.count = dumpstate.filenum = 0;
-               dumpstate.maxcount = 1000000;
+               dumpstate.maxcount = 100000;
                dumpstate.fd = -1;
                dumpstate.filebase = "keydump.%d.pgp";
                config.dbbackend->iterate_keys(dump_func, &dumpstate);
@@ -322,9 +322,15 @@ int main(int argc, char *argv[])
                                                &packets,
                                                &list_end);
                                free_publickey(keys);
-                               armor_openpgp_stream(stdout_putchar,
+                               if (binary) {
+                                       write_openpgp_stream(stdout_putchar,
                                                NULL,
                                                packets);
+                               } else {
+                                       armor_openpgp_stream(stdout_putchar,
+                                               NULL,
+                                               packets);
+                               }
                                free_packet_list(packets);
                                packets = NULL;
                        } else {