Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Concatenating with a compile-time definition in "ANSI" CPP Message-ID: <1989Sep23.214803.4377@utzoo.uucp> Organization: U of Toronto Zoology References: <470004@gore.com> Date: Sat, 23 Sep 89 21:48:03 GMT In article <470004@gore.com> jacob@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@zoo.toronto.edu