which UNIX?

cottrell at nbs-vms.ARPA cottrell at nbs-vms.ARPA
Thu Feb 21 06:22:47 AEST 1985


/*
>    If you need to know at compile time whether you're on a Berklix or 
> a System V system, this might help.  It seems to work on all of our
> systems, including the Pyramid split universe wonder:
> 
> 	# include	<fcntl.h>
> 	# ifdef		FNDELAY
> 	# define	BSD
> 	# else
> 	# define	SYS5
> 	# endif
> 
> This assumes that FNDELAY is not defined in the System V fcntl.h, and
> is in the BSD.  Can anyone think of a case where this is not true, or
> suggest a more convenient/valid alternative?
> "The closer you look, the worse it gets."

Hopefully the C std will define once & for all the appropriate
system names. In the meantime, one could make up one's own names, then
define them in <something.h> as follows:

	/* something.h */
	#ifdef ___V4_1
	#define ___OK
	#endif
	#ifdef ___V4_2
	#define ___OK
	#endif
	#ifdef ___SYSV
	#define ___OK
	#endif
	#ifdef ___V6
	#define ___OK
	#endif
	#ifdef ___V7
	#define ___OK
	#endif
	#ifndef ___OK
	something horrible! ! % ^ & * ( ) - + = [ { } ]
	#endif
	#undef ___OK

The user would be instructed to edit this file & define his system.
All source files would include this file. Multiple defs could also
be forbidden by this technique. Kinda gross tho. Oh well...

	jim
*/



More information about the Comp.unix.wizards mailing list