util: add function to split string into words

This commit is contained in:
Miroslav Lichvar
2020-04-09 09:59:39 +02:00
parent d3f4292968
commit d603426389
3 changed files with 69 additions and 1 deletions

5
util.h
View File

@@ -220,6 +220,11 @@ extern int UTI_BytesToHex(const void *buf, unsigned int buf_len, char *hex, unsi
is supported. */
extern unsigned int UTI_HexToBytes(const char *hex, void *buf, unsigned int len);
/* Split a string into words separated by whitespace characters. It returns
the number of words found in the string, but saves only up to the specified
number of pointers to the words. */
extern int UTI_SplitString(char *string, char **words, int max_saved_words);
/* Macros to get maximum and minimum of two values */
#ifdef MAX
#undef MAX