diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-01-30 09:04:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-01-30 09:04:37 +0000 |
commit | cac1d893156e00ec06fc3e6961f009c29a115bd9 (patch) | |
tree | 16ca6b18be86f7788378dc53cac5bd9a67f69803 /src/ats-tests/gnunet-ats-sim.c | |
parent | 5fcfc5b84691d1abb216ba5d5ab4b6b8a1f807f4 (diff) | |
download | gnunet-cac1d893156e00ec06fc3e6961f009c29a115bd9.tar.gz gnunet-cac1d893156e00ec06fc3e6961f009c29a115bd9.zip |
enable logging as a cmd line arg
Diffstat (limited to 'src/ats-tests/gnunet-ats-sim.c')
-rw-r--r-- | src/ats-tests/gnunet-ats-sim.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c index 6f95d9ce1..c7febecc9 100644 --- a/src/ats-tests/gnunet-ats-sim.c +++ b/src/ats-tests/gnunet-ats-sim.c | |||
@@ -199,19 +199,44 @@ static void topology_setup_done (void *cls, | |||
199 | e->max_duration), &do_shutdown, NULL); | 199 | e->max_duration), &do_shutdown, NULL); |
200 | } | 200 | } |
201 | 201 | ||
202 | static char *opt_exp_file; | ||
203 | static int opt_log; | ||
204 | |||
205 | static void | ||
206 | parse_args (int argc, char *argv[]) | ||
207 | { | ||
208 | int c; | ||
209 | opt_exp_file = NULL; | ||
210 | opt_log = GNUNET_NO; | ||
211 | |||
212 | for (c = 0; c < argc; c++) | ||
213 | { | ||
214 | if ((c < (argc - 1)) && (0 == strcmp (argv[c], "-e"))) | ||
215 | { | ||
216 | opt_exp_file = GNUNET_strdup ( argv[c + 1]); | ||
217 | } | ||
218 | if (0 == strcmp (argv[c], "-l")) | ||
219 | { | ||
220 | opt_log = GNUNET_YES; | ||
221 | } | ||
222 | } | ||
223 | } | ||
202 | 224 | ||
203 | int | 225 | int |
204 | main (int argc, char *argv[]) | 226 | main (int argc, char *argv[]) |
205 | { | 227 | { |
206 | GNUNET_log_setup("gnunet-ats-sim", "INFO", NULL); | 228 | GNUNET_log_setup("gnunet-ats-sim", "INFO", NULL); |
207 | if (argc < 2) | 229 | |
230 | parse_args (argc, argv); | ||
231 | if (NULL == opt_exp_file ) | ||
208 | { | 232 | { |
209 | fprintf (stderr, "No experiment given...\n"); | 233 | fprintf (stderr, "No experiment given...\n"); |
210 | return 1; | 234 | return 1; |
211 | } | 235 | } |
212 | 236 | ||
213 | fprintf (stderr, "Loading experiment `%s' \n", argv[1]); | 237 | fprintf (stderr, "Loading experiment `%s' \n", opt_exp_file ); |
214 | e = GNUNET_ATS_TEST_experimentation_load (argv[1]); | 238 | e = GNUNET_ATS_TEST_experimentation_load (opt_exp_file); |
239 | GNUNET_free (opt_exp_file); | ||
215 | if (NULL == e) | 240 | if (NULL == e) |
216 | { | 241 | { |
217 | fprintf (stderr, "Invalid experiment\n"); | 242 | fprintf (stderr, "Invalid experiment\n"); |