diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-10-28 04:51:46 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-10-28 04:51:46 +0000 |
commit | d0532eaf703396e838aa7dba77f58e296f503af5 (patch) | |
tree | c098d313db0e02d9c957565ce6336465c1d13f50 /src/main.c | |
parent | fa6f95685b8311be52e32aebc4ac86e8470b1fa3 (diff) | |
download | mpd-d0532eaf703396e838aa7dba77f58e296f503af5.tar.gz mpd-d0532eaf703396e838aa7dba77f58e296f503af5.tar.xz mpd-d0532eaf703396e838aa7dba77f58e296f503af5.zip |
new config file format stuff, quick test shows it works
git-svn-id: https://svn.musicpd.org/mpd/branches/shank-rewrite-config@2373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c index a73d778cf..f56d74939 100644 --- a/src/main.c +++ b/src/main.c @@ -165,9 +165,12 @@ void parseOptions(int argc, char ** argv, Options * options) { return; } else if(argcLeft<=2) { - char ** conf = NULL; - if(argcLeft==2) readConf(argv[argc-1]); - if(argcLeft==1) { + int conf = 0; + if(argcLeft==2) { + readConf(argv[argc-1]); + conf = 1; + } + else if(argcLeft==1) { FILE * fp; char * homedir = getenv("HOME"); char userfile[MAXPATHLEN+1] = ""; @@ -180,26 +183,26 @@ void parseOptions(int argc, char ** argv, Options * options) { if(strlen(userfile) && (fp=fopen(userfile,"r"))) { fclose(fp); readConf(userfile); + conf = 1; } else if((fp=fopen(SYSTEM_CONFIG_FILE_LOCATION,"r"))) { fclose(fp); readConf(SYSTEM_CONFIG_FILE_LOCATION); + conf = 1; } } if(conf) { - options->portStr = getConfigParamValue(CONF_PORT); + options->portStr = forceAndGetConfigParamValue( + CONF_PORT); options->musicDirArg = - getConfigParamValue(CONF_MUSIC_DIR); + parseConfigFilePath(CONF_MUSIC_DIR, 1); options->playlistDirArg = - getConfigParamValue(CONF_PLAYLIST_DIR); - options->logFile = getConfigParamValue(CONF_LOG_FILE); + parseConfigFilePath(CONF_PLAYLIST_DIR, 1); + options->logFile = parseConfigFilePath(CONF_LOG_FILE,1); options->errorFile = - getConfigParamValue(CONF_ERROR_FILE); - options->usr = getConfigParamValue(CONF_USER); - if(getConfigParamValue(CONF_DB_FILE)) { - options->dbFile = - getConfigParamValue(CONF_DB_FILE); - } + parseConfigFilePath(CONF_ERROR_FILE, 1); + options->usr = parseConfigFilePath(CONF_USER, 0); + options->dbFile = parseConfigFilePath(CONF_DB_FILE, 0); return; } } |