7 * Remove empty lines from the beginning and end.
9 * Turn multiple consecutive empty lines into just one
10 * empty line. Return true if it is an incomplete line.
12 static int cleanup(char *line)
14 int len = strlen(line);
16 if (len && line[len-1] == '\n') {
20 unsigned char c = line[len-2];
32 void stripspace(FILE *in, FILE *out)
38 while (fgets(line, sizeof(line), in)) {
39 incomplete = cleanup(line);
41 /* Not just an empty line? */
42 if (line[0] != '\n') {
57 int cmd_stripspace(int argc, const char **argv, const char *prefix)
59 stripspace(stdin, stdout);