home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / CLISPSRC.TAR / clisp-1995-01-01 / utils / deerror.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-23  |  1.9 KB  |  54 lines

  1. /* C-Programm-PrΣprozessor-Hilfe:
  2.    Ersetzt die #error-Anweisungen am Beginn jeder Zeile durch ERROR.
  3.    Bruno Haible 4.11.1992
  4. */
  5.  
  6. #include <stdio.h>
  7.  
  8. #define NL 10
  9.  
  10. main ()
  11.   { int c;
  12.     zeilenanfang:
  13.       c = getchar(); if (c==EOF) { goto eof; }
  14.       if (c=='#')
  15.         { c = getchar(); if (c==EOF) { putchar('#'); goto eof; }
  16.           if (c=='e')
  17.             { c = getchar(); if (c==EOF) { putchar('#'); putchar('e'); goto eof; }
  18.               if (c=='r')
  19.                 { c = getchar(); if (c==EOF) { putchar('#'); putchar('e'); putchar('r'); goto eof; }
  20.                   if (c=='r')
  21.                     { c = getchar(); if (c==EOF) { putchar('#'); putchar('e'); putchar('r'); putchar('r'); goto eof; }
  22.                       if (c=='o')
  23.                         { c = getchar(); if (c==EOF) { putchar('#'); putchar('e'); putchar('r'); putchar('r'); putchar('o'); goto eof; }
  24.                           if (c=='r')
  25.                             { putchar('E'); putchar('R'); putchar('R'); putchar('O'); putchar('R');
  26.                               c = getchar();
  27.                             }
  28.                             else
  29.                             { putchar('#'); putchar('e'); putchar('r'); putchar('r'); putchar('o'); }
  30.                         }
  31.                         else
  32.                         { putchar('#'); putchar('e'); putchar('r'); putchar('r'); }
  33.                     }
  34.                     else
  35.                     { putchar('#'); putchar('e'); putchar('r'); }
  36.                 }
  37.                 else
  38.                 { putchar('#'); putchar('e'); }
  39.             }
  40.             else
  41.             { putchar('#'); }
  42.         }
  43.       /* Rest der Zeile unverΣndert ⁿbernehmen: */
  44.       rest:
  45.         putchar(c);
  46.         if (c==NL) goto zeilenanfang;
  47.         c = getchar(); if (c==EOF) { goto eof; }
  48.         goto rest;
  49.     eof: ;
  50.     if (ferror(stdin) || ferror(stdout)) { exit(1); }
  51.     exit(0);
  52.   }
  53.  
  54.