Retain comments in descriptions and config values
Comments should only be stripped if they start at the beginning of a line. We do not want to chop off an TODO item description or a configuration value. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
f3fe3c818c
commit
0a2c4d20fe
@ -470,7 +470,7 @@ config_file_walk(config_fn_walk_cb_t fn_cb,
|
|||||||
break;
|
break;
|
||||||
io_extract_data(e_conf, buf, sizeof buf);
|
io_extract_data(e_conf, buf, sizeof buf);
|
||||||
|
|
||||||
if (*e_conf == '\0') {
|
if (*e_conf == '\0' || *e_conf == '#') {
|
||||||
if (fn_junk_cb)
|
if (fn_junk_cb)
|
||||||
fn_junk_cb(buf, data);
|
fn_junk_cb(buf, data);
|
||||||
continue;
|
continue;
|
||||||
@ -517,6 +517,8 @@ config_file_walk(config_fn_walk_cb_t fn_cb,
|
|||||||
if (fgets(buf, sizeof buf, data_file) == NULL)
|
if (fgets(buf, sizeof buf, data_file) == NULL)
|
||||||
break;
|
break;
|
||||||
io_extract_data(e_conf, buf, sizeof buf);
|
io_extract_data(e_conf, buf, sizeof buf);
|
||||||
|
if (*e_conf == '#')
|
||||||
|
*e_conf = '\0';
|
||||||
value = e_conf;
|
value = e_conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
src/io.c
2
src/io.c
@ -274,7 +274,7 @@ void io_extract_data(char *dst_data, const char *org, int len)
|
|||||||
|
|
||||||
for (; *org == ' ' || *org == '\t'; org++) ;
|
for (; *org == ' ' || *org == '\t'; org++) ;
|
||||||
for (i = 0; i < len - 1; i++) {
|
for (i = 0; i < len - 1; i++) {
|
||||||
if (*org == '\n' || *org == '\0' || *org == '#')
|
if (*org == '\n' || *org == '\0')
|
||||||
break;
|
break;
|
||||||
*dst_data++ = *org++;
|
*dst_data++ = *org++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user