From fa6f95685b8311be52e32aebc4ac86e8470b1fa3 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Thu, 28 Oct 2004 00:21:39 +0000 Subject: getting closer to being done with initial config file rewrite git-svn-id: https://svn.musicpd.org/mpd/branches/shank-rewrite-config@2372 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/main.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index ddde281a7..a73d778cf 100644 --- a/src/main.c +++ b/src/main.c @@ -166,7 +166,7 @@ void parseOptions(int argc, char ** argv, Options * options) { } else if(argcLeft<=2) { char ** conf = NULL; - if(argcLeft==2) conf = readConf(argv[argc-1]); + if(argcLeft==2) readConf(argv[argc-1]); if(argcLeft==1) { FILE * fp; char * homedir = getenv("HOME"); @@ -179,22 +179,26 @@ void parseOptions(int argc, char ** argv, Options * options) { } if(strlen(userfile) && (fp=fopen(userfile,"r"))) { fclose(fp); - conf = readConf(userfile); + readConf(userfile); } else if((fp=fopen(SYSTEM_CONFIG_FILE_LOCATION,"r"))) { fclose(fp); - conf = readConf(SYSTEM_CONFIG_FILE_LOCATION); + readConf(SYSTEM_CONFIG_FILE_LOCATION); } } if(conf) { - options->portStr = conf[CONF_PORT]; - options->musicDirArg = conf[CONF_MUSIC_DIRECTORY]; - options->playlistDirArg = conf[CONF_PLAYLIST_DIRECTORY]; - options->logFile = conf[CONF_LOG_FILE]; - options->errorFile = conf[CONF_ERROR_FILE]; - options->usr = conf[CONF_USER]; - if(conf[CONF_DB_FILE]) { - options->dbFile = conf[CONF_DB_FILE]; + options->portStr = getConfigParamValue(CONF_PORT); + options->musicDirArg = + getConfigParamValue(CONF_MUSIC_DIR); + options->playlistDirArg = + getConfigParamValue(CONF_PLAYLIST_DIR); + options->logFile = getConfigParamValue(CONF_LOG_FILE); + options->errorFile = + getConfigParamValue(CONF_ERROR_FILE); + options->usr = getConfigParamValue(CONF_USER); + if(getConfigParamValue(CONF_DB_FILE)) { + options->dbFile = + getConfigParamValue(CONF_DB_FILE); } return; } -- cgit v1.2.3