2 * 1-22. Write a program to "fold" long input lines into two or more shorter
3 * lines after the last non-blank character that occurs before the n-th
4 * column of input. Make sure your program does something intelligent with
5 * very long lines, and if there are no blanks or tabs before the specified
14 void copy(char to[], char from[]);
19 char current[WIDTH+1];
24 while ((c = getchar())!=EOF) {
27 len = strln(current)+1;
29 printf("%s%c", current, c);
32 printf("\n%s%c", current, c);
36 } else if (c == '\n') {
38 printf("%s%c", current, c);
40 } else if (c == '\t') {
41 len = strln(current)+TABSTOP;
44 printf("%s%c", current, c);
47 printf("\n%s%c", current, c);
52 len = strln(current)+1;
58 printf("%s\n%c", current, c);
69 for (i=0; s[i] != '\0'; ++i)
73 void copy(char to[], char from[])
77 while ((to[i] = from[i]) != '\0')