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:
parent
4922e42ab1
commit
aea4169ddb
1 changed files with 17 additions and 1 deletions
|
@ -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 = ©[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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue