1
0
Fork 0

Support for using environment strings to change config

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@790
This commit is contained in:
Sjoerd van der Berg 2003-03-24 11:28:26 +00:00
parent 4922e42ab1
commit aea4169ddb

View file

@ -111,7 +111,7 @@ const char* Section_prop::Get_string(const char* _propname){
return ((*tel)->GetValue())._string->c_str();
}
}
return NULL;
return "";
}
int Section_prop::Get_hex(const char* _propname){
for(it tel=properties.begin();tel!=properties.end();tel++){
@ -254,6 +254,22 @@ void Config::ParseConfigFile(const char* configfilename){
}
}
void Config::ParseEnv(char ** envp) {
for(char** env=envp; *env;env++) {
char copy[1024];
strncpy(copy,*env,1024);
if(strncasecmp(copy,"DOSBOX_",7))
continue;
char* sec_name = &copy[7];
char* prop_name = strrchr(sec_name,'_');
*prop_name++=0;
Section* sect = GetSection(sec_name);
if(!sect)
continue;
sect->HandleInputline(prop_name);
}
}
void Config::SetStartUp(void (*_function)(void)) {
_start_function=_function;
}