Backslashes are no longer removed from the config completely but can now be escaped with \\
This commit is contained in:
parent
cac4574534
commit
fadbfd4c13
11
src/config.c
11
src/config.c
@ -25,17 +25,12 @@ void config_put(struct map* map, char* line) {
|
|||||||
*hash = 0;
|
*hash = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char* backslash = strchr(line, '\\');
|
|
||||||
size_t backslash_count = 0;
|
|
||||||
while(backslash != NULL) {
|
|
||||||
++backslash_count;
|
|
||||||
backslash = strchr(backslash + 1, '\\');
|
|
||||||
}
|
|
||||||
size_t line_size = strlen(line);
|
size_t line_size = strlen(line);
|
||||||
char* new_line = calloc(1, line_size + 1 - backslash_count);
|
char* new_line = calloc(1, line_size + 1);
|
||||||
size_t new_line_count = 0;
|
size_t new_line_count = 0;
|
||||||
for(size_t count = 0; count < line_size; ++count) {
|
for(size_t count = 0; count < line_size; ++count) {
|
||||||
if(line[count] == '\\') {
|
if(line[count] == '\\' && line[count + 1] != '\\') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
new_line[new_line_count++] = line[count];
|
new_line[new_line_count++] = line[count];
|
||||||
|
Loading…
Reference in New Issue
Block a user