- for(end = &items; fgets(buf, sizeof buf, stdin); *end = item, end = &item->next) {
+ for(i = 0; fgets(buf, sizeof buf, stdin); items[++i].text = NULL) {
+ if(i+1 >= size / sizeof *items)
+ if(!(items = realloc(items, (size += BUFSIZ))))
+ eprintf("cannot realloc %u bytes:", size);