/*-------------------------------------------------------------------------*/ /** @file parse_tok.h @author N. Devillard @date Feb 2000 @version $Revision: 1.9 $ @brief Cut a character string into its components (tokens). This module offers two helper functions to tokenize a string into sub-components in one function call. It is only meant to be a nicer interface than strtok (which it calls anyway). */ /*--------------------------------------------------------------------------*/ /* $Id: parse_tok.h,v 1.9 2001/10/19 10:49:09 ndevilla Exp $ $Author: ndevilla $ $Date: 2001/10/19 10:49:09 $ $Revision: 1.9 $ */ #ifndef _PARSE_TOK_H_ #define _PARSE_TOK_H_ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include #include /*--------------------------------------------------------------------------- Defines ---------------------------------------------------------------------------*/ /** Default field separator list */ #define FS_BLANKS " \t\n" /*--------------------------------------------------------------------------- Function ANSI C prototypes ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @brief Tokenize a line into smaller strings. @param line Line to tokenize. @param fs List of field separators. @param ntok (returned) number of found tokens. @return Newly allocated list of tokens (argv-like format). This function takes in input a line of ASCII characters and a list of field separators. It cuts the input line into smaller strings (tokens). Example: @code char ** ltok ; int ntok ; int i ; strcpy(line, "\tThis is a line to \t tokenize\n"); ltok = tokenize_line(line, FS_BLANKS, &ntok); for (i=0 ; i