allows \r \n \t \v in config file parameters within quotes
This commit is contained in:
parent
2d16e1a777
commit
7f77a061dd
25
src/main.c
25
src/main.c
@ -88,6 +88,8 @@
|
|||||||
#include "../lib/memdebug.h"
|
#include "../lib/memdebug.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEBUG_CONFIG
|
||||||
|
|
||||||
#ifndef __cplusplus /* (rabe) */
|
#ifndef __cplusplus /* (rabe) */
|
||||||
typedef char bool;
|
typedef char bool;
|
||||||
#endif /* (rabe) */
|
#endif /* (rabe) */
|
||||||
@ -1046,12 +1048,31 @@ static int parseconfig(char *filename,
|
|||||||
ptr=param;
|
ptr=param;
|
||||||
while(*line && (*line != '\"')) {
|
while(*line && (*line != '\"')) {
|
||||||
if(*line == '\\') {
|
if(*line == '\\') {
|
||||||
|
char out;
|
||||||
line++;
|
line++;
|
||||||
if(!*line) {
|
|
||||||
|
/* default is to output the letter after the backslah */
|
||||||
|
switch(out = *line) {
|
||||||
|
case '\0':
|
||||||
|
continue; /* this'll break out of the loop */
|
||||||
|
case 't':
|
||||||
|
out='\t';
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
out='\n';
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
out='\r';
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
out='\v';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*ptr++=out;
|
||||||
|
line++;
|
||||||
}
|
}
|
||||||
*ptr++=*line++;
|
else
|
||||||
|
*ptr++=*line++;
|
||||||
}
|
}
|
||||||
*ptr=0; /* always zero terminate */
|
*ptr=0; /* always zero terminate */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user