summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2017-03-15 15:28:41 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2017-03-15 15:28:41 +0100
commit5d6ed5fbda01a324d8d9b800928339d4a90343c3 (patch)
treeb52f65dfc01e42f989df7aa2569ae69695fd9a54 /src/transport
parent294393abdca9f482321696e9aaec64b1a0488607 (diff)
Still porting to new getopt API.
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-transport-profiler.c52
-rw-r--r--src/transport/gnunet-transport.c76
2 files changed, 75 insertions, 53 deletions
diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c
index dceff7e3b..bd4d3072b 100644
--- a/src/transport/gnunet-transport-profiler.c
+++ b/src/transport/gnunet-transport-profiler.c
@@ -151,7 +151,7 @@ static struct GNUNET_PeerIdentity pid;
/**
* Selected level of verbosity.
*/
-static int verbosity;
+static unsigned int verbosity;
/**
@@ -610,26 +610,36 @@ main (int argc, char * const *argv)
benchmark_iterations = DEFAULT_ITERATION_COUNT;
benchmark_running = GNUNET_NO;
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-
- { 's', "send", NULL,
- gettext_noop ("send data to peer"),
- 0, &GNUNET_GETOPT_set_one, &benchmark_send},
- { 'r', "receive", NULL, gettext_noop
- ("receive data from peer"), 0,
- &GNUNET_GETOPT_set_one, &benchmark_receive},
- { 'i', "iterations", NULL, gettext_noop
- ("iterations"), 1,
- &GNUNET_GETOPT_set_uint, &benchmark_iterations},
- { 'n', "number", NULL, gettext_noop
- ("number of messages to send"), 1,
- &GNUNET_GETOPT_set_uint, &benchmark_count},
- { 'm', "messagesize", NULL, gettext_noop
- ("message size to use"), 1,
- &GNUNET_GETOPT_set_uint, &benchmark_size},
- { 'p', "peer", "PEER",
- gettext_noop ("peer identity"), 1, &GNUNET_GETOPT_set_string,
- &cpid },
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('s',
+ "send",
+ gettext_noop ("send data to peer"),
+ &benchmark_send),
+ GNUNET_GETOPT_OPTION_SET_ONE ('r',
+ "receive",
+ gettext_noop ("receive data from peer"),
+ &benchmark_receive),
+ GNUNET_GETOPT_OPTION_SET_UINT ('i',
+ "iterations",
+ NULL,
+ gettext_noop ("iterations"),
+ &benchmark_iterations),
+ GNUNET_GETOPT_OPTION_SET_UINT ('n',
+ "number",
+ NULL,
+ gettext_noop ("number of messages to send"),
+ &benchmark_count),
+ GNUNET_GETOPT_OPTION_SET_UINT ('m',
+ "messagesize",
+ NULL,
+ gettext_noop ("message size to use"),
+ &benchmark_size),
+ GNUNET_GETOPT_OPTION_STRING ('p',
+ "peer",
+ "PEER",
+ gettext_noop ("peer identity"),
+ &cpid),
GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index fcfc94ac8..c0442950d 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -295,7 +295,7 @@ static struct GNUNET_SCHEDULER_Task *op_timeout;
/**
* Selected level of verbosity.
*/
-static int verbosity;
+static unsigned int verbosity;
/**
* Resolver process handle.
@@ -1439,37 +1439,49 @@ main (int argc,
char * const *argv)
{
int res;
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- { 'a', "all", NULL,
- gettext_noop ("print information for all peers (instead of only connected peers)"),
- 0, &GNUNET_GETOPT_set_one, &iterate_all },
- { 'b', "benchmark", NULL,
- gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"),
- 0, &GNUNET_GETOPT_set_one, &benchmark_receive },
- { 'D', "disconnect",
- NULL, gettext_noop ("disconnect from a peer"), 0,
- &GNUNET_GETOPT_set_one, &do_disconnect },
- { 'i', "information", NULL,
- gettext_noop ("provide information about all current connections (once)"),
- 0, &GNUNET_GETOPT_set_one, &iterate_connections },
- { 'm', "monitor", NULL,
- gettext_noop ("provide information about all current connections (continuously)"),
- 0, &GNUNET_GETOPT_set_one, &monitor_connections },
- { 'e', "events", NULL,
- gettext_noop ("provide information about all connects and disconnect events (continuously)"),
- 0, &GNUNET_GETOPT_set_one, &monitor_connects },
- { 'n', "numeric",
- NULL, gettext_noop ("do not resolve hostnames"), 0,
- &GNUNET_GETOPT_set_one, &numeric },
- { 'p', "peer", "PEER",
- gettext_noop ("peer identity"), 1, &GNUNET_GETOPT_set_string,
- &cpid },
- { 'P', "plugins", NULL,
- gettext_noop ("monitor plugin sessions"), 0, &GNUNET_GETOPT_set_one,
- &monitor_plugins },
- { 's', "send", NULL, gettext_noop
- ("send data for benchmarking to the other peer (until CTRL-C)"), 0,
- &GNUNET_GETOPT_set_one, &benchmark_send },
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_ONE ('a',
+ "all",
+ gettext_noop ("print information for all peers (instead of only connected peers)"),
+ &iterate_all),
+ GNUNET_GETOPT_OPTION_SET_ONE ('b',
+ "benchmark",
+ gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"),
+ &benchmark_receive),
+ GNUNET_GETOPT_OPTION_SET_ONE ('D',
+ "disconnect",
+ gettext_noop ("disconnect from a peer"),
+ &do_disconnect),
+ GNUNET_GETOPT_OPTION_SET_ONE ('i',
+ "information",
+ gettext_noop ("provide information about all current connections (once)"),
+ &iterate_connections),
+ GNUNET_GETOPT_OPTION_SET_ONE ('m',
+ "monitor",
+ gettext_noop ("provide information about all current connections (continuously)"),
+ &monitor_connections),
+ GNUNET_GETOPT_OPTION_SET_ONE ('e',
+ "events",
+ gettext_noop ("provide information about all connects and disconnect events (continuously)"),
+ &monitor_connects),
+ GNUNET_GETOPT_OPTION_SET_ONE ('n',
+ "numeric",
+ gettext_noop ("do not resolve hostnames"),
+ &numeric),
+ GNUNET_GETOPT_OPTION_STRING ('p',
+ "peer",
+ "PEER",
+ gettext_noop ("peer identity"),
+ &cpid),
+ GNUNET_GETOPT_OPTION_SET_ONE ('P',
+ "plugins",
+ gettext_noop ("monitor plugin sessions"),
+ &monitor_plugins),
+ GNUNET_GETOPT_OPTION_SET_ONE ('s',
+ "send",
+ gettext_noop
+ ("send data for benchmarking to the other peer (until CTRL-C)"),
+ &benchmark_send),
GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
GNUNET_GETOPT_OPTION_END
};