home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / comm / yaccunx / ycpycd.2c < prev    next >
Encoding:
Text File  |  1983-12-25  |  630 b   |  29 lines

  1. #include "y2.h"
  2.  
  3. cpycode()
  4.    {
  5.    /* copies code between \{ and \} */
  6.  
  7.    int c;
  8.    c = unix_getc(finput);
  9.    if( c == '\n' ) 
  10.       {
  11.       c = unix_getc(finput);
  12.       lineno++;
  13.       }
  14.    fprintf( ftable, "\n# line %d\n", lineno );
  15.    while( c>=0 )
  16.       {
  17.       if( c=='\\' )
  18.          if( (c=unix_getc(finput)) == '}' ) return;
  19.          else putc('\\', ftable );
  20.       if( c=='%' )
  21.          if( (c=unix_getc(finput)) == '}' ) return;
  22.          else putc('%', ftable );
  23.       putc( c , ftable );
  24.       if( c == '\n' ) ++lineno;
  25.       c = unix_getc(finput);
  26.       }
  27.    error("eof before %%}" );
  28.    }
  29.