From: Brian Aker Date: Fri, 3 May 2013 09:40:41 +0000 (-0400) Subject: Rework how we look at args. X-Git-Tag: 1.0.18~24^2~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=53418c8467e0e0845e8f9875fccf05a6cc5a4684;p=m6w6%2Flibmemcached Rework how we look at args. --- diff --git a/clients/memcp.cc b/clients/memcp.cc index f3c31141..7986e248 100644 --- a/clients/memcp.cc +++ b/clients/memcp.cc @@ -85,6 +85,13 @@ int main(int argc, char *argv[]) { options_parse(argc, argv); + + if (optind >= argc) + { + fprintf(stderr, "Expected argument after options\n"); + exit(EXIT_FAILURE); + } + initialize_sockets(); memcached_st *memc= memcached_create(NULL); @@ -129,10 +136,12 @@ int main(int argc, char *argv[]) { opt_servers= strdup(temp); } +#if 0 else if (argc >= 1 and argv[--argc]) { opt_servers= strdup(argv[argc]); } +#endif if (opt_servers == NULL) {