diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-15 16:21:06 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-15 16:21:06 +0100 |
commit | e6b3fec9e4a573e1f0c594a3c2f345357c0c12b8 (patch) | |
tree | 2fecdbebccc0970ff483ed28ea327f056f87423b /src/dht/gnunet-dht-put.c | |
parent | 5d6ed5fbda01a324d8d9b800928339d4a90343c3 (diff) | |
download | gnunet-e6b3fec9e4a573e1f0c594a3c2f345357c0c12b8.tar.gz gnunet-e6b3fec9e4a573e1f0c594a3c2f345357c0c12b8.zip |
getopt API porting.
Diffstat (limited to 'src/dht/gnunet-dht-put.c')
-rw-r--r-- | src/dht/gnunet-dht-put.c | 87 |
1 files changed, 53 insertions, 34 deletions
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; | |||
54 | /** | 54 | /** |
55 | * Be verbose | 55 | * Be verbose |
56 | */ | 56 | */ |
57 | static int verbose; | 57 | static unsigned int verbose; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Use #GNUNET_DHT_DEMULTIPLEX_EVERYWHERE. | 60 | * Use #GNUNET_DHT_DEMULTIPLEX_EVERYWHERE. |
@@ -191,39 +191,6 @@ run (void *cls, | |||
191 | NULL); | 191 | NULL); |
192 | } | 192 | } |
193 | 193 | ||
194 | |||
195 | /** | ||
196 | * gnunet-dht-put command line options | ||
197 | */ | ||
198 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
199 | {'d', "data", "DATA", | ||
200 | gettext_noop ("the data to insert under the key"), | ||
201 | 1, &GNUNET_GETOPT_set_string, &data}, | ||
202 | {'e', "expiration", "EXPIRATION", | ||
203 | gettext_noop ("how long to store this entry in the dht (in seconds)"), | ||
204 | 1, &GNUNET_GETOPT_set_relative_time, &expiration}, | ||
205 | {'k', "key", "KEY", | ||
206 | gettext_noop ("the query key"), | ||
207 | 1, &GNUNET_GETOPT_set_string, &query_key}, | ||
208 | {'x', "demultiplex", NULL, | ||
209 | gettext_noop ("use DHT's demultiplex everywhere option"), | ||
210 | 0, &GNUNET_GETOPT_set_one, &demultixplex_everywhere}, | ||
211 | {'r', "replication", "LEVEL", | ||
212 | gettext_noop ("how many replicas to create"), | ||
213 | 1, &GNUNET_GETOPT_set_uint, &replication}, | ||
214 | {'R', "record", NULL, | ||
215 | gettext_noop ("use DHT's record route option"), | ||
216 | 0, &GNUNET_GETOPT_set_one, &record_route}, | ||
217 | {'t', "type", "TYPE", | ||
218 | gettext_noop ("the type to insert data as"), | ||
219 | 1, &GNUNET_GETOPT_set_uint, &query_type}, | ||
220 | {'V', "verbose", NULL, | ||
221 | gettext_noop ("be verbose (print progress information)"), | ||
222 | 0, &GNUNET_GETOPT_set_one, &verbose}, | ||
223 | GNUNET_GETOPT_OPTION_END | ||
224 | }; | ||
225 | |||
226 | |||
227 | /** | 194 | /** |
228 | * Entry point for gnunet-dht-put | 195 | * Entry point for gnunet-dht-put |
229 | * | 196 | * |
@@ -234,6 +201,58 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { | |||
234 | int | 201 | int |
235 | main (int argc, char *const *argv) | 202 | main (int argc, char *const *argv) |
236 | { | 203 | { |
204 | |||
205 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
206 | |||
207 | GNUNET_GETOPT_OPTION_STRING ('d', | ||
208 | "data", | ||
209 | "DATA", | ||
210 | gettext_noop ("the data to insert under the key"), | ||
211 | &data), | ||
212 | |||
213 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('e', | ||
214 | "expiration", | ||
215 | "EXPIRATION", | ||
216 | gettext_noop ("how long to store this entry in the dht (in seconds)"), | ||
217 | &expiration), | ||
218 | |||
219 | GNUNET_GETOPT_OPTION_STRING ('k', | ||
220 | "key", | ||
221 | "KEY", | ||
222 | gettext_noop ("the query key"), | ||
223 | &query_key), | ||
224 | |||
225 | GNUNET_GETOPT_OPTION_SET_ONE ('x', | ||
226 | "demultiplex", | ||
227 | gettext_noop ("use DHT's demultiplex everywhere option"), | ||
228 | &demultixplex_everywhere), | ||
229 | |||
230 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | ||
231 | "replication", | ||
232 | "LEVEL", | ||
233 | gettext_noop ("how many replicas to create"), | ||
234 | &replication), | ||
235 | |||
236 | GNUNET_GETOPT_OPTION_SET_ONE ('R', | ||
237 | "record", | ||
238 | gettext_noop ("use DHT's record route option"), | ||
239 | &record_route), | ||
240 | |||
241 | GNUNET_GETOPT_OPTION_SET_UINT ('t', | ||
242 | "type", | ||
243 | "TYPE", | ||
244 | gettext_noop ("the type to insert data as"), | ||
245 | &query_type), | ||
246 | |||
247 | GNUNET_GETOPT_OPTION_SET_ONE ('V', | ||
248 | "verbose", | ||
249 | gettext_noop ("be verbose (print progress information)"), | ||
250 | &verbose), | ||
251 | |||
252 | GNUNET_GETOPT_OPTION_END | ||
253 | }; | ||
254 | |||
255 | |||
237 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, | 256 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, |
238 | &argc, &argv)) | 257 | &argc, &argv)) |
239 | return 2; | 258 | return 2; |