preprocessor question (non-ANSI)

david.f.prosser dfp at cbnewsl.ATT.COM
Wed Oct 11 01:03:42 AEST 1989


In article <174 at eliza.edvvie.at> johnny at edvvie.at (Johann Schweigl) writes:
 >How can I replace a text token by itself, along with some additional text?
 >Example: 
 >EXEC SQL select * from emp;     __curline = 23; EXEC SQL select * from emp;
 >before ^^^^^^^^^^^^^^^^^^^^     after ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 >
 >#define EXEC __curline = __LINE__; EXEC 
 >is not the solution, cpp would try to resolve EXEC recursively
 >I know, sed is the most natural solution, but I want to do all by including
 >a single file. ANSI is not spoken on my system.

With ANSI C, your example macro definition will work as you desire.

Dave Prosser	...not an official X3J11 answer...



More information about the Comp.unix.questions mailing list