X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4127785827a5debfc03b9e6c09a7bfc45513951e..ddae68a9d73e8c00f9702de9da881f81eee1cde6:/src/surf/surf_config.c diff --git a/src/surf/surf_config.c b/src/surf/surf_config.c index 49b3b2a0dd..ebc30f74f9 100644 --- a/src/surf/surf_config.c +++ b/src/surf/surf_config.c @@ -1,228 +1,672 @@ -/* $Id$ */ - -/* Copyright (c) 2009 The SimGrid team. All rights reserved. */ +/* Copyright (c) 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ /* surf_config: configuration infrastructure for the simulation world */ +#include "xbt/misc.h" #include "xbt/config.h" +#include "xbt/log.h" #include "xbt/str.h" #include "surf/surf_private.h" +#include "surf/surf_routing.h" /* COORD_HOST_LEVEL and COORD_ASR_LEVEL */ +#include "simgrid/simix.h" +#include "mc/mc.h" /* configuration callbacks of model-checking */ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of surf (and the rest of the simulation)"); xbt_cfg_t _surf_cfg_set = NULL; - /* Parse the command line, looking for options */ static void surf_config_cmd_line(int *argc, char **argv) { + int shall_exit = 0; int i, j; char *opt; - for (i = 1; i < *argc; i++) { - int remove_it = 0; + for (j = i = 1; i < *argc; i++) { if (!strncmp(argv[i], "--cfg=", strlen("--cfg="))) { opt = strchr(argv[i], '='); opt++; xbt_cfg_set_parse(_surf_cfg_set, opt); - DEBUG1("Did apply '%s' as config setting", opt); - remove_it = 1; - } else if (!strncmp(argv[i], "--cfg-help", strlen("--cfg-help") + 1) || - !strncmp(argv[i], "--help", strlen("--help") + 1)) { + XBT_DEBUG("Did apply '%s' as config setting", opt); + } else if (!strcmp(argv[i], "--cfg-help") || !strcmp(argv[i], "--help")) { printf - ("Description of the configuration accepted by this simulator:\n"); + ("Description of the configuration accepted by this simulator:\n"); xbt_cfg_help(_surf_cfg_set); - remove_it = 1; - exit(0); - } - if (remove_it) { /*remove this from argv */ - for (j = i + 1; j < *argc; j++) { - argv[j - 1] = argv[j]; - } - - argv[j - 1] = NULL; - (*argc)--; - i--; /* compensate effect of next loop incrementation */ + printf( +"\n" +"Each of these configurations can be used by adding\n" +" --cfg=