Provide a string option parser function.
parent
314871e92d
commit
2de4210311
10
src/option.c
10
src/option.c
|
@ -351,6 +351,16 @@ static void option_parse_token(char ** argv, int * flag_parsed_next, int * requi
|
|||
}
|
||||
}
|
||||
|
||||
int option_parse_str(char*val, options_all_t * opt_all){
|
||||
int flag_parsed_next;
|
||||
int error = 0;
|
||||
int requiredArgsSeen = 0;
|
||||
int print_help = 0;
|
||||
char * argv[2] = {val, NULL};
|
||||
option_parse_token(argv, & flag_parsed_next, & requiredArgsSeen, opt_all, & error, & print_help);
|
||||
return error;
|
||||
}
|
||||
|
||||
int option_parse_key_value(char * key, char *val, options_all_t * opt_all){
|
||||
int flag_parsed_next;
|
||||
int error = 0;
|
||||
|
|
|
@ -38,9 +38,9 @@ typedef struct{
|
|||
|
||||
int64_t string_to_bytes(char *size_str);
|
||||
void option_print_current(option_help * args);
|
||||
|
||||
//@return the number of parsed arguments
|
||||
int option_parse(int argc, char ** argv, options_all_t * args);
|
||||
int option_parse_str(char*val, options_all_t * opt_all);
|
||||
|
||||
/* Parse a single line */
|
||||
int option_parse_key_value(char * key, char * value, options_all_t * opt_all);
|
||||
|
|
Loading…
Reference in New Issue