/* * trim_strings.c * * Remove trailing blanks and tabs from each line of input, and * delete entirely blank lines. * K&R Exercise 1.18 */ #include "strfun.h" #include int main() { int line_length; char line[MAXLINE]; // Read input line-by-line while (fgets(line, MAXLINE, stdin)) { // Trim whitespace and print line if any characters left if (trim_string(line) > 0) printf ("|%s|\n", line); } return 0; }