Fixing broken memstat application
[m6w6/libmemcached] / src / memcp.c
index 9123028b44509fff5007c8c9c92b3825a9d940be..62c6020780beb33611e1ab9d3e981f615ea53fd6 100644 (file)
@@ -12,6 +12,9 @@
 #include "client_options.h"
 #include "utilities.h"
 
+#define PROGRAM_NAME "memcp"
+#define PROGRAM_DESCRIPTION "Copy a set of files to a memcached cluster."
+
 /* Prototypes */
 void options_parse(int argc, char *argv[]);
 
@@ -29,7 +32,7 @@ int main(int argc, char *argv[])
 
   options_parse(argc, argv);
 
-  memc= memcached_init(NULL);
+  memc= memcached_create(NULL);
 
   if (!opt_servers)
     return 0;
@@ -110,7 +113,7 @@ int main(int argc, char *argv[])
     optind++;
   }
 
-  memcached_deinit(memc);
+  memcached_free(memc);
 
   free(opt_servers);
 
@@ -122,6 +125,11 @@ void options_parse(int argc, char *argv[])
   int option_index= 0;
   int option_rv;
 
+  memcached_programs_help_st help_options[]=
+  {
+    {0},
+  };
+
   static struct option long_options[]=
     {
       {"version", no_argument, NULL, OPT_VERSION},
@@ -154,11 +162,11 @@ void options_parse(int argc, char *argv[])
       opt_verbose = OPT_DEBUG;
       break;
     case OPT_VERSION: /* --version or -V */
-      printf("memcache tools, memcp, v1.0\n");
-      exit(0);
+      version_command(PROGRAM_NAME);
+      break;
     case OPT_HELP: /* --help or -h */
-      printf("useful help messages go here\n");
-      exit(0);
+      help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION, long_options, help_options);
+      break;
     case OPT_SERVERS: /* --servers or -s */
       opt_servers= strdup(optarg);
       break;