More marshalling simplification
[invirt/third/libt4.git] / rsm_tester.cc
index 08034e2..1a8b833 100644 (file)
@@ -2,39 +2,27 @@
 // RSM test client
 //
 
+#include "types.h"
 #include "rsm_protocol.h"
 #include "rsmtest_client.h"
-#include "rpc.h"
-#include <arpa/inet.h>
-#include <vector>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string>
-using namespace std;
 
-rsmtest_client *lc;
+char log_thread_prefix = 't';
 
-int
-main(int argc, char *argv[])
-{
-  int r;
+int main(int argc, char *argv[]) {
+    if(argc != 4){
+        cerr << "Usage: " << argv[0] << " [host:]port [partition] arg" << endl;
+        return 1;
+    }
 
-  if(argc != 4){
-    fprintf(stderr, "Usage: %s [host:]port [partition] arg\n", argv[0]);
-    exit(1);
-  }
-
-  lc = new rsmtest_client(argv[1]);
-  string command(argv[2]);
-  if (command == "partition") {
-    r = lc->net_repair(atoi(argv[3]));
-    printf ("net_repair returned %d\n", r);
-  } else if (command == "breakpoint") {
-    int b = atoi(argv[3]);
-    r = lc->breakpoint(b);
-    printf ("breakpoint %d returned %d\n", b, r);
-  } else {
-    fprintf(stderr, "Unknown command %s\n", argv[2]);
-  }
-  exit(0);
+    rsmtest_client *lc = new rsmtest_client(argv[1]);
+    string command(argv[2]);
+    if (command == "partition") {
+        cout << "net_repair returned " << lc->net_repair(stoi(argv[3]));
+    } else if (command == "breakpoint") {
+        int b = stoi(argv[3]);
+        cout << "breakpoint " << b << " returned " << lc->breakpoint(b);
+    } else {
+        cerr << "Unknown command " << argv[2] << endl;
+    }
+    return 0;
 }