summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-24 23:38:04 +0000
committerDenis Vlasenko2008-07-24 23:38:04 +0000
commit0f99d49ae680e675809428deace3c4fe839d323c (patch)
tree712afab828ee4fb02493bc60e1a37f1142231263 /libbb
parent22f741484391c3b2fd94881fd41c8c0df9749e95 (diff)
downloadbusybox-0f99d49ae680e675809428deace3c4fe839d323c.zip
busybox-0f99d49ae680e675809428deace3c4fe839d323c.tar.gz
*: conversion to config parser
function old new delta config_read 540 597 +57 config_open2 41 44 +3 rtnl_rtprot_initialize 70 66 -4 rtnl_rttable_initialize 78 73 -5 rtnl_rtscope_initialize 88 83 -5 rtnl_rtrealm_initialize 48 43 -5 rtnl_rtdsfield_initialize 48 43 -5 process_module 566 560 -6 bbunpack 391 383 -8 rtnl_tab_initialize 279 121 -158 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/8 up/down: 60/-196) Total: -136 bytes
Diffstat (limited to 'libbb')
-rw-r--r--libbb/parse_config.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libbb/parse_config.c b/libbb/parse_config.c
index d1b2921..83dc997 100644
--- a/libbb/parse_config.c
+++ b/libbb/parse_config.c
@@ -66,8 +66,7 @@ parser_t* FAST_FUNC config_open2(const char *filename, FILE* FAST_FUNC (*fopen_f
parser->fp = fopen_func(filename);
if (parser->fp)
return parser;
- if (ENABLE_FEATURE_CLEAN_UP)
- free(parser);
+ free(parser);
return NULL;
}
@@ -212,6 +211,19 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, unsigned flags, const
if ((flags & (PARSE_DONT_REDUCE|PARSE_DONT_TRIM)) || *line) {
//bb_info_msg("N[%d] T[%s]", ii, line);
tokens[ii++] = line;
+ // process escapes in token
+ if (flags & PARSE_ESCAPE) {
+ char *s = line;
+ while (*s) {
+ if (*s == '\\') {
+ s++;
+ *line++ = bb_process_escape_sequence((const char **)&s);
+ } else {
+ *line++ = *s++;
+ }
+ }
+ *line = '\0';
+ }
}
line = q;
//bb_info_msg("A[%s]", line);