4 extern int nohdrfields;
6 wordtab_t *parsefields(table, arg)
10 wordtab_t *f, *fields;
17 for (s = strtok(arg, ","); s != NULL; s = strtok(NULL, ",")) {
25 f = findword(table, s);
27 fprintf(stderr, "Unknown field '%s'\n", s);
33 fields = malloc(2 * sizeof(*fields));
35 fields = realloc(fields, (num + 1) * sizeof(*fields));
37 warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__);
43 fields[num - 1].w_word = f->w_word;
45 fields[num - 1].w_word = t;
47 fields[num - 1].w_value = f->w_value;
48 fields[num].w_word = NULL;
49 fields[num].w_value = 0;