Concatenating with a compile-time definition in "ANSI" CPP
Henry Spencer
henry at utzoo.uucp
Sun Sep 24 07:48:03 AEST 1989
In article <470004 at gore.com> jacob at gore.com (Jacob Gore) writes:
>I want to be able to, for example, use -DMta=Sendmail in cc's command line,
>and have that result in "MtaInit()" replaced with "SendmailInit()" in the code.
>Is there a way to do this?
In a word, no. (Well, not unless you commit vile acts with the obscure
token-concatenation operator, and set up your program to perform said vile
acts on every such identifier.)
You want a general text-manipulation tool like sed, not the C preprocessor.
Try "sed 's/Mta/Sendmail/g' file.proto >file.c".
--
"Where is D.D. Harriman now, | Henry Spencer at U of Toronto Zoology
when we really *need* him?" | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list