summaryrefslogtreecommitdiff
path: root/i/marvin/src
diff options
context:
space:
mode:
authorschodet2006-05-20 18:55:44 +0000
committerschodet2006-05-20 18:55:44 +0000
commita187da0b35fdea10d5028edf35179d45c49278cb (patch)
treea8b871b6da566ed91ac0033ef5483ca25169d880 /i/marvin/src
parentfc17c7e3e927cbe6fad7b90c323c1851621c5d74 (diff)
Ajout de l'option -C pour changer une option sur la ligne de commande.
Diffstat (limited to 'i/marvin/src')
-rw-r--r--i/marvin/src/config/config_data.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/i/marvin/src/config/config_data.cc b/i/marvin/src/config/config_data.cc
index e531031..e4dcf75 100644
--- a/i/marvin/src/config/config_data.cc
+++ b/i/marvin/src/config/config_data.cc
@@ -95,6 +95,7 @@ void
ConfigData::init (int &argc, char **&argv, const std::string &file)
{
std::string configFile (file);
+ std::string configString;
// Parse la ligne de commande.
for (int i = 1; i < argc; )
{
@@ -113,6 +114,21 @@ ConfigData::init (int &argc, char **&argv, const std::string &file)
configFile = argv[i + 1];
}
}
+ // -C CONFIG_STRING
+ if (argv[i][0] == '-' && argv[i][1] == 'C')
+ {
+ configString += ';';
+ if (argv[i][2] != '\0')
+ {
+ del = 1;
+ configString += &argv[i][2];
+ }
+ else if (i + 1 < argc)
+ {
+ del = 2;
+ configString += argv[i + 1];
+ }
+ }
// Supprime ces arguments de la liste.
if (del)
{
@@ -126,5 +142,7 @@ ConfigData::init (int &argc, char **&argv, const std::string &file)
// Lit le fichier de config.
ConfigParser p (*this);
p.parseFile (configFile);
+ // Parse les chaînes supplémentaires.
+ p.parseString (configString);
}