aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-11-17 10:08:39 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-11-17 10:08:39 +0000
commit7f77a061dd9b40637e44cef6332c4855c2336e55 (patch)
treed4bc1e4d71520e8b2eebaca5bc31931865713533
parent2d16e1a7777e4ecddbb2c8943dee381adc6a5397 (diff)
allows \r \n \t \v in config file parameters within quotes
-rw-r--r--src/main.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 5c257ecc8..2d1de3df1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -88,6 +88,8 @@
#include "../lib/memdebug.h"
#endif
+#define DEBUG_CONFIG
+
#ifndef __cplusplus /* (rabe) */
typedef char bool;
#endif /* (rabe) */
@@ -1046,12 +1048,31 @@ static int parseconfig(char *filename,
ptr=param;
while(*line && (*line != '\"')) {
if(*line == '\\') {
+ char out;
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;
}
+ *ptr++=out;
+ line++;
}
- *ptr++=*line++;
+ else
+ *ptr++=*line++;
}
*ptr=0; /* always zero terminate */