diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-05 13:45:22 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-05 13:45:22 +0200 |
commit | 9cf89cdf84fb20154088145980b676d2b28fc55d (patch) | |
tree | 436a0d02edc588782ca00796e14469288c3baa8d /libbb | |
parent | feb79e8742eb3cef211804dadcc7f3ddfd154c72 (diff) | |
download | busybox-w32-9cf89cdf84fb20154088145980b676d2b28fc55d.tar.gz busybox-w32-9cf89cdf84fb20154088145980b676d2b28fc55d.tar.bz2 busybox-w32-9cf89cdf84fb20154088145980b676d2b28fc55d.zip |
sysctl: fix file parsing, do not require -w for VAR=VAL
function old new delta
sysctl_act_on_setting - 451 +451
sysctl_main 222 282 +60
packed_usage 31744 31793 +49
config_read 604 639 +35
sysctl_act_recursive 612 163 -449
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 595/-449) Total: 146 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/parse_config.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libbb/parse_config.c b/libbb/parse_config.c index 307ae2cd2..da7482c6d 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c | |||
@@ -201,10 +201,10 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const | |||
201 | /* Combine remaining arguments? */ | 201 | /* Combine remaining arguments? */ |
202 | if ((t != (ntokens-1)) || !(flags & PARSE_GREEDY)) { | 202 | if ((t != (ntokens-1)) || !(flags & PARSE_GREEDY)) { |
203 | /* Vanilla token, find next delimiter */ | 203 | /* Vanilla token, find next delimiter */ |
204 | line += strcspn(line, delims[0] ? delims : delims + 1); | 204 | line += strcspn(line, (delims[0] && (flags & PARSE_EOL_COMMENTS)) ? delims : delims + 1); |
205 | } else { | 205 | } else { |
206 | /* Combining, find comment char if any */ | 206 | /* Combining, find comment char if any */ |
207 | line = strchrnul(line, PARSE_EOL_COMMENTS ? delims[0] : '\0'); | 207 | line = strchrnul(line, (flags & PARSE_EOL_COMMENTS) ? delims[0] : '\0'); |
208 | 208 | ||
209 | /* Trim any extra delimiters from the end */ | 209 | /* Trim any extra delimiters from the end */ |
210 | if (flags & PARSE_TRIM) { | 210 | if (flags & PARSE_TRIM) { |
@@ -214,10 +214,10 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const | |||
214 | } | 214 | } |
215 | 215 | ||
216 | /* Token not terminated? */ | 216 | /* Token not terminated? */ |
217 | if (*line == delims[0]) | 217 | if ((flags & PARSE_EOL_COMMENTS) && *line == delims[0]) |
218 | *line = '\0'; | 218 | *line = '\0'; /* ends with comment char: this line is done */ |
219 | else if (*line != '\0') | 219 | else if (*line != '\0') |
220 | *line++ = '\0'; | 220 | *line++ = '\0'; /* token is done, continue parsing line */ |
221 | 221 | ||
222 | #if 0 /* unused so far */ | 222 | #if 0 /* unused so far */ |
223 | if (flags & PARSE_ESCAPE) { | 223 | if (flags & PARSE_ESCAPE) { |