From ab0b6ce56f9c3a505619de49df94a370a9732d88 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Tue, 10 Aug 2004 16:03:03 +0000 Subject: 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 --- src/conf.c | 8 ++++++-- src/utils.c | 3 +++ 2 files changed, 9 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) { - 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], diff --git a/src/utils.c b/src/utils.c index fbcf3d9dd..a057fa33f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -32,6 +32,9 @@ char * myFgets(char * buffer, int bufferSize, FILE * fp) { if(ret && strlen(buffer)>0 && buffer[strlen(buffer)-1]=='\n') { buffer[strlen(buffer)-1] = '\0'; } + if(ret && strlen(buffer)>0 && buffer[strlen(buffer)-1]=='\r') { + buffer[strlen(buffer)-1] = '\0'; + } return ret; } -- cgit v1.2.3