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