| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- '\" t
- .\" Title: ne_token
- .\" Author:
- .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
- .\" Date: 21 January 2023
- .\" Manual: neon API reference
- .\" Source: neon 0.32.5
- .\" Language: English
- .\"
- .TH "NE_TOKEN" "3" "21 January 2023" "neon 0.32.5" "neon API reference"
- .\" -----------------------------------------------------------------
- .\" * Define some portability stuff
- .\" -----------------------------------------------------------------
- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- .\" http://bugs.debian.org/507673
- .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- .ie \n(.g .ds Aq \(aq
- .el .ds Aq '
- .\" -----------------------------------------------------------------
- .\" * set default formatting
- .\" -----------------------------------------------------------------
- .\" disable hyphenation
- .nh
- .\" disable justification (adjust text to left margin only)
- .ad l
- .\" -----------------------------------------------------------------
- .\" * MAIN CONTENT STARTS HERE *
- .\" -----------------------------------------------------------------
- .SH "NAME"
- ne_token, ne_qtoken \- string tokenizers
- .SH "SYNOPSIS"
- .sp
- .ft B
- .nf
- #include <ne_string\&.h>
- .fi
- .ft
- .HP \w'char\ *ne_token('u
- .BI "char *ne_token(char\ **" "str" ", char\ " "sep" ");"
- .HP \w'char\ *ne_qtoken('u
- .BI "char *ne_qtoken(char\ **" "str" ", char\ " "sep" ", const\ char\ *" "quotes" ");"
- .SH "DESCRIPTION"
- .PP
- \fBne_token\fR
- and
- \fBne_qtoken\fR
- tokenize the string at the location stored in the pointer
- \fIstr\fR\&. Each time the function is called, it returns the next token, and modifies the
- \fIstr\fR
- pointer to point to the remainder of the string, or
- NULL
- if there are no more tokens in the string\&. A token is delimited by the separator character
- \fIsep\fR; if
- \fBne_qtoken\fR
- is used any quoted segments of the string are skipped when searching for a separator\&. A quoted segment is enclosed in a pair of one of the characters given in the
- \fIquotes\fR
- string\&.
- .PP
- The string being tokenized is modified each time the tokenizing function is called; replacing the next separator character with a
- NUL
- terminator\&.
- .SH "EXAMPLES"
- .PP
- The following function prints out each token in a comma\-separated string
- \fIlist\fR, which is modified in\-place:
- .sp
- .if n \{\
- .RS 4
- .\}
- .nf
- static void splitter(char *list)
- {
- do {
- printf("Token: %s\en", ne_token(&list, \*(Aq,\*(Aq));
- while (list);
- }
- .fi
- .if n \{\
- .RE
- .\}
- .SH "AUTHOR"
- .PP
- \fBJoe Orton\fR
- .RS 4
- Author.
- .RE
- .SH "COPYRIGHT"
- .br
|