diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/applets.h | 1 | ||||
-rw-r--r-- | include/libbb.h | 14 | ||||
-rw-r--r-- | include/usage.h | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/include/applets.h b/include/applets.h index aff9070bb..5dd485ab4 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -268,6 +268,7 @@ USE_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | |||
268 | USE_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 268 | USE_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
269 | USE_OD(APPLET(od, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 269 | USE_OD(APPLET(od, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
270 | USE_OPENVT(APPLET(openvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 270 | USE_OPENVT(APPLET(openvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
271 | USE_PARSE(APPLET(parse, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | ||
271 | USE_PASSWD(APPLET(passwd, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) | 272 | USE_PASSWD(APPLET(passwd, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) |
272 | USE_PATCH(APPLET(patch, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 273 | USE_PATCH(APPLET(patch, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
273 | USE_PGREP(APPLET(pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 274 | USE_PGREP(APPLET(pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
diff --git a/include/libbb.h b/include/libbb.h index 14af1368c..af6c1385d 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -988,16 +988,22 @@ int bb_ask_confirmation(void) FAST_FUNC; | |||
988 | 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 | * Config file parser |
992 | */ | 992 | */ |
993 | #define PARSE_DONT_REDUCE 0x00010000 // do not treat consecutive delimiters as one | ||
994 | #define PARSE_DONT_TRIM 0x00020000 // do not trim line of leading and trailing delimiters | ||
995 | #define PARSE_LAST_IS_GREEDY 0x00040000 // last token takes whole remainder of the line | ||
996 | //#define PARSE_DONT_NULL 0x00080000 // do not set tokens[] to NULL | ||
993 | typedef struct parser_t { | 997 | typedef struct parser_t { |
994 | FILE *fp; | 998 | FILE *fp; |
995 | char *line, *data; | 999 | char *line; |
1000 | USE_FEATURE_PARSE_COPY(char *data;) | ||
996 | int lineno; | 1001 | int lineno; |
997 | } parser_t; | 1002 | } parser_t; |
998 | parser_t* config_open(const char *filename) FAST_FUNC; | 1003 | parser_t* config_open(const char *filename) FAST_FUNC; |
999 | /* TODO: add define magic to collapse ntokens/mintokens/comment into one int param */ | 1004 | int config_read(parser_t *parser, char **tokens, unsigned flags, const char *delims) FAST_FUNC; |
1000 | int config_read(parser_t *parser, char **tokens, int ntokens, int mintokens, const char *delims, char comment) FAST_FUNC; | 1005 | #define config_read(parser, tokens, max, min, str, flags) \ |
1006 | config_read(parser, tokens, ((flags) | (((min) & 0xFF) << 8) | ((max) & 0xFF)), str) | ||
1001 | void config_close(parser_t *parser) FAST_FUNC; | 1007 | void config_close(parser_t *parser) FAST_FUNC; |
1002 | 1008 | ||
1003 | /* Concatenate path and filename to new allocated buffer. | 1009 | /* Concatenate path and filename to new allocated buffer. |
diff --git a/include/usage.h b/include/usage.h index f9a993a21..61c5c8ee3 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -2903,6 +2903,11 @@ | |||
2903 | #define openvt_example_usage \ | 2903 | #define openvt_example_usage \ |
2904 | "openvt 2 /bin/ash\n" | 2904 | "openvt 2 /bin/ash\n" |
2905 | 2905 | ||
2906 | #define parse_trivial_usage \ | ||
2907 | "[-n maxtokens] [-m mintokens] [-d delims] [-f flags] file ..." | ||
2908 | #define parse_full_usage "\n\n" \ | ||
2909 | "[-n maxtokens] [-m mintokens] [-d delims] [-f flags] file ..." | ||
2910 | |||
2906 | #define passwd_trivial_usage \ | 2911 | #define passwd_trivial_usage \ |
2907 | "[OPTION] [name]" | 2912 | "[OPTION] [name]" |
2908 | #define passwd_full_usage "\n\n" \ | 2913 | #define passwd_full_usage "\n\n" \ |