/*-------------------------------------------------------------------------*/ /** @file parse_tok.c @author N. Devillard @date Feb 2000 @version $Revision: 1.15 $ @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.c,v 1.15 2002/01/15 10:05:06 ndevilla Exp $ $Author: ndevilla $ $Date: 2002/01/15 10:05:06 $ $Revision: 1.15 $ */ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include "parse_tok.h" #ifdef _ECLIPSE_ #include "xmemory.h" #endif /*--------------------------------------------------------------------------- Function codes ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @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 ; i0) { for (i=0 ; i