[Gllug] endian.h

rich at annexia.org rich at annexia.org
Thu Feb 6 10:35:25 UTC 2003


On Wed, Feb 05, 2003 at 11:56:58PM +0000, Mike Brodbelt wrote:
> As it seems I can't just substitute one include file for another, would
> it be cleaner to do "#ifdef LINUX" around the code segments in question
> and substitute the BSD macros with cpu_to_be16 and similar?

If there's a common header file shared by all the code, then probably
the simplest thing to do is to add this to the header file:

#ifdef __linux__
#include <endian.h>
/* Define betoh32, etc. */
#endif

using the functions in /usr/include/cdda/utils.h as a starting point.

Or if the OpenBSD functions are really macros, then even better would be:

#ifndef betoh32
#define ....
#endif

FWIW I've just ported a load of code which was written on Linux to
OpenBSD and Solaris, and I'm constantly surprised by how much Solaris
(in particular) and OpenBSD lack in their APIs. Really basic stuff
like Solaris not having 'setenv(3)'. I'm amazed that people actually
prefer to pay money for this crap. (</solaris-rant>)

Rich.

-- 
Richard Jones, Red Hat Inc. (London, UK) http://www.redhat.com/software/ccm
http://www.annexia.org/ Freshmeat projects: http://freshmeat.net/users/rwmj

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list