Path: utzoo!attcan!uunet!husc6!mailrus!ames!oliveb!intelca!mipos3!merlyn
From: merlyn@intelob.biin.com (Randal L. Schwartz @ Stonehenge)
Newsgroups: comp.unix.questions
Subject: Re: Telling csh about multiple, machine-dependent libraries
Message-ID: <3238@mipos3.intel.com>
Date: 28 Nov 88 18:11:16 GMT
References: <142@minya.UUCP>
Sender: news@mipos3.intel.com
Reply-To: merlyn@intelob.biin.com (Randal L. Schwartz @ Stonehenge)
Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA
Lines: 42
In-reply-to: jc@minya.UUCP (John Chambers)

In article <142@minya.UUCP>, jc@minya (John Chambers) writes:
| Which reminds me:  Is it written down anywhere how one might go about finding
| out what symbols are pre-defined by a C pre-processor?  I know that "unix" is
| generally pre-defined on Unix systems, and there's usually some symbol that
| identifies the cpu and/or model, but how do I find out what it is?  I've read
| lots of manuals, and never seen it mentioned.

On one rainy afternoon (lots of those here in Oregon :-), I hacked out the
following:

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'

Looking at it now, I can see a couple of bugs (like if both X and
__X__ are predefined, you lose), but you get the idea.

Running on this Ultrix thing (I think)... I get:
  __FILE__
  __LINE__
  bsd4_2
  ultrix
  unix
  vax

Yup.  Ultrix is defined.
-- 
Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095
on contract to BiiN Technical Information Services (for now :-),
in a former Intel building in Hillsboro, Oregon, USA.
 or ...!tektronix!inteloa[!intelob]!merlyn
SOME MAILERS REQUIRE  GRRRRR!
Standard disclaimer: I *am* my employer!