diff --git a/lib/conf-lex.l b/lib/conf-lex.l index 6668e724..f1770628 100644 --- a/lib/conf-lex.l +++ b/lib/conf-lex.l @@ -262,19 +262,37 @@ ignore{BLANK}* { { - /* Oops, newline while in a string is not good */ + /* Oops, newline or EOF while in a string is not good */ \n | \\\n { buffer_add_char("\0"); - strcpy(sensors_lex_error,"No matching double quote"); + strcpy(sensors_lex_error, + "No matching double quote."); buffer_free(); - BEGIN(INITIAL); + yyless(0); + BEGIN(ERR); + return ERROR; + } + +<> { + strcpy(sensors_lex_error, + "Reached end-of-file without a matching double quote."); + BEGIN(MIDDLE); return ERROR; } /* At the end */ +\"\" { + buffer_add_char("\0"); + strcpy(sensors_lex_error, + "Quoted strings must be separated by whitespace."); + buffer_free(); + BEGIN(ERR); + return ERROR; + } + \" { buffer_add_char("\0"); sensors_yylval.name = strdup(buffer); diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index 6de5905b..be2c7a7f 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -34,7 +34,7 @@ translate the raw readings from the kernel modules to real\-world values. .SH SYNTAX Comments are introduces by hash marks. A comment continues to the end of the line. Empty lines, and lines containing only whitespace or comments are -ignored. Other lines have one of the below forms. There should be whitespace +ignored. Other lines have one of the below forms. There must be whitespace between each element, but the amount of whitespace is unimportant. A line may be continued on the next line by ending it with a backslash; this does not work within a comment,