henesyinit from p9fd787fda5 years agoHistory
88 lines · 1.4 KB · Text
RawDownload
.TH GETFIELDS 2.SH NAMEgetfields, gettokens, tokenize \- break a string into fields.SH SYNOPSIS.B #include <u.h>.br.B #include <libc.h>.PP.ta \w'\fLchar* \fP'u.Bint	getfields(char *str, char **args, int maxargs, int multiflag,.br.B	    char *delims).PP.Bint	gettokens(char *str, char **args, int maxargs, char *delims).PP.Bint	tokenize(char *str, char **args, int maxargs).SH DESCRIPTION.I Getfieldsbreaks the null-terminated.SM UTFstring.I strinto at most.I maxargsnull-terminated fields and places pointers to the start of these fields in the array.IR args .Some of the bytes in.I strare overwritten.If there are more than.I maxargsfields,only the first.I maxargsfields will be set..I Delimsis a.SM UTFstring defining a set of delimiters..PPIf.I multiflagis zero,adjacent fields are separated by exactly one delimiter.A string containing.I ndelimiter characterscontains.IR n +1fields.If the.I multiflagargument is not zero,a field is a non-empty string of non-delimiters..PPGetfieldsreturns the number of tokens processed..PP.I Gettokensis the same as.I getfieldswith.I multiflagnon-zero,except that fields may be quoted using single quotes, in the mannerof.IR rc (1).See.IR quote (2)for related quote-handling software..PP.I Tokenizeis.I gettokenswith .I delimsset to \f5"\et\er\en "\fP..SH SOURCE.B /sys/src/libc/port/tokenize.c.SH SEE ALSO.I strtokin.IR strcat (2),.IR quote (2).