From: Mark Atwood Date: Sat, 22 Sep 2007 21:04:08 +0000 (-0700) Subject: fix bug in handling some single letter command line options X-Git-Tag: 0.2~8^2~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dd3711e0fb5dc8ea96253ca28db3d1fe3067a920;p=awesomized%2Flibmemcached fix bug in handling some single letter command line options --- diff --git a/src/memcat.c b/src/memcat.c index 1e7f5bf7..924b16d8 100644 --- a/src/memcat.c +++ b/src/memcat.c @@ -90,6 +90,12 @@ void options_parse(int argc, char *argv[]) { case 0: break; + case OPT_VERBOSE: /* --verbose or -v */ + opt_verbose = OPT_VERBOSE; + break; + case OPT_DEBUG: /* --debug or -d */ + opt_verbose = OPT_DEBUG; + break; case OPT_VERSION: /* --version or -V */ printf("memcache tools, memcat, v1.0\n"); exit(0); diff --git a/src/memcp.c b/src/memcp.c index ec9a2faf..d85fd44d 100644 --- a/src/memcp.c +++ b/src/memcp.c @@ -62,8 +62,8 @@ int main(int argc, char *argv[]) { static char *opstr[] = { "set", "add", "replace" }; printf("op: %s\nsource file: %s\nlength: %zu\n" - "key: %s\nflags: %x\n expires: %llu\n", - opstr[opt_method], argv[optind], (size_t)sbuf.st_size, + "key: %s\nflags: %x\nexpires: %llu\n", + opstr[opt_method - OPT_SET], argv[optind], (size_t)sbuf.st_size, ptr, opt_flags, (unsigned long long)opt_expires); } @@ -140,6 +140,12 @@ void options_parse(int argc, char *argv[]) { case 0: break; + case OPT_VERBOSE: /* --verbose or -v */ + opt_verbose = OPT_VERBOSE; + break; + case OPT_DEBUG: /* --debug or -d */ + opt_verbose = OPT_DEBUG; + break; case OPT_VERSION: /* --version or -V */ printf("memcache tools, memcp, v1.0\n"); exit(0); diff --git a/src/memrm.c b/src/memrm.c index 3e468a3d..1fa9f409 100644 --- a/src/memrm.c +++ b/src/memrm.c @@ -72,6 +72,12 @@ void options_parse(int argc, char *argv[]) { case 0: break; + case OPT_VERBOSE: /* --verbose or -v */ + opt_verbose = OPT_VERBOSE; + break; + case OPT_DEBUG: /* --debug or -d */ + opt_verbose = OPT_DEBUG; + break; case OPT_VERSION: /* --version or -V */ printf("memcache tools, memrm, v1.0\n"); exit(0); diff --git a/src/memstat.c b/src/memstat.c index e7810200..a01c35ba 100644 --- a/src/memstat.c +++ b/src/memstat.c @@ -56,6 +56,12 @@ void options_parse(int argc, char *argv[]) { case 0: break; + case OPT_VERBOSE: /* --verbose or -v */ + opt_verbose = OPT_VERBOSE; + break; + case OPT_DEBUG: /* --debug or -d */ + opt_verbose = OPT_DEBUG; + break; case OPT_VERSION: /* --version or -V */ printf("memcache tools, memcat, v1.0\n"); exit(0);