X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemerror.c;h=c30dd2e9d9f69ab307d05b98672f4da95150082b;hb=6bc6cf720913ae042f36e62e09abce7d340607ab;hp=fbad55ba2f00245d2182bcbda522ee20c3428647;hpb=1b18496b3d1399d90cfba1975f23aee9c747445a;p=awesomized%2Flibmemcached diff --git a/clients/memerror.c b/clients/memerror.c index fbad55ba..c30dd2e9 100644 --- a/clients/memerror.c +++ b/clients/memerror.c @@ -1,4 +1,15 @@ -#include "libmemcached/common.h" +/* LibMemcached + * Copyright (C) 2006-2009 Brian Aker + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + * + * Summary: + * + */ +#include "config.h" + #include #include #include @@ -20,14 +31,25 @@ static int opt_verbose= 0; int main(int argc, char *argv[]) { + unsigned long value; options_parse(argc, argv); if (argc != 2) - return 1; + return EXIT_FAILURE; + + value= strtoul(argv[1], (char **) NULL, 10); - printf("%s\n", memcached_strerror(NULL, atoi(argv[1]))); + if (value < MEMCACHED_MAXIMUM_RETURN) + { + printf("%s\n", memcached_strerror(NULL, (memcached_return_t)value)); + } + else + { + fprintf(stderr, "Unknown Error Code\n"); + return EXIT_FAILURE; + } - return 0; + return EXIT_SUCCESS; }