diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-16 22:12:18 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-16 22:12:18 +0000 |
| commit | c01340fe26b76e172805ff641ad9af6bc45cdc91 (patch) | |
| tree | 1b3b57ef2fd7441bb91410b89f763056279baddf /include | |
| parent | 38e54f1c1384e76adafb4e611a6bd456e4351d42 (diff) | |
| download | busybox-w32-c01340fe26b76e172805ff641ad9af6bc45cdc91.tar.gz busybox-w32-c01340fe26b76e172805ff641ad9af6bc45cdc91.tar.bz2 busybox-w32-c01340fe26b76e172805ff641ad9af6bc45cdc91.zip | |
update of config file parser from Vladimir
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/include/libbb.h b/include/libbb.h index 3a7c2eee9..c124b1a5e 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -985,30 +985,20 @@ extern int set_loop(char **devname, const char *file, unsigned long long offset) | |||
| 985 | char *bb_askpass(int timeout, const char * prompt) FAST_FUNC; | 985 | char *bb_askpass(int timeout, const char * prompt) FAST_FUNC; |
| 986 | int bb_ask_confirmation(void) FAST_FUNC; | 986 | int bb_ask_confirmation(void) FAST_FUNC; |
| 987 | 987 | ||
| 988 | extern int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC; | 988 | int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC; |
| 989 | 989 | ||
| 990 | /* | 990 | /* |
| 991 | * Uniform config file parser helpers | 991 | * Uniform config file parser helpers |
| 992 | */ | 992 | */ |
| 993 | #define PARSER_STDIO_BASED 1 | ||
| 994 | #if !PARSER_STDIO_BASED | ||
| 995 | typedef struct parser_t { | ||
| 996 | char *data; | ||
| 997 | char *line; | ||
| 998 | int lineno; | ||
| 999 | } parser_t; | ||
| 1000 | extern char* config_open(parser_t *parser, const char *filename) FAST_FUNC; | ||
| 1001 | #else | ||
| 1002 | typedef struct parser_t { | 993 | typedef struct parser_t { |
| 1003 | FILE *fp; | 994 | FILE *fp; |
| 1004 | char *line; | 995 | char *line, *data; |
| 1005 | int lineno; | 996 | int lineno; |
| 1006 | } parser_t; | 997 | } parser_t; |
| 1007 | extern FILE* config_open(parser_t *parser, const char *filename) FAST_FUNC; | 998 | FILE* config_open(parser_t *parser, const char *filename) FAST_FUNC; |
| 1008 | #endif | ||
| 1009 | /* TODO: add define magic to collapse ntokens/mintokens/comment into one int param */ | 999 | /* TODO: add define magic to collapse ntokens/mintokens/comment into one int param */ |
| 1010 | extern char* config_read(parser_t *parser, char **tokens, int ntokens, int mintokens, const char *delims, char comment) FAST_FUNC; | 1000 | int config_read(parser_t *parser, char **tokens, int ntokens, int mintokens, const char *delims, char comment) FAST_FUNC; |
| 1011 | extern void config_close(parser_t *parser) FAST_FUNC; | 1001 | void config_close(parser_t *parser) FAST_FUNC; |
| 1012 | 1002 | ||
| 1013 | /* Concatenate path and filename to new allocated buffer. | 1003 | /* Concatenate path and filename to new allocated buffer. |
| 1014 | * Add "/" only as needed (no duplicate "//" are produced). | 1004 | * Add "/" only as needed (no duplicate "//" are produced). |
