lib,strutils: add default value to parse_range()

This function currently sets the low or high values to 0 when the string doesn't
contain a value, like '123:' or ':123'. In order to make it more flexible, we allow it
to be passed an arbitrary value.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
This commit is contained in:
Davidlohr Bueso 2011-10-14 16:32:15 -04:00 committed by Karel Zak
parent cf48ee22d1
commit af7df9ee67
3 changed files with 6 additions and 5 deletions

View file

@ -45,6 +45,6 @@ extern int string_to_idarray(const char *list, int ary[], size_t arysz,
extern int string_to_bitarray(const char *list, char *ary,
int (*name2bit)(const char *, size_t));
extern int parse_range(const char *str, int *lower, int *upper);
extern int parse_range(const char *str, int *lower, int *upper, int def);
#endif