WindowsXP-SP1/com/rpc/tools/yacc/ycpycd.c
2020-09-30 16:53:49 +02:00

50 lines
944 B
C

// 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");
}