#!/usr/local/bin/cz -- use stdio.h use stdlib.h use string.h int main(void): cstr *vec = Malloc(LINES * sizeof(*vec)) cstr *vecp = vec cstr buf, r buf = Malloc(SIZE) while 1: r = fgets(buf, SIZE, stdin) if r == NULL: break if r[strlen(r)-1] != '\n': die("line too long") if vecp == vec+LINES: die("too many lines") else: *vecp = buf buf = Malloc(SIZE) ++vecp qsort(vec, vecp-vec, sizeof(*vec), compare) for ; vec