Porting leftovers to new getopt API.
authorMarcello Stanisci <marcello.stanisci@inria.fr>
Fri, 17 Mar 2017 13:24:13 +0000 (14:24 +0100)
committerMarcello Stanisci <marcello.stanisci@inria.fr>
Fri, 17 Mar 2017 13:26:07 +0000 (14:26 +0100)
src/ats/gnunet-ats-solver-eval.c
src/ats/perf_ats_solver.c
src/cadet/test_cadet.c
src/conversation/gnunet-conversation.c
src/dv/gnunet-dv.c
src/regex/gnunet-regex-simulation-profiler.c

index e2e68562c8505f76857d3fc4015d7f151fa3e9d9..597285f5ed4c7361729f5b09b265312cee0f537a 100644 (file)
@@ -3289,24 +3289,33 @@ main (int argc, char *argv[])
 
   static struct GNUNET_GETOPT_CommandLineOption options[] =
   {
-    { 's', "solver", NULL,
-        gettext_noop ("solver to use"),
-        1, &GNUNET_GETOPT_set_string, &opt_solver},
-    {  'e', "experiment", NULL,
-      gettext_noop ("experiment to use"),
-      1, &GNUNET_GETOPT_set_string, &opt_exp_file},
-    {  'V', "verbose", NULL,
-      gettext_noop ("be verbose"),
-      0, &GNUNET_GETOPT_set_one, &opt_verbose},
-    {  'p', "print", NULL,
-      gettext_noop ("print logging"),
-      0, &GNUNET_GETOPT_set_one, &opt_print},
-    {  'f', "file", NULL,
-        gettext_noop ("save logging to disk"),
-        0, &GNUNET_GETOPT_set_one, &opt_save},
-    {  'd', "dn", NULL,
-        gettext_noop ("disable normalization"),
-        0, &GNUNET_GETOPT_set_one, &opt_disable_normalization},
+    GNUNET_GETOPT_OPTION_STRING ('s',
+                                 "solver",
+                                 gettext_noop ("solver to use"),
+                                 &opt_solver),
+
+    GNUNET_GETOPT_OPTION_STRING ('e',
+                                 "experiment"
+                                 gettext_noop ("experiment to use"),
+                                 &opt_exp_file),
+
+    GNUNET_GETOPT_OPTION_VERBOSE (&opt_verbose),
+
+    GNUNET_GETOPT_OPTION_SET_ONE ('p', 
+                                  "print",
+                                  gettext_noop ("print logging"),
+                                  &opt_print),
+
+    GNUNET_GETOPT_OPTION_SET_ONE ('f',
+                                  "file",
+                                  gettext_noop ("save logging to disk"),
+                                  &opt_save),
+
+    GNUNET_GETOPT_OPTION_SET_ONE ('d', 
+                                  "dn",
+                                  gettext_noop ("disable normalization"),
+                                  &opt_disable_normalization),
+
     GNUNET_GETOPT_OPTION_END
   };
 
index f05668e9bc49d3ddd64d9f4cb1bfff38b3e89db0..855899b3627640514db76650a98ed623477f4cea 100644 (file)
@@ -1404,27 +1404,42 @@ main (int argc, char *argv[])
   ph.total_iterations = 1;
 
   static struct GNUNET_GETOPT_CommandLineOption options[] = {
-      { 'a', "addresses", NULL,
-          gettext_noop ("addresses to use"),
-          1, &GNUNET_GETOPT_set_uint, &ph.N_address },
-      { 's', "start", NULL,
-          gettext_noop ("start with peer"),
-          1, &GNUNET_GETOPT_set_uint, &ph.N_peers_start },
-      { 'e', "end", NULL,
-          gettext_noop ("end with peer"),
-          1, &GNUNET_GETOPT_set_uint, &ph.N_peers_end },
-      { 'i', "iterations", NULL,
-          gettext_noop ("number of iterations used for averaging (default: 1)"),
-          1, &GNUNET_GETOPT_set_uint, &ph.total_iterations },
-      { 'p', "percentage", NULL,
-          gettext_noop ("update a fix percentage of addresses"),
-          1, &GNUNET_GETOPT_set_uint, &ph.opt_update_percent },
-      { 'd', "data", NULL,
-          gettext_noop ("create data file"),
-          0, &GNUNET_GETOPT_set_one, &ph.create_datafile},
-      { 'u', "update", NULL,
-          gettext_noop ("measure updates"),
-          0, &GNUNET_GETOPT_set_one, &ph.measure_updates},
+
+      GNUNET_GETOPT_OPTION_SET_UINT ('a',
+                                     "addresses",
+                                     gettext_noop ("addresses to use"),
+                                     &ph.N_address),
+
+      GNUNET_GETOPT_OPTION_SET_UINT ('s',
+                                     "start",
+                                     gettext_noop ("start with peer"),
+                                     &ph.N_peers_start),
+
+      GNUNET_GETOPT_OPTION_SET_UINT ('e',
+                                     "end",
+                                     gettext_noop ("end with peer"),
+                                     &ph.N_peers_end),
+
+      GNUNET_GETOPT_OPTION_SET_UINT ('i',
+                                     "iterations",
+                                     gettext_noop ("number of iterations used for averaging (default: 1)"),
+                                     &ph.total_iterations),
+
+      GNUNET_GETOPT_OPTION_SET_UINT ('p',
+                                     "percentage",
+                                     gettext_noop ("update a fix percentage of addresses"),
+                                     &ph.opt_update_percent),
+
+      GNUNET_GETOPT_OPTION_SET_ONE ('d',
+                                    "data",
+                                    gettext_noop ("create data file"),
+                                    &ph.create_datafile),
+
+      GNUNET_GETOPT_OPTION_SET_ONE ('u',
+                                    "update",
+                                    gettext_noop ("measure updates"),
+                                    &ph.measure_updates),
+
       GNUNET_GETOPT_OPTION_END
   };
 
index 3586b26ac50af40a7f5690c07ced3f089d4e8912..a7304c3ee219ae3a0c48d62720d05fa3bba9f29d 100644 (file)
@@ -962,12 +962,17 @@ main (int argc, char *argv[])
   char port_id[] = "test port";
 
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-    {'t', "time", "short_time",
-     gettext_noop ("set short timeout"),
-     GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &short_time},
-    {'m', "messages", "NUM_MESSAGES",
-     gettext_noop ("set number of messages to send"),
-     GNUNET_YES, &GNUNET_GETOPT_set_uint, &total_packets},
+    GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t',
+                                            "time",
+                                            "short_time",
+                                            gettext_noop ("set short timeout"),
+                                            &short_time),
+
+    GNUNET_GETOPT_OPTION_SET_UINT ('m',
+                                   "messages",
+                                   "NUM_MESSAGES",
+                                   gettext_noop ("set number of messages to send"),
+                                   &total_packets),
 
     GNUNET_GETOPT_OPTION_END
   };
index 925db4665694bde3a33794fd838b1bc4011947f9..c5275c0de4616fb0d634806c0d19b1f0f3d01d8e 100644 (file)
@@ -1265,13 +1265,20 @@ run (void *cls,
 int
 main (int argc, char *const *argv)
 {
-  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-    {'e', "ego", "NAME",
-     gettext_noop ("sets the NAME of the ego to use for the phone (and name resolution)"),
-     1, &GNUNET_GETOPT_set_string, &ego_name},
-    {'p', "phone", "LINE",
-      gettext_noop ("sets the LINE to use for the phone"),
-     1, &GNUNET_GETOPT_set_string, &line},
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+    GNUNET_GETOPT_OPTION_STRING ('e',
+                                 "ego",
+                                 "NAME",
+                                 gettext_noop ("sets the NAME of the ego to use for the phone (and name resolution)"),
+                                 &ego_name),
+
+    GNUNET_GETOPT_OPTION_STRING ('p',
+                                 "phone",
+                                 "LINE",
+                                 gettext_noop ("sets the LINE to use for the phone"),
+                                 &line),
+
     GNUNET_GETOPT_OPTION_END
   };
   int ret;
index d0917d3631bd15086b44ffbdd15f7f84d4597ee2..cb40bb6d28e1da09e57b999107a681c1072aeaff 100644 (file)
@@ -34,7 +34,7 @@ static struct GNUNET_DV_ServiceHandle *sh;
 /**
  * Was verbose specified?
  */
-static int verbose;
+static unsigned int verbose;
 
 
 /**
@@ -161,10 +161,10 @@ main (int argc, char *const *argv)
 {
   int res;
 
-  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-    {'V', "verbose", NULL,
-     gettext_noop ("verbose output"),
-     0, &GNUNET_GETOPT_set_one, &verbose},
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+    GNUNET_GETOPT_OPTION_VERBOSE (&verbose),
+
     GNUNET_GETOPT_OPTION_END
   };
 
index 025a7031600d735bbc78b119a4b11b96e27c93c5..422e455653096ef51a9983d1a2faa7165011a0ef 100644 (file)
@@ -691,13 +691,20 @@ run (void *cls,
 int
 main (int argc, char *const *argv)
 {
-  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-    {'t', "table", "TABLENAME",
-     gettext_noop ("name of the table to write DFAs"),
-     1, &GNUNET_GETOPT_set_string, &table_name},
-    {'p', "max-path-compression", "MAX_PATH_COMPRESSION",
-     gettext_noop ("maximum path compression length"),
-     1, &GNUNET_GETOPT_set_uint, &max_path_compression},
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+    GNUNET_GETOPT_OPTION_STRING ('t',
+                                 "table",
+                                 "TABLENAME",
+                                 gettext_noop ("name of the table to write DFAs"),
+                                 &table_name),
+
+    GNUNET_GETOPT_OPTION_SET_UINT ('p',
+                                   "max-path-compression",
+                                   "MAX_PATH_COMPRESSION",
+                                   gettext_noop ("maximum path compression length"),
+                                   &max_path_compression),
+
     GNUNET_GETOPT_OPTION_END
   };
   int ret;