- added search path "/etc/siproxd/siproxd.conf" to default

search path for config files (SuSE)
This commit is contained in:
Thomas Ries
2011-05-29 12:06:30 +00:00
parent 85909febf7
commit 0170ab5705
2 changed files with 14 additions and 7 deletions

View File

@@ -64,11 +64,12 @@ int read_config(char *name, int search, cfgopts_t cfgopts[], char *filter) {
int i;
char tmp[256];
const char *completion[] = {
"%s/.%src", /* this one is special... (idx=0)*/
SIPROXDCONFPATH "/%s.conf",
"/etc/%s.conf",
"/usr/etc/%s.conf",
"/usr/local/etc/%s.conf",
"%s/.%src", /* 0: this one is special... */
SIPROXDCONFPATH "/%s.conf", /* 1 */
"/etc/%s.conf", /* 2 */
"/etc/%s/%s.conf", /* 3: this one, too */
"/usr/etc/%s.conf", /* 5 */
"/usr/local/etc/%s.conf", /* 6 */
NULL };
@@ -83,12 +84,16 @@ int read_config(char *name, int search, cfgopts_t cfgopts[], char *filter) {
for (i=0; completion[i]!=NULL; i++) {
switch (i) {
case 0:
sprintf(tmp,completion[i],getenv("HOME"),name);
snprintf(tmp,sizeof(tmp),completion[i],getenv("HOME"),name);
break;
case 3:
snprintf(tmp,sizeof(tmp),completion[i],name,name);
break;
default:
sprintf(tmp,completion[i],name);
snprintf(tmp,sizeof(tmp),completion[i],name);
break;
}
tmp[sizeof(tmp)-1]='\0';
DEBUGC(DBCLASS_CONFIG,"... trying %s",tmp);
configfile = fopen(tmp,"r");
if (configfile==NULL) continue;