aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-05 18:20:34 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-05 18:20:34 +0200
commit50db1f29bf96c2ae4dbb96763793a9592d99cf02 (patch)
tree9f99e1eab5aa1fb22d8656ab42a2d048bc7fcc2c /procps
parent20077c1429915b2c223e4d179a033f2b1806872c (diff)
downloadbusybox-50db1f29bf96c2ae4dbb96763793a9592d99cf02.tar.gz
sysctl: recognize ";comment" and "<whitespace>#comment" lines
function old new delta config_read 639 699 +60 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/sysctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index ef1a1b99f..a42a91247 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -247,15 +247,16 @@ static int sysctl_handle_preload_file(const char *filename)
/* Must do it _after_ config_open(): */
xchdir("/proc/sys");
-//TODO: ';' is comment char too
-//TODO: <space><tab><space>#comment is also comment, not strictly 1st char only
parse_flags = 0;
parse_flags &= ~PARSE_COLLAPSE; // NO (var==val is not var=val) - treat consecutive delimiters as one
parse_flags &= ~PARSE_TRIM; // NO - trim leading and trailing delimiters
parse_flags |= PARSE_GREEDY; // YES - last token takes entire remainder of the line
parse_flags &= ~PARSE_MIN_DIE; // NO - die if < min tokens found
parse_flags &= ~PARSE_EOL_COMMENTS; // NO (only first char) - comments are recognized even if not first char
- while (config_read(parser, token, 2, 2, "#=", parse_flags)) {
+ parse_flags |= PARSE_ALT_COMMENTS;// YES - two comment chars: ';' and '#'
+ /* <space><tab><space>#comment is also comment, not strictly 1st char only */
+ parse_flags |= PARSE_WS_COMMENTS; // YES - comments are recognized even if there is whitespace before
+ while (config_read(parser, token, 2, 2, ";#=", parse_flags)) {
char *tp;
trim(token[1]);