33 lines · 1.1 KB · Text
RawDownload
= getfields, tokenize: break a string into fields     int   getfields(char *str, char **args, int maxargs, int multiflag, char *delims)     int   tokenize(char *str, char **args, int maxargs) Getfields breaks the null-terminated UTF string str  into  atmost  maxargs  null-terminated  fields and places pointers tothe start of these fields in the array  args.   Some  of  thebytes in str are overwritten.  If there are more than maxargsfields, only the first maxargs fields will be set.  Delims isa UTF string defining a set of delimiters. If  multiflag  is  zero,  adjacent  fields  are  separated byexactly one delimiter.  A string containing n delimiter char‐acters contains n+1 fields.  If the multiflag argument is notzero, a field is a non-empty string of non-delimiters. Getfields return the number of tokens processed. Tokenize is the same as getfields with multiflag non-zero anddelims "\t\r\n ", except that fields may be quoted using sin‐gle quotes, in the manner of the command interpreter. == source/libkern/getfields.c/libkern/tokenize.c/lib9/getfields.c/lib9/tokenize.c == see ALSOstrcat(10.2)