Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!mit-eddie!husc6!ogccse!littlei!omepd!merlyn From: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.unix.questions Subject: Re: How can I find out cc or cpp symbols? Message-ID: <4336@omepd.UUCP> Date: 23 Apr 89 19:46:11 GMT References: <19236@adm.BRL.MIL> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 37 In-reply-to: rbj@dsys.icst.nbs.gov (Root Boy Jim) In article <19236@adm.BRL.MIL>, rbj@dsys (Root Boy Jim) writes: | You can do this by a somewhat roundabout route. First you run the command | `strings' (if you have it) on the cpp binary. You then grep out only the | legal preprocessor strings (only alphanumeric or underscores not starting | with a digit). Then pipe it to an awk command which turns `foo' into | | #ifdef foo | printf("foo\n"); | #endif | | and brackets the whole thing with "main () {" and "}". Sen the output | to a file, compile it, link it, and run it. Voila! Here's what I have... I call it 'whatdef': strings -2 /lib/cpp | grep '^[_A-Za-z][_A-Za-z0-9]*$' | sort -u | awk ' { print "#ifdef " $0 print "__" $0 "__ is defined" print "#endif" } ' | /lib/cpp | sed -n 's/^__\(.*\)__ is defined$/\1/p' I probably could have done the middle in sed, but I didn't feel like hacking the backslashes and newlines. Note the new address in the .sig.... -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095===\ { on contract to BiiN, Hillsboro, Oregon, USA, until 01 June 1989 } { ...!uunet!tektronix!biin!merlyn } { or try after 01 June 1989 } \=Cute quote: "Welcome to Oregon... home of the California Raisins!"=/