From 0f99d49ae680e675809428deace3c4fe839d323c Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 24 Jul 2008 23:38:04 +0000 Subject: *: 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 --- libbb/parse_config.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libbb/parse_config.c') diff --git a/libbb/parse_config.c b/libbb/parse_config.c index d1b29218b..83dc997f6 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); -- cgit v1.2.3