6 * Remove empty lines from the beginning and end.
8 * Turn multiple consecutive empty lines into just one
9 * empty line. Return true if it is an incomplete line.
11 static int cleanup(char *line)
13 int len = strlen(line);
15 if (len > 1 && line[len-1] == '\n') {
17 unsigned char c = line[len-2];
29 int main(int argc, char **argv)
35 while (fgets(line, sizeof(line), stdin)) {
36 incomplete = cleanup(line);
38 /* Not just an empty line? */
39 if (line[0] != '\n') {