home *** CD-ROM | disk | FTP | other *** search
/ Carousel / CAROUSEL.cdr / mactosh / unix / paintps.sha / macfilter.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-07-08  |  572 b   |  26 lines

  1.  
  2. /*
  3.  * macfilter -  Convert non-ascii characters to octal excapes for the 
  4.  *        LaserWriter printer.  This usually only happens with Postscript
  5.  *        files generated by the Macintosh, it isn't supposed to do that
  6.  *        but sometimes it does.  This little guy makes it all better
  7.  *        again.
  8.  *        Author: Brian Powell, brian@ut-sally
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <ctype.h>
  13.  
  14. main()
  15. {
  16.     register char c;
  17.  
  18.     while ((c = getchar()) != EOF) {
  19.         if (!isascii(c))
  20.             printf("\\%03o", ((int)c) & 0377);
  21.         else
  22.             putchar(c);
  23.     }
  24.     exit (0);    /* set explicit exit code for the spooler */
  25. }
  26.