- ret = read_raw_pkgs_from_stream(fp);
-
- fclose(fp);
-
- return ret;
-}
-
-char **read_raw_pkgs_from_stream(FILE *fp)
-{
- char **raw = NULL, *buf, *scout;
- int count = 0;
- size_t size = 512;
-
- buf = xcalloc(1, size);
-
- while (fgets(buf, size, fp)) {
- while (strlen (buf) == (size - 1)
- && buf[size-2] != '\n') {
- size_t o = size - 1;
- size *= 2;
- buf = xrealloc (buf, size);
- if (fgets (buf + o, size - o, fp) == NULL)
- break;
- }
-
- if(!(count % 50))
- raw = xrealloc(raw, (count + 50) * sizeof(char *));
-
- if((scout = strchr(buf, '\n')))
- *scout = '\0';
-
- raw[count++] = xstrdup(buf);
- }
-
- raw = xrealloc(raw, (count + 1) * sizeof(char *));
- raw[count] = NULL;
-
- free (buf);
-
- return raw;