[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defontifying program



    Date: Fri, 3 Aug 90 14:06:16 EDT
    From: cstacy@ai.mit.edu (Christopher C. Stacy)

    I guess you could make a trivial pipe something like this:

It's slightly more complicated.  You have to flush the following
character, except if that's a left paren, you have to scan to
the matching close (a balanced scan, since there may be open
parens along the way).  Also, if it's a  character, you have
to remove the following 37-byte constant string.

There's also provision for embedding of diagrams, but you're
unlikely to run into those in anything you'd want to unfontify.

    /* ff - flush fonts
      Copies standard input to standard output removing Genera font information. */

    #include <stdio.h>
    #define FONT_START ''

    main ()
    { int c;
      int flag = 0;
      while ((c = getchar()) != EOF) {
	      if ((c == FONT_START) || flag) flag = !flag;
	      else putchar(c);
      }
     }