henesyinit from p9fce6d0435 years agoHistory
88 lines · 2.0 KB · Text
RawDownload
.TH GETFIELDS 2.SH NAMEgetfields, getmfields, setfields, 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 **ptrs, int nptrs).PP.Bint	getmfields(char *str, char **ptrs, int nptrs).PP.Bchar*	setfields(char *fielddelim).PP.Bint	tokenize(char *str, char **args, int max).SH DESCRIPTION.I Getfieldsbreaks the null-terminated string.I strinto at most.I nptrsnull-terminated fields and places pointers to the start of these fields in the array.IR ptrs .It returns the number of fieldsand terminates the list of pointers with a zero pointer.It overwrites some of the bytes in.IR str .If there are.I nptror more fields, the list will not end with zeroand the last `field' will extend to the end of theinput string and may contain delimiters..PPA field is defined as a maximal sequence of characters not in a setof field delimiters.Adjacent fields are separated by exactly one delimiter.No field follows a delimiter at the end of string.Thus a string of just two delimiter characterscontains two empty fields,and a nonempty string with no delimiters containsone field..PP.I Getmfieldsis the same as.I getfieldsexcept that fields are separated by maximal strings offield delimiters rather than just one..PP.I Setfieldsmakes the field delimiters (space and tab by default)be the characters of the string.I fielddelimand returns a pointer to a string of the previous delimiters..PP.I Tokenizebreaks null-terminated string.B strinto tokens by replacing every blank or newline with a null byte.Pointers to successive non-empty tokens are placed in.BR args .Processing stops after.B maxtokens are processed..I Tokenizereturns the number of tokens processed..I Tokenizedoes.I notterminate.B argswith a null pointer..SS AlefOf these routines, only.I tokenizeis in Alef..SH SOURCE.B /sys/src/libc/port/getfields.c.br.B /sys/src/libc/port/tokenize.c.SH SEE ALSO.I strtokin.IR strcat (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