cmake
[awesomized/libmemcached] / libtest / server.cc
index 33b20ad89c3b940bde58b2905ab715029a3f54fa..bfb265cdb5811520b22a45d0a689ac36e29f1a96 100644 (file)
@@ -43,6 +43,7 @@
 #include <climits>
 #include <cstdlib>
 #include <iostream>
+#include <string>
 
 #include <algorithm> 
 #include <functional> 
@@ -129,9 +130,8 @@ Server::~Server()
 
 bool Server::check()
 {
-  _app.slurp();
-  _app.check();
-  return true;
+  _app.clear();
+  return _app.check();
 }
 
 bool Server::validate()
@@ -173,6 +173,22 @@ bool Server::wait_for_pidfile() const
   return wait.successful();
 }
 
+bool Server::init(const char *argv[])
+{
+  if (argv)
+  {
+    for (const char **ptr= argv; *ptr ; ++ptr)
+    {
+      if (ptr)
+      {
+        add_option(*ptr);
+      }
+    }
+  }
+
+  return build();
+}
+
 bool Server::has_pid() const
 {
   return (_app.pid() > 1);
@@ -181,14 +197,6 @@ bool Server::has_pid() const
 
 bool Server::start()
 {
-  // If we find that we already have a pid then kill it.
-  if (has_pid() == true)
-  {
-#if 0
-    fatal_message("has_pid() failed, programer error");
-#endif
-  }
-
   if (getenv("YATL_GDB_SERVER"))
   {
     _app.use_gdb(true);