X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Finclude%2Fsysutmp.h;h=27d5cddef3296baeb03e24e92f30538601c5e8e0;hb=e2eaf9194b16fdd15ebf274aafd05edc9fefb4bb;hp=cad566260805c763ce38abb2cd524d1383d87ae8;hpb=7bf2038879e7e62f3f7143bfcb58ca2cffcb353f;p=freeradius.git diff --git a/src/include/sysutmp.h b/src/include/sysutmp.h index cad5662..27d5cdd 100644 --- a/src/include/sysutmp.h +++ b/src/include/sysutmp.h @@ -7,32 +7,73 @@ #ifndef SYSUTMP_H_INCLUDED #define SYSUTMP_H_INCLUDED +#include +RCSIDH(sysutmp_h, "$Id$") + +/* + * If we have BOTH utmp.h and utmpx.h, then + * we prefer to use utmp.h, but only on systems other than Solaris. + */ +#if !defined(sun) && !defined(sgi) && !defined(hpux) #ifdef HAVE_UTMP_H +#undef HAVE_UTMPX_H +#endif +#endif + +#if defined(HAVE_UTMP_H) || defined(HAVE_UTMPX_H) /* UTMP stuff. Uses utmpx on svr4 */ -#ifdef __svr4__ +#ifdef HAVE_UTMPX_H # include # include # define utmp utmpx # define UT_NAMESIZE 32 # define UT_LINESIZE 32 # define UT_HOSTSIZE 257 +#ifdef hpux +# define ut_name ut_user +#endif #else # include #endif +#ifdef __cplusplus +extern "C" { +#endif + #ifdef __osf__ # define UT_NAMESIZE 32 # define UT_LINESIZE 32 # define UT_HOSTSIZE 64 #endif -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(bsdi) || defined(__OpenBSD__) + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(bsdi) || defined(__OpenBSD__) || defined(__APPLE__) # ifndef UTMP_FILE # define UTMP_FILE "/var/run/utmp" # endif # define ut_user ut_name #endif +/* + * Generate definitions for systems which are too broken to + * do it themselves. + * + * Hmm... this means that we can probably get rid of a lot of + * the static defines above, as the following lines will generate + * the proper defines for any system. + */ +#ifndef UT_LINESIZE +#define UT_LINESIZE sizeof(((struct utmp *) NULL)->ut_line) +#endif + +#ifndef UT_NAMESIZE +#define UT_NAMESIZE sizeof(((struct utmp *) NULL)->ut_user) +#endif + +#ifndef UT_HOSTSIZE +#define UT_HOSTSIZE sizeof(((struct utmp *) NULL)->ut_host) +#endif + #else /* HAVE_UTMP_H */ /* @@ -61,4 +102,8 @@ struct utmp { #endif /* HAVE_UTMP_H */ +#ifdef __cplusplus +} +#endif + #endif /* SYSUTMP_H_INCLUDED */