X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=onak.c;h=903c8f0f7c16b56e1168e1e1a1f302be1f24265f;hb=c7f25997d3d36ac30b26f663e1d257e4625662a1;hp=e2622e445a2e3658fd71aac5ff69d7718793bf09;hpb=0f4971d043c38bae1bfb95201622a1405110f899;p=onak.git diff --git a/onak.c b/onak.c index e2622e4..903c8f0 100644 --- a/onak.c +++ b/onak.c @@ -7,7 +7,7 @@ * * Copyright 2002 Project Purple * - * $Id: onak.c,v 1.13 2003/06/04 20:57:12 noodles Exp $ + * $Id: onak.c,v 1.15 2003/09/28 20:33:34 noodles Exp $ */ #include @@ -28,13 +28,15 @@ int stdin_getchar(void *ctx, size_t count, unsigned char *c) { - int ic; + int ic = 0; - do { + while ((count > 0) && (ic != EOF)) { ic = getchar(); *c = ic; c++; - } while ((ic != EOF) && (--count > 0)); + count--; + } + return (ic == EOF); } @@ -193,7 +195,10 @@ int main(int argc, char *argv[]) } else if (!strcmp("delete", argv[optind])) { delete_key(getfullkeyid(keyid), false); } else if (!strcmp("get", argv[optind])) { - if (fetch_key(keyid, &keys, false)) { + if (!ishex) { + puts("Can't get a key on uid text." + " You must supply a keyid."); + } else if (fetch_key(keyid, &keys, false)) { logthing(LOGTHING_INFO, "Got key."); flatten_publickey(keys, &packets,