rminnichadd manualse67599c16 years agoHistory
99 lines · 1.7 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 Getfieldsplaces into the array.I argspointers to the first.I maxargsfields of the null terminated.SM UTFstring.IR str .Delimiters between these fields are set to null..PPFields are substrings of.I strwhose definition depends on the value of.IR multiflag.If.I multiflagis zero,adjacent fields are separated by exactly one delimiter.For example.EX 	getfields("#alice#bob##charles###", arg, 3, 0, "#"); .EEyields three substrings:null-string ,.BR "alice" ,and.BR "bob##charles###" .If the.I multiflagargument is not zero,a field is a non-empty string of non-delimiters.For example.EX 	getfields("#alice#bob##charles###", arg, 3, 1, "#"); .EEyields the three substrings:.BR "alice" ,.BR "bob" ,and.BR "charles###" ..PPGetfields returns the number of fields pointed to..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).Any such quotes remain in the resulting.IR args .See.IR quote (2)for related quote-handling software..PP.I Tokenizeis similar to.I gettokenswith .I delimsset to \f5"\et\er\en\ "\fP,except that quotes are interpreted but do not appear in the resulting.IR args ..SH SOURCE.B /sys/src/libc/port/tokenize.c.SH SEE ALSO.I strtokin.IR strcat (2),.IR quote (2).

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t