check whether `ent' contains `nam'; return start of field entries */
| 192 | |
| 193 | /* check whether `ent' contains `nam'; return start of field entries */ |
| 194 | static char * |
| 195 | tc_name(const char *nam, char *ent) |
| 196 | { |
| 197 | char *nxt, *lst, *p = ent; |
| 198 | size_t n = strlen(nam); |
| 199 | |
| 200 | if ((lst = strchr(p, ':')) == 0) |
| 201 | lst = p + strlen(p); |
| 202 | |
| 203 | while (p < lst) { |
| 204 | if ((nxt = strchr(p, '|')) == 0 || nxt > lst) |
| 205 | nxt = lst; |
| 206 | if ((long) (nxt - p) == (long) n && strncmp(p, nam, n) == 0) |
| 207 | return lst; |
| 208 | p = nxt + 1; |
| 209 | } |
| 210 | return (char *) 0; |
| 211 | } |
| 212 | |
| 213 | /* look up a numeric entry */ |
| 214 | int |