-static int
-is_field(const char *type, const char *line)
-{
- if (!strncmp(line, type, strlen(type)))
- return 1;
- return 0;
-}
-
-static char *
-parse_simple(const char *type, const char *line)
-{
- return trim_xstrdup(line + strlen(type) + 1);
-}
-
-/*
- * Parse a comma separated string into an array.
- */
-static char **
-parse_comma_separated(const char *raw, unsigned int *count)
-{
- char **depends = NULL;
- const char *start, *end;
- int line_count = 0;
-
- /* skip past the "Field:" marker */
- while (*raw && *raw != ':')
- raw++;
- raw++;
-
- if (line_is_blank(raw)) {
- *count = line_count;
- return NULL;
- }
-
- while (*raw) {
- depends = xrealloc(depends, sizeof(char *) * (line_count + 1));
-
- while (isspace(*raw))
- raw++;
-
- start = raw;
- while (*raw != ',' && *raw)
- raw++;
- end = raw;
-
- while (end > start && isspace(*end))
- end--;
-
- depends[line_count] = xstrndup(start, end-start);
-
- line_count++;
- if (*raw == ',')
- raw++;
- }
-
- *count = line_count;
- return depends;
-}