home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume6 / lp-posters / part01 / ffilter.c < prev    next >
C/C++ Source or Header  |  1989-03-17  |  609b  |  37 lines

  1. /*
  2.  * ffilter.c - simple FORTRAN (ANSI) to Unix print filter
  3.  *        input is from stdin; output to stdout
  4.  */
  5. #include <stdio.h>
  6.  
  7. char s[136];
  8.  
  9. main()
  10. {
  11.     while (fgets(s, 135, stdin) != NULL) {
  12.         if (s[0] == '\0')
  13.             continue;
  14.         s[strlen(s)-1] = '\0';  /* remove trailing \n */
  15.         switch (s[0]) {
  16.             case '\0':
  17.                 putchar('\n');
  18.                 break;
  19.             case ' ':
  20.                 printf("\n%s\r", &s[1]);
  21.                 break;
  22.             case '+':
  23.                 printf("%s\r", &s[1]);
  24.                 break;
  25.             case '0':
  26.                 printf("\n\n%s\r", &s[1]);
  27.                 break;
  28.             case '1':
  29.                 printf("\f%s\r", &s[1]);
  30.                 break;
  31.             default:
  32.                 printf("\n%s\r", &s[1]);
  33.                 break;
  34.         }
  35.     }
  36. }
  37.