Kill off OSMAJORVERSION and OSMINORVERSION defines/cpp flags

This has meant very little for a long time as configure.ac just
hardcoded these values depending on the current OS versions at the
time.

The only place where this is really 'needed' is XlationSvc.c in DtSvc
so that differences between locale specifications on various versions
of an OS can be accounted for. So for now, we just define those when
building DtSvc.

We could probably safely remove them as well with an update to the
Xlate locale DB to remove ancient cruft we don't care about anymore.

For various other modules, like dtlogin, dtsession, etc we just use
the code that was already being used due to the hardcoded values we've
had for the last 10-ish years.
This commit is contained in:
Jon Trulson
2022-08-06 17:02:52 -06:00
parent 6fddca178f
commit 2d0c4d6d39
20 changed files with 61 additions and 120 deletions

View File

@@ -230,17 +230,6 @@ util_vfork(void)
/*
* putenv() is non-POSIX, so the parameter types can vary a bit...
*/
#ifdef __cplusplus
extern "C" {
#endif
#if (defined(sun) && OSMAJORVERSION >= 5 && OSMINORVERSION >= 4 && OSMINORVERSION <=10 )
extern int putenv(const char *string);
#elif !(defined(__aix) || defined(__NetBSD__))
extern int putenv(char *string);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
int
util_putenv(STRING string)
{

View File

@@ -51,7 +51,7 @@
#endif
#include <fcntl.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8 || defined(HAS_PAM_LIBRARY)
#if defined (__FreeBSD__) || defined(HAS_PAM_LIBRARY)
#include <utmpx.h>
#else
#include <utmp.h>

View File

@@ -54,7 +54,7 @@
# include <sys/types.h>
# include <sys/signal.h>
# include <sys/stat.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
# include <utmpx.h>
#else
# include <utmp.h>
@@ -1646,7 +1646,7 @@ GettyMessage( struct display *d, int msgnum )
int
GettyRunning( struct display *d )
{
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
struct utmpx utmp; /* local struct for new entry */
struct utmpx *u; /* pointer to entry in utmp file */
#else
@@ -1671,7 +1671,7 @@ GettyRunning( struct display *d )
return FALSE;
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
bzero(&utmp, sizeof(struct utmpx));
#else
bzero(&utmp, sizeof(struct utmp));

View File

@@ -39,7 +39,7 @@
# include <signal.h>
# include <X11/Xatom.h>
# include <X11/Xmu/Error.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
#if defined(__FreeBSD__)
# include <utmpx.h>
#else
# include <utmp.h>

View File

@@ -112,10 +112,6 @@ extern int errno;
# define DONT_USE_DES
# elif defined(sun)
# define USE_CRYPT
# if (OSMAJORVERSION >= 4)
/* avoid strange sun crypt hackery */
# define crypt _crypt
# endif
# endif
# define USE_ENCRYPT
#endif

View File

@@ -67,7 +67,7 @@
# include <X11/Xatom.h>
# include <X11/Xmu/Error.h>
# include <setjmp.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8 || defined(HAS_PAM_LIBRARY)
#if defined(__FreeBSD__) || defined(HAS_PAM_LIBRARY)
# include <utmpx.h>
#else
# include <utmp.h>

View File

@@ -165,11 +165,7 @@ GetChooserAddr (char *addr, int *lenp)
int len;
len = sizeof in_addr;
#if defined (_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
if (getsockname (chooserFd, (struct sockaddr *)&in_addr, (size_t *)&len) < 0)
#else
if (getsockname (chooserFd, (struct sockaddr *)&in_addr, &len) < 0)
#endif
return -1;
Debug ("Chooser socket port: %d\n", ntohs(in_addr.sin_port));
memmove( addr, (char *) &in_addr, len);

View File

@@ -45,10 +45,6 @@
**
** Conditional compiles for HPUX:
**
** OSMAJORVERSION < 8
** HP-UX 7.0/7.03 restricted license counting algorithms
** are used. Otherwise HP-UX 8.0 and beyond is used
**
** AUDIT HP C2 security enhancements; checks for existence of
** SECUREPASSWD file and authenticates user against
** password contained in that file. Also performs
@@ -1022,7 +1018,7 @@ Authenticate( struct display *d, char *name, char *passwd, char **msg )
}
#endif
#if defined(__OpenBSD__) && OSMAJORVERSION > 5
#if defined(__OpenBSD__)
/*
* Use the OpenBSD getpwnam_shadow function to get the crypt()ed password
*/

View File

@@ -45,10 +45,6 @@
**
** Conditional compiles for HPUX:
**
** OSMAJORVERSION < 8
** HP-UX 7.0/7.03 restricted license counting algorithms
** are used. Otherwise HP-UX 8.0 and beyond is used
**
** AUDIT HP C2 security enhancements; checks for existence of
** SECUREPASSWD file and authenticates user against
** password contained in that file. Also performs

View File

@@ -91,10 +91,6 @@ extern "C"
mntctl(int, int, char *);
ssize_t writev(int, const struct iovec *, int);
}
#if (OSMAJORVERSION==4) && (OSMINORVERSION==2)
/* Temporary hack till the /usr/lpp/xlC/include/unistd.h file is fixed. */
extern "C" { int lockf(int, int, off_t); }
#endif
#endif /* _AIX */
#include <DtMail/DtMail.hh>

View File

@@ -35,26 +35,17 @@
#ifndef _BOOLEAN_
#define _BOOLEAN_
#if (defined(sun) && OSMAJORVERSION <= 5 && OSMINORVERSION <= 3)
#if defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#define true B_TRUE
#define false B_FALSE
#elif defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#if defined(__XOPEN_OR_POSIX)
#define true _B_TRUE
#define false _B_FALSE
#else
#define true B_TRUE
#define false B_FALSE
#endif
#elif defined(__linux__)
#define false 0
#define true 1
#define boolean int
#elif defined(CSRG_BASED)
# if defined(__XOPEN_OR_POSIX)
#define true _B_TRUE
#define false _B_FALSE
# else
#define true B_TRUE
#define false B_FALSE
# endif
#elif defined(__linux__) || defined(CSRG_BASED)
#include <stdbool.h>
#define boolean bool
#else

View File

@@ -36,26 +36,17 @@
#ifndef _BOOLEAN_
#define _BOOLEAN_
#if (defined(sun) && OSMAJORVERSION <= 5 && OSMINORVERSION <= 3)
#if defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#define true B_TRUE
#define false B_FALSE
#elif defined(sun)
#include <sys/types.h>
#define boolean boolean_t
#if defined(__XOPEN_OR_POSIX)
#define true _B_TRUE
#define false _B_FALSE
#else
#define true B_TRUE
#define false B_FALSE
#endif
#elif defined(__linux__)
#define false 0
#define true 1
#define boolean int
#elif defined(CSRG_BASED)
# if defined(__XOPEN_OR_POSIX)
#define true _B_TRUE
#define false _B_FALSE
# else
#define true B_TRUE
#define false B_FALSE
# endif
#elif defined(__linux__) || defined(CSRG_BASED)
#include <stdbool.h>
#define boolean bool
#else

View File

@@ -114,11 +114,7 @@ Invoke::Invoke(const char *command, // Command to Run
memset(&oldsigquit_act, '\0', sizeof (struct sigaction));
memset(&oldsigint_act, '\0', sizeof (struct sigaction));
#if (defined(sun) && OSMAJORVERSION == 5 && OSMINORVERSION <= 4)
action.sa_handler = (void (*)())SIG_IGN;
#else
action.sa_handler = SIG_IGN;
#endif
sigaction(SIGINT, &action, &oldsigint_act);
sigaction(SIGQUIT, &action, &oldsigquit_act);

View File

@@ -1827,7 +1827,7 @@ localAuthenticate(
/*
* Get password entry for 'name' or 'uid'.
*/
#if defined(__OpenBSD__) && OSMAJORVERSION > 5
#if defined(__OpenBSD__)
if ((pwent = (name == NULL ?
getpwuid_shadow(uid) : getpwnam_shadow(name))) == NULL)
#else