aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-15 21:09:30 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-15 21:09:30 +0000
commite559e0a75738044403e9a43f54ccb0ac3091cd9a (patch)
tree9216b28c5e34aa5fed658d7893201947eec861b2 /include
parent0ed090e184739b6722a87acab644a8df24be09d4 (diff)
downloadbusybox-w32-e559e0a75738044403e9a43f54ccb0ac3091cd9a.tar.gz
busybox-w32-e559e0a75738044403e9a43f54ccb0ac3091cd9a.tar.bz2
busybox-w32-e559e0a75738044403e9a43f54ccb0ac3091cd9a.zip
libbb: unified config parser (By Vladimir Dronnikov)
mdev: use it function old new delta config_read - 400 +400 config_open - 43 +43 config_close - 9 +9 qrealloc 33 36 +3 compare_keys 735 737 +2 xstrtoull_range_sfx 296 295 -1 qgravechar 109 106 -3 get_address 181 178 -3 next_token 928 923 -5 sv_main 1228 1222 -6 find_main 418 406 -12 next_field 32 - -32 make_device 1269 1184 -85 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 2/7 up/down: 457/-147) Total: 310 bytes
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 2bd614c71..0db1658f4 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -987,6 +987,28 @@ int bb_ask_confirmation(void) FAST_FUNC;
987 987
988extern int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC; 988extern int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC;
989 989
990/*
991 * Uniform config file parser helpers
992 */
993#define PARSER_STDIO_BASED 1
994#if !PARSER_STDIO_BASED
995typedef struct parser_t {
996 char *data;
997 char *line;
998 int lineno;
999} parser_t;
1000extern char* config_open(parser_t *parser, const char *filename) FAST_FUNC;
1001#else
1002typedef struct parser_t {
1003 FILE *fp;
1004 char *line;
1005 int lineno;
1006} parser_t;
1007extern FILE* config_open(parser_t *parser, const char *filename) FAST_FUNC;
1008#endif
1009extern char* config_read(parser_t *parser, char **tokens, int ntokens, int mintokens, const char *delims, char comment) FAST_FUNC;
1010extern void config_close(parser_t *parser) FAST_FUNC;
1011
990/* Concatenate path and filename to new allocated buffer. 1012/* Concatenate path and filename to new allocated buffer.
991 * Add "/" only as needed (no duplicate "//" are produced). 1013 * Add "/" only as needed (no duplicate "//" are produced).
992 * If path is NULL, it is assumed to be "/". 1014 * If path is NULL, it is assumed to be "/".