windows-nt/Source/XPSP1/NT/com/rpc/tools/yacc/ycpycd.c

50 lines
895 B
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
// Copyright (c) 1993-1999 Microsoft Corporation
#include "y2.h"
void
cpycode( void )
{
/* copies code between \{ and \} */
int c;
c = unix_getc(finput);
if( c == '\n' )
{
c = unix_getc(finput);
lineno++;
}
writeline(ftable);
while( c>=0 )
{
if( c=='\\' )
if( (c=unix_getc(finput)) == '}' ) return;
else putc('\\', ftable );
if( c=='%' )
if( (c=unix_getc(finput)) == '}' ) return;
else putc('%', ftable );
putc( c , ftable );
if( c == '\n' ) ++lineno;
c = unix_getc(finput);
}
error("eof before %%}" );
}
void writeline(FILE *fh) {
char *psz = infile;
fprintf( fh, "\n#line %d \"", lineno );
psz = infile;
while (*psz) {
putc(*psz, fh);
if (*psz == '\\') {
putc('\\', fh);
}
psz++;
}
fprintf(fh, "\"\n");
}