[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 19/28: getopt API porting.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 19/28: getopt API porting. |
Date: |
Fri, 17 Mar 2017 12:09:51 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit e6b3fec9e4a573e1f0c594a3c2f345357c0c12b8
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Mar 15 16:21:06 2017 +0100
getopt API porting.
---
src/dht/gnunet-dht-get.c | 71 +++++++++++++++++-----------
src/dht/gnunet-dht-monitor.c | 50 +++++++++++---------
src/dht/gnunet-dht-put.c | 87 +++++++++++++++++++++--------------
src/dht/gnunet_dht_profiler.c | 73 +++++++++++++++++++----------
src/hostlist/gnunet-daemon-hostlist.c | 31 +++++++------
src/nse/gnunet-nse-profiler.c | 65 +++++++++++++++++---------
6 files changed, 232 insertions(+), 145 deletions(-)
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index ce479dc3e..812e62b17 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -50,7 +50,7 @@ static struct GNUNET_TIME_Relative timeout_request = { 60000
};
/**
* Be verbose
*/
-static int verbose;
+static unsigned int verbose;
/**
* Use DHT demultixplex_everywhere
@@ -226,33 +226,6 @@ run (void *cls, char *const *args, const char *cfgfile,
}
-
-/**
- * gnunet-dht-get command line options
- */
-static struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'k', "key", "KEY",
- gettext_noop ("the query key"),
- 1, &GNUNET_GETOPT_set_string, &query_key},
- {'r', "replication", "LEVEL",
- gettext_noop ("how many parallel requests (replicas) to create"),
- 1, &GNUNET_GETOPT_set_uint, &replication},
- {'t', "type", "TYPE",
- gettext_noop ("the type of data to look for"),
- 1, &GNUNET_GETOPT_set_uint, &query_type},
- {'T', "timeout", "TIMEOUT",
- gettext_noop ("how long to execute this query before giving up?"),
- 1, &GNUNET_GETOPT_set_relative_time, &timeout_request},
- {'x', "demultiplex", NULL,
- gettext_noop ("use DHT's demultiplex everywhere option"),
- 0, &GNUNET_GETOPT_set_one, &demultixplex_everywhere},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_set_one, &verbose},
- GNUNET_GETOPT_OPTION_END
-};
-
-
/**
* Entry point for gnunet-dht-get
*
@@ -263,6 +236,48 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
int
main (int argc, char *const *argv)
{
+
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('k',
+ "key",
+ "KEY",
+ gettext_noop ("the query key"),
+ &query_key),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('r',
+ "replication",
+ "LEVEL",
+ gettext_noop ("how many parallel requests
(replicas) to create"),
+ &replication),
+
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('t',
+ "type",
+ "TYPE",
+ gettext_noop ("the type of data to look
for"),
+ &query_type),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T',
+ "timeout",
+ "TIMEOUT",
+ gettext_noop ("how long to execute
this query before giving up?"),
+ &timeout_request),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('x',
+ "demultiplex",
+ gettext_noop ("use DHT's demultiplex
everywhere option"),
+ &demultixplex_everywhere),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('V',
+ "verbose",
+ gettext_noop ("be verbose (print progress
information)"),
+ &verbose),
+ GNUNET_GETOPT_OPTION_END
+ };
+
+
+
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
return (GNUNET_OK ==
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c
index 7f14255d3..e4e8c46a1 100644
--- a/src/dht/gnunet-dht-monitor.c
+++ b/src/dht/gnunet-dht-monitor.c
@@ -280,27 +280,6 @@ run (void *cls, char *const *args, const char *cfgfile,
NULL);
}
-
-/**
- * gnunet-dht-monitor command line options
- */
-static struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'k', "key", "KEY",
- gettext_noop ("the query key"),
- 1, &GNUNET_GETOPT_set_string, &query_key},
- {'t', "type", "TYPE",
- gettext_noop ("the type of data to look for"),
- 1, &GNUNET_GETOPT_set_uint, &block_type},
- {'T', "timeout", "TIMEOUT",
- gettext_noop ("how long should the monitor command run"),
- 1, &GNUNET_GETOPT_set_relative_time, &timeout_request},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_set_one, &verbose},
- GNUNET_GETOPT_OPTION_END
-};
-
-
/**
* Entry point for gnunet-dht-monitor
*
@@ -311,6 +290,35 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
int
main (int argc, char *const *argv)
{
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('k',
+ "key",
+ "KEY",
+ gettext_noop ("the query key"),
+ &query_key),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('t',
+ "type",
+ "TYPE",
+ gettext_noop ("the type of data to look
for"),
+ &block_type),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T',
+ "timeout",
+ "TIMEOUT",
+ gettext_noop ("how long should the
monitor command run"),
+ &timeout_request),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('V',
+ "verbose",
+ gettext_noop ("be verbose (print progress
information)"),
+ &verbose),
+
+ GNUNET_GETOPT_OPTION_END
+ };
+
+
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index a44e49d70..55644a94c 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -54,7 +54,7 @@ static unsigned int replication = 5;
/**
* Be verbose
*/
-static int verbose;
+static unsigned int verbose;
/**
* Use #GNUNET_DHT_DEMULTIPLEX_EVERYWHERE.
@@ -191,39 +191,6 @@ run (void *cls,
NULL);
}
-
-/**
- * gnunet-dht-put command line options
- */
-static struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'d', "data", "DATA",
- gettext_noop ("the data to insert under the key"),
- 1, &GNUNET_GETOPT_set_string, &data},
- {'e', "expiration", "EXPIRATION",
- gettext_noop ("how long to store this entry in the dht (in seconds)"),
- 1, &GNUNET_GETOPT_set_relative_time, &expiration},
- {'k', "key", "KEY",
- gettext_noop ("the query key"),
- 1, &GNUNET_GETOPT_set_string, &query_key},
- {'x', "demultiplex", NULL,
- gettext_noop ("use DHT's demultiplex everywhere option"),
- 0, &GNUNET_GETOPT_set_one, &demultixplex_everywhere},
- {'r', "replication", "LEVEL",
- gettext_noop ("how many replicas to create"),
- 1, &GNUNET_GETOPT_set_uint, &replication},
- {'R', "record", NULL,
- gettext_noop ("use DHT's record route option"),
- 0, &GNUNET_GETOPT_set_one, &record_route},
- {'t', "type", "TYPE",
- gettext_noop ("the type to insert data as"),
- 1, &GNUNET_GETOPT_set_uint, &query_type},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_set_one, &verbose},
- GNUNET_GETOPT_OPTION_END
-};
-
-
/**
* Entry point for gnunet-dht-put
*
@@ -234,6 +201,58 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
int
main (int argc, char *const *argv)
{
+
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('d',
+ "data",
+ "DATA",
+ gettext_noop ("the data to insert under the
key"),
+ &data),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('e',
+ "expiration",
+ "EXPIRATION",
+ gettext_noop ("how long to store
this entry in the dht (in seconds)"),
+ &expiration),
+
+ GNUNET_GETOPT_OPTION_STRING ('k',
+ "key",
+ "KEY",
+ gettext_noop ("the query key"),
+ &query_key),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('x',
+ "demultiplex",
+ gettext_noop ("use DHT's demultiplex
everywhere option"),
+ &demultixplex_everywhere),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('r',
+ "replication",
+ "LEVEL",
+ gettext_noop ("how many replicas to
create"),
+ &replication),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('R',
+ "record",
+ gettext_noop ("use DHT's record route
option"),
+ &record_route),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('t',
+ "type",
+ "TYPE",
+ gettext_noop ("the type to insert data as"),
+ &query_type),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('V',
+ "verbose",
+ gettext_noop ("be verbose (print progress
information)"),
+ &verbose),
+
+ GNUNET_GETOPT_OPTION_END
+ };
+
+
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv,
&argc, &argv))
return 2;
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index 460eaa572..f65141640 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -1181,31 +1181,54 @@ main (int argc, char *const *argv)
{
int rc;
- static struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'n', "peers", "COUNT",
- gettext_noop ("number of peers to start"),
- 1, &GNUNET_GETOPT_set_uint, &num_peers},
- {'s', "searches", "COUNT",
- gettext_noop ("maximum number of times we try to search for successor
circle formation (0 for R5N)"),
- 1, &GNUNET_GETOPT_set_uint, &max_searches},
- {'H', "hosts", "FILENAME",
- gettext_noop ("name of the file with the login information for the
testbed"),
- 1, &GNUNET_GETOPT_set_string, &hosts_file},
- {'D', "delay", "DELAY",
- gettext_noop ("delay between rounds for collecting statistics (default:
30 sec)"),
- 1, &GNUNET_GETOPT_set_relative_time, &delay_stats},
- {'P', "PUT-delay", "DELAY",
- gettext_noop ("delay to start doing PUTs (default: 1 sec)"),
- 1, &GNUNET_GETOPT_set_relative_time, &delay_put},
- {'G', "GET-delay", "DELAY",
- gettext_noop ("delay to start doing GETs (default: 5 min)"),
- 1, &GNUNET_GETOPT_set_relative_time, &delay_get},
- {'r', "replication", "DEGREE",
- gettext_noop ("replication degree for DHT PUTs"),
- 1, &GNUNET_GETOPT_set_uint, &replication},
- {'t', "timeout", "TIMEOUT",
- gettext_noop ("timeout for DHT PUT and GET requests (default: 1 min)"),
- 1, &GNUNET_GETOPT_set_relative_time, &timeout},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_UINT ('n',
+ "peers",
+ "COUNT",
+ gettext_noop ("number of peers to start"),
+ &num_peers),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('s',
+ "searches",
+ "COUNT",
+ gettext_noop ("maximum number of times we
try to search for successor circle formation (0 for R5N)"),
+ &max_searches),
+
+ GNUNET_GETOPT_OPTION_STRING ('H',
+ "hosts",
+ "FILENAME",
+ gettext_noop ("name of the file with the
login information for the testbed"),
+ &hosts_file),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('D',
+ "delay",
+ "DELAY",
+ gettext_noop ("delay between
rounds for collecting statistics (default: 30 sec)"),
+ &delay_stats),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('P',
+ "PUT-delay",
+ "DELAY",
+ gettext_noop ("delay to start
doing PUTs (default: 1 sec)"),
+ &delay_put),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('G',
+ "GET-delay",
+ "DELAY",
+ gettext_noop ("delay to start
doing GETs (default: 5 min)"),
+ &delay_get),
+ GNUNET_GETOPT_OPTION_SET_UINT ('r',
+ "replication",
+ "DEGREE",
+ gettext_noop ("replication degree for DHT
PUTs"),
+ &replication),
+
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t',
+ "timeout",
+ "TIMEOUT",
+ gettext_noop ("timeout for DHT PUT
and GET requests (default: 1 min)"),
+ &timeout),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/hostlist/gnunet-daemon-hostlist.c
b/src/hostlist/gnunet-daemon-hostlist.c
index a83d46e07..9b4790c32 100644
--- a/src/hostlist/gnunet-daemon-hostlist.c
+++ b/src/hostlist/gnunet-daemon-hostlist.c
@@ -369,23 +369,26 @@ run (void *cls,
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
#if HAVE_MHD
- {'a', "advertise", NULL,
- gettext_noop ("advertise our hostlist to other peers"),
- GNUNET_NO, &GNUNET_GETOPT_set_one, &advertising},
+ GNUNET_GETOPT_OPTION_SET_ONE ('a',
+ "advertise",
+ gettext_noop ("advertise our hostlist to
other peers"),
+ &advertising),
#endif
- {'b', "bootstrap", NULL,
- gettext_noop
- ("bootstrap using hostlists (it is highly recommended that you always use
this option)"),
- GNUNET_NO, &GNUNET_GETOPT_set_one, &bootstrapping},
- {'e', "enable-learning", NULL,
- gettext_noop ("enable learning about hostlist servers from other peers"),
- GNUNET_NO, &GNUNET_GETOPT_set_one, &learning},
+ GNUNET_GETOPT_OPTION_SET_ONE ('b',
+ "bootstrap",
+ gettext_noop ("bootstrap using hostlists (it
is highly recommended that you always use this option)"),
+ &bootstrapping),
+ GNUNET_GETOPT_OPTION_SET_ONE ('e',
+ "enable-learning",
+ gettext_noop ("enable learning about
hostlist servers from other peers"),
+ &learning),
#if HAVE_MHD
- {'p', "provide-hostlist", NULL,
- gettext_noop ("provide a hostlist server"),
- GNUNET_NO, &GNUNET_GETOPT_set_one, &provide_hostlist},
+ GNUNET_GETOPT_OPTION_SET_ONE ('p',
+ "provide-hostlist",
+ gettext_noop ("provide a hostlist server"),
+ &provide_hostlist),
#endif
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 48afd9298..ea28bf610 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -129,7 +129,7 @@ static int ok;
/**
* Be verbose (configuration option)
*/
-static int verbose;
+static unsigned int verbose;
/**
* Name of the file with the hosts to run the test over (configuration option)
@@ -835,28 +835,47 @@ run (void *cls, char *const *args, const char *cfgfile,
int
main (int argc, char *const *argv)
{
- static struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'C', "connections", "COUNT",
- gettext_noop ("limit to the number of connections to NSE services, 0 for
none"),
- 1, &GNUNET_GETOPT_set_uint, &connection_limit},
- {'d', "details", "FILENAME",
- gettext_noop ("name of the file for writing connection information and
statistics"),
- 1, &GNUNET_GETOPT_set_string, &data_filename},
- {'H', "hosts", "FILENAME",
- gettext_noop ("name of the file with the login information for the
testbed"),
- 1, &GNUNET_GETOPT_set_string, &hosts_file},
- {'o', "output", "FILENAME",
- gettext_noop ("name of the file for writing the main results"),
- 1, &GNUNET_GETOPT_set_string, &output_filename},
- {'p', "peers", "NETWORKSIZESPEC",
- gettext_noop ("Number of peers to run in each round, separated by
commas"),
- 1, &GNUNET_GETOPT_set_string, &num_peer_spec},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_increment_value, &verbose},
- {'w', "wait", "DELAY",
- gettext_noop ("delay between rounds"),
- 1, &GNUNET_GETOPT_set_relative_time, &wait_time},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_UINT ('C',
+ "connections",
+ "COUNT",
+ gettext_noop ("limit to the number of
connections to NSE services, 0 for none"),
+ &connection_limit),
+ GNUNET_GETOPT_OPTION_STRING ('d',
+ "details",
+ "FILENAME",
+ gettext_noop ("name of the file for writing
connection information and statistics"),
+ &data_filename),
+
+ GNUNET_GETOPT_OPTION_STRING ('H',
+ "hosts",
+ "FILENAME",
+ gettext_noop ("name of the file with the
login information for the testbed"),
+ &hosts_file),
+
+ GNUNET_GETOPT_OPTION_STRING ('o',
+ "output",
+ "FILENAME",
+ gettext_noop ("name of the file for writing
the main results"),
+ &output_filename),
+
+
+ GNUNET_GETOPT_OPTION_STRING ('p',
+ "peers",
+ "NETWORKSIZESPEC",
+ gettext_noop ("Number of peers to run in each
round, separated by commas"),
+ &num_peer_spec),
+
+ GNUNET_GETOPT_OPTION_INCREMENT_VALUE ('V',
+ "verbose",
+ gettext_noop ("be verbose (print
progress information)"),
+ &verbose),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('w',
+ "wait",
+ "DELAY",
+ gettext_noop ("delay between
rounds"),
+ &wait_time),
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 14/28: add way to mark options as mandatory, get tests to pass again, (continued)
- [GNUnet-SVN] [gnunet] 14/28: add way to mark options as mandatory, get tests to pass again, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 09/28: fix test case, implement base32 argument parser logic, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 26/28: Fix compiler warnings., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 27/28: Merge branch 'master' into getopt, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 25/28: Last commit as of getopt porting. 'social' still gives warnings., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 18/28: Still porting to new getopt API., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 23/28: porting fs finished., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 21/28: porting, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 08/28: getopt major style fix, remove macro-mania with nicer typed functions, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 20/28: porting., gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 19/28: getopt API porting.,
gnunet <=
- [GNUnet-SVN] [gnunet] 28/28: Merge branch 'getopt', gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 24/28: porting social, gnunet, 2017/03/17
- [GNUnet-SVN] [gnunet] 22/28: porting gnunet-publish + others.., gnunet, 2017/03/17