head 1.4; branch ; access ; symbols ; locks ; strict; comment @ * @; 1.4 date 90.04.05.15.31.43; author sources; state Exp; branches ; next 1.3; 1.3 date 90.04.05.14.48.52; author sources; state Exp; branches ; next 1.2; 1.2 date 90.02.06.12.59.16; author sources; state Exp; branches ; next 1.1; 1.1 date 90.02.06.12.58.59; author sources; state Exp; branches ; next ; desc @@ 1.4 log @add ID @ text @/* brkstring.c - break string into an array of strings */ #ifndef lint static char ident[] = "@@(#)$Id:$"; #endif lint #include "../h/mh.h" static char *broken[MAXARGS+1]; /* array of substring start addresses */ static brkany(); char **brkstring (strg, brksep, brkterm) register char *strg; register char *brksep, *brkterm; { register int bi; register char c, *sp; sp = strg; /* scan string, replacing separators with zeroes */ for (bi = 0; bi < MAXARGS; bi++) { /* and entering start addrs in "broken" */ while (brkany (c = *sp, brksep)) *sp++ = 0; if (!c || brkany (c, brkterm)) { *sp = 0; broken[bi] = 0; return broken; /* terminator found, finish up */ } broken[bi] = sp; /* set next start addr */ while ((c = *++sp) && !brkany (c, brksep) && !brkany (c, brkterm)) continue; } broken[MAXARGS] = 0; /* reached limit of MAXARGS substrings */ return broken; } static brkany (chr, strg) /* returns 1 if chr in strg, 0 otherwise */ register char chr, *strg; { register char *sp; if (strg) for (sp = strg; *sp; sp++) if (chr == *sp) return 1; return 0; } @ 1.3 log @add ID @ text @d3 1 a3 1 static char ident[] = "$Id:"; @ 1.2 log @ANSI Compilance @ text @d2 3 @ 1.1 log @Initial revision @ text @d7 1 @