17 #include <grass/gis.h>
19 static char **tokenize(
const char *,
const char *,
const char *);
49 return tokenize(buf, delim,
NULL);
83 char **
G_tokenize2(
const char *buf,
const char *delim,
const char *valchar)
85 return tokenize(buf, delim, valchar);
88 char **tokenize(
const char *buf,
const char *delim,
const char *inchar)
98 tokens = (
char **)G_malloc(2 *
sizeof(
char *));
105 while (!strchr(delim, *p)) {
107 if (inchar && *p == *inchar) {
110 while (*p != *inchar && *p != 0)
123 tokens = (
char **)G_realloc((
char *)tokens, (i + 1) *
sizeof(
char *));
143 for (n = 0; tokens[n] !=
NULL; n++)
159 if (tokens[0] !=
NULL)
char * G_store(const char *s)
Copy string to allocated memory.
int G_number_of_tokens(char **tokens)
Return number of tokens.
void G_free_tokens(char **tokens)
Free memory allocated to tokens.
char ** G_tokenize2(const char *buf, const char *delim, const char *valchar)
Tokenize string.
char ** G_tokenize(const char *buf, const char *delim)
Tokenize string.
void G_free(void *buf)
Free allocated memory.