NAME
Tcl_SplitList - break a Tcl list up into fields

SYNOPSIS
#include <tcl.h>

int
Tcl_SplitList(interp, list, argcPtr, argvPtr)

ARGUMENTS
Interpreter to use for error reporting. Pointer to a string with proper list structure. Filled in with number of elements in list. *argvPtr will be filled in with the address of an array of pointers to the strings that are the extracted elements of list. There will be *argcPtr valid entries in the array.

DESCRIPTION

Tcl_SplitList is the inverse of Tcl_Merge. Given a list, it extracts all of the elements of the list and returns an array of pointers to them using argcPtr and argvPtr. While extracting the arguments, Tcl_SplitList obeys the usual rules for backslash substitutions and braces. The area of memory pointed to by *argvPtr is dynamically allocated; in addition to the array of pointers, it also holds copies of all the list elements. It is the caller's responsibility to free up all of this storage by calling free((char *) *argvPtr) when the list elements are no longer needed.

Tcl_SplitList normally returns TCL_OK, which means the list was successfully parsed. If there was a syntax error in list, then TCL_ERROR is returned and interp->result will point to an error message describing the problem.

KEYWORDS
list, split, strings