aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-30 09:04:37 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-30 09:04:37 +0000
commitcac1d893156e00ec06fc3e6961f009c29a115bd9 (patch)
tree16ca6b18be86f7788378dc53cac5bd9a67f69803 /src
parent5fcfc5b84691d1abb216ba5d5ab4b6b8a1f807f4 (diff)
downloadgnunet-cac1d893156e00ec06fc3e6961f009c29a115bd9.tar.gz
gnunet-cac1d893156e00ec06fc3e6961f009c29a115bd9.zip
enable logging as a cmd line arg
Diffstat (limited to 'src')
-rw-r--r--src/ats-tests/gnunet-ats-sim.c31
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
202static char *opt_exp_file;
203static int opt_log;
204
205static void
206parse_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
203int 225int
204main (int argc, char *argv[]) 226main (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");