aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-08-10 16:03:03 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-08-10 16:03:03 +0000
commitab0b6ce56f9c3a505619de49df94a370a9732d88 (patch)
tree3dcf01d4daee7a3a9dab34edca836f1fab58164e /src/conf.c
parentef810011383260403155450d87f9fd5e5184396a (diff)
downloadmpd-ab0b6ce56f9c3a505619de49df94a370a9732d88.tar.gz
mpd-ab0b6ce56f9c3a505619de49df94a370a9732d88.tar.xz
mpd-ab0b6ce56f9c3a505619de49df94a370a9732d88.zip
for improperly config file lines, print the line number
also, in myFgets, chop off '\r' at the end of the line (thanx mr gates) git-svn-id: https://svn.musicpd.org/mpd/trunk@2000 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/conf.c')
-rw-r--r--src/conf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/conf.c b/src/conf.c
index 1eadc36fe..473802200 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -160,6 +160,7 @@ char ** readConf(char * file) {
int i;
int numberOfArgs;
short allowCat[CONF_NUMBER_OF_PARAMS];
+ int count = 0;
for(i=0;i<CONF_NUMBER_OF_PARAMS;i++) allowCat[i] = 0;
@@ -171,19 +172,22 @@ char ** readConf(char * file) {
}
while(myFgets(string,sizeof(string),fp)) {
+ count++;
+
if(string[0]==CONF_COMMENT) continue;
numberOfArgs = buffer2array(string,&array);
if(numberOfArgs==0) continue;
if(2!=numberOfArgs) {
- ERROR("improperly formated config line: %s\n",string);
+ ERROR("improperly formated config file at line %i: %s\n",count,string);
exit(EXIT_FAILURE);
}
i = 0;
while(i<CONF_NUMBER_OF_PARAMS && 0!=strcmp(conf_strings[i],array[0])) i++;
if(i>=CONF_NUMBER_OF_PARAMS) {
- ERROR("unrecognized line in conf: %s\n",string);
+ ERROR("unrecognized paramater in conf at line %i: %s\n",count,string);
exit(EXIT_FAILURE);
}
+
if(conf_params[i]!=NULL) {
if(allowCat[i]) {
conf_params[i] = realloc(conf_params[i],