Telling csh about multiple, machine-dependent libraries

Randal L. Schwartz @ Stonehenge merlyn at intelob.biin.com
Tue Nov 29 04:11:16 AEST 1988


In article <142 at minya.UUCP>, jc at 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.
<merlyn at intelob.biin.com> or ...!tektronix!inteloa[!intelob]!merlyn
SOME MAILERS REQUIRE <merlyn at intelob.intel.com> GRRRRR!
Standard disclaimer: I *am* my employer!



More information about the Comp.unix.questions mailing list