2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
8 /* returns pointer to static table of substring ptrs */
13 brkstring(strg
,brksep
,brkterm
)
15 char *brksep
, *brkterm
;
19 static char *broken
[NSTR
+1]; /* static array of substring start addresses */
22 sp
= strg
; /* scan string, replacing separators with zeroes */
24 for (bi
=0; bi
<NSTR
; bi
++) { /* and entering start addrs in "broken" */
25 while (brkany(c
= *sp
, brksep
)) *sp
++ = 0;
26 if (!c
|| brkany(c
, brkterm
)) {
29 return(broken
); /* terminator found, finish up */
32 broken
[bi
] = sp
; /* set next start addr */
34 while ((c
= *++sp
) && !brkany(c
,brksep
) && !brkany(c
,brkterm
));
37 broken
[NSTR
] = 0; /* reached limit of NSTR substrings */
41 brkany (chr
,strg
) /* returns 1 if chr in strg, 0 otherwise */
46 for (sp
=strg
; *sp
; sp
++)
47 if (chr
== *sp
) return (1);