summaryrefslogtreecommitdiff
path: root/i/marvin
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin')
-rw-r--r--i/marvin/src/config/config_data.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/i/marvin/src/config/config_data.cc b/i/marvin/src/config/config_data.cc
index b126082..e531031 100644
--- a/i/marvin/src/config/config_data.cc
+++ b/i/marvin/src/config/config_data.cc
@@ -94,7 +94,37 @@ class ConfigParser : public Parser
void
ConfigData::init (int &argc, char **&argv, const std::string &file)
{
+ std::string configFile (file);
+ // Parse la ligne de commande.
+ for (int i = 1; i < argc; )
+ {
+ int del = 0;
+ // -F CONFIG_FILE
+ if (argv[i][0] == '-' && argv[i][1] == 'F')
+ {
+ if (argv[i][2] != '\0')
+ {
+ del = 1;
+ configFile = &argv[i][2];
+ }
+ else if (i + 1 < argc)
+ {
+ del = 2;
+ configFile = argv[i + 1];
+ }
+ }
+ // Supprime ces arguments de la liste.
+ if (del)
+ {
+ for (int j = i; j < argc - del + 1; j++)
+ argv[j] = argv[j + del];
+ argc -= del;
+ }
+ else
+ i++;
+ }
+ // Lit le fichier de config.
ConfigParser p (*this);
- p.parseFile (file);
+ p.parseFile (configFile);
}