diff options
Diffstat (limited to 'src/sms_config.c')
-rw-r--r-- | src/sms_config.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/sms_config.c b/src/sms_config.c index 0fa4173..9386ff7 100644 --- a/src/sms_config.c +++ b/src/sms_config.c @@ -267,24 +267,23 @@ static int config_handle_event(struct config_info *config) } } -#define SMS_CONFIG_FILE ".smsconfig" -static int _sms_config_load(void) +static int _sms_config_load(const char *filename) { int err; struct config_info config; struct stat sbuf; - err = stat(SMS_CONFIG_FILE, &sbuf); + err = stat(filename, &sbuf); if (err < 0) { if (errno == ENOENT) { - log_notice("sms config file missing"); + log_debug("sms config file missing"); return 0; } return -1; } - err = config_open(&config, SMS_CONFIG_FILE); + err = config_open(&config, filename); if (err < 0) { log_error("open config failed"); return -1; @@ -328,12 +327,20 @@ static int _sms_config_load(void) return 0; } +#define SMS_CONFIG_FILE ".smsconfig" + int sms_config_load(void) { int err; char *cp; char prev[PATH_MAX]; char *home; + char *config; + + config = getenv("SMS_CONFIG"); + if (config) { + return _sms_config_load(config); + } home = getenv("HOME"); if (!home) { @@ -349,7 +356,7 @@ int sms_config_load(void) chdir(home); - err = _sms_config_load(); + err = _sms_config_load(SMS_CONFIG_FILE); chdir(prev); |