26035813ab48add6a3e10a7253dc5371942ee32f braney Wed May 18 12:28:33 2011 -0700 add a routine to find a name in a comma separate list (Jim wrote this but I'm moving it) diff --git src/lib/obscure.c src/lib/obscure.c index 4d907a2..ccf3906 100644 --- src/lib/obscure.c +++ src/lib/obscure.c @@ -699,15 +699,40 @@ char *line; while (lineFileNextReal(lf, &line)) { if (stringIn("VmPeak", line)) { fprintf(stderr, "# pid=%d: %s\n", pid, line); break; } } lineFileClose(&lf); } else fprintf(stderr, "# printVmPeak: %s - not available\n", temp); fflush(stderr); } + +boolean nameInCommaList(char *name, char *commaList) +/* Return TRUE if name is in comma separated list. */ +{ +if (commaList == NULL) + return FALSE; +int nameLen = strlen(name); +for (;;) + { + char c = *commaList; + if (c == 0) + return FALSE; + if (memcmp(name, commaList, nameLen) == 0) + { + c = commaList[nameLen]; + if (c == 0 || c == ',') + return TRUE; + } + commaList = strchr(commaList, ','); + if (commaList == NULL) + return FALSE; + commaList += 1; + } +} +