1 /* brkstring.c - break string into an array of strings */
6 static char *broken[MAXARGS+1]; /* array of substring start addresses */
9 char **brkstring (strg, brksep, brkterm)
11 register char *brksep,
18 sp = strg; /* scan string, replacing separators with
21 for (bi = 0; bi < MAXARGS; bi++) {
22 /* and entering start addrs in "broken" */
23 while (brkany (c = *sp, brksep))
25 if (!c || brkany (c, brkterm)) {
28 return broken; /* terminator found, finish up */
31 broken[bi] = sp; /* set next start addr */
32 while ((c = *++sp) && !brkany (c, brksep) && !brkany (c, brkterm))
35 broken[MAXARGS] = 0; /* reached limit of MAXARGS substrings */
41 static brkany (chr, strg) /* returns 1 if chr in strg, 0 otherwise */
48 for (sp = strg; *sp; sp++)