#include <libc.h>
int getfields(char *str, char **args, int maxargs, int multiflag,
char *delims)
int gettokens(char *str, char **args, int maxargs, char *delims)
int tokenize(char *str, char **args, int maxargs)
Fields are substrings of str whose definition depends on the value of multiflag. If multiflag is zero, adjacent fields are separated by exactly one delimiter. For example .EX getfields("#alice#bob##charles###", arg, 3, 0, "#"); yields three substrings: null-string , "alice" , and "bob##charles###" . If the multiflag argument is not zero, a field is a non-empty string of non-delimiters. For example .EX getfields("#alice#bob##charles###", arg, 3, 1, "#"); yields the three substrings: "alice" , "bob" , and "charles###" .
Getfields returns the number of fields pointed to.
Gettokens is the same as getfields with multiflag non-zero, except that fields may be quoted using single quotes, in the manner of rc (1). See quote (2) for related quote-handling software.
Tokenize is gettokens with delims set to \f5"\et\er\en ".