From 4b3a13ab1e1713f0b01928e7741ba9a714dffeb9 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Fri, 6 Nov 1998 01:48:50 +0000
Subject: [PATCH] Update Alpha2 with NT4 changes.

---
 clients/tools/ldapdelete.c |  1 +
 clients/tools/ldapmodrdn.c |  1 +
 include/ac/stdarg.h        | 14 ++++++++++++++
 libraries/liblber/decode.c | 12 ++++--------
 libraries/liblber/encode.c | 13 ++++---------
 libraries/libldap/os-ip.c  |  2 +-
 6 files changed, 25 insertions(+), 18 deletions(-)
 create mode 100644 include/ac/stdarg.h

diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c
index 93b9f0de61..9a0bf901a8 100644
--- a/clients/tools/ldapdelete.c
+++ b/clients/tools/ldapdelete.c
@@ -8,6 +8,7 @@
 
 #include <ac/socket.h>
 #include <ac/string.h>
+#include <ac/unistd.h>
 
 #include <lber.h>
 #include <ldap.h>
diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c
index a00d259d34..76b6154f9f 100644
--- a/clients/tools/ldapmodrdn.c
+++ b/clients/tools/ldapmodrdn.c
@@ -8,6 +8,7 @@
 #include <ac/ctype.h>
 #include <ac/string.h>
 #include <ac/time.h>
+#include <ac/unistd.h>
 
 #include <lber.h>
 #include <ldap.h>
diff --git a/include/ac/stdarg.h b/include/ac/stdarg.h
new file mode 100644
index 0000000000..8b805c8abc
--- /dev/null
+++ b/include/ac/stdarg.h
@@ -0,0 +1,14 @@
+/* Generic stdarg.h */
+
+#ifndef _AC_STDARG_H
+#define _AC_STDARG_H 1
+
+#if defined( HAVE_STDARG_H ) && \
+	( defined( __STDC__ ) || defined( _WIN32 ) )
+#	include <stdarg.h>
+#	define HAVE_STDARG 1
+#else
+#	include <varargs.h>
+#endif
+
+#endif /* _AC_STDARG_H */
diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c
index 80f11de436..e67b288b55 100644
--- a/libraries/liblber/decode.c
+++ b/libraries/liblber/decode.c
@@ -19,11 +19,7 @@
 #include <stdlib.h>
 #endif
 
-#if defined( HAVE_STDARG_H ) && __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
+#include <ac/stdarg.h>
 
 #include <ac/string.h>
 #include <ac/socket.h>
@@ -370,7 +366,7 @@ ber_next_element( BerElement *ber, unsigned long *len, char *last )
 /* VARARGS */
 unsigned long
 ber_scanf
-#if defined( HAVE_STDARG_H ) && __STDC__
+#if HAVE_STDARG
 	( BerElement *ber, char *fmt, ... )
 #else
 	( va_alist )
@@ -378,7 +374,7 @@ va_dcl
 #endif
 {
 	va_list		ap;
-#if !(defined( HAVE_STDARG_H ) && __STDC__)
+#ifndef HAVE_STDARG
 	BerElement	*ber;
 	char		*fmt;
 #endif
@@ -389,7 +385,7 @@ va_dcl
 	long		*l;
 	unsigned long	rc, tag, len;
 
-#if defined( HAVE_STDARG_H ) && __STDC__
+#ifdef HAVE_STDARG
 	va_start( ap, fmt );
 #else
 	va_start( ap );
diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c
index f2aee16a79..b320a2eb56 100644
--- a/libraries/liblber/encode.c
+++ b/libraries/liblber/encode.c
@@ -16,12 +16,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#if defined( HAVE_STDARG_H ) && __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
+#include <ac/stdarg.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 
@@ -509,7 +504,7 @@ ber_put_set( BerElement *ber )
 /* VARARGS */
 int
 ber_printf
-#if defined( HAVE_STDARG_H ) && __STDC__
+#ifdef HAVE_STDARG
 	( BerElement *ber, char *fmt, ... )
 #else
 	( va_alist )
@@ -517,7 +512,7 @@ va_dcl
 #endif
 {
 	va_list		ap;
-#if !(defined( HAVE_STDARG_H ) && __STDC__)
+#ifndef HAVE_STDARG
 	BerElement	*ber;
 	char		*fmt;
 #endif
@@ -526,7 +521,7 @@ va_dcl
 	int		rc, i;
 	unsigned long	len;
 
-#if defined( HAVE_STDARG_H ) && __STDC__
+#ifdef HAVE_STDARG
 	va_start( ap, fmt );
 #else
 	va_start( ap );
diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c
index 0083cc0591..9d15b1c342 100644
--- a/libraries/libldap/os-ip.c
+++ b/libraries/libldap/os-ip.c
@@ -56,7 +56,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
 
 	connected = use_hp = 0;
 
-	if ( host != NULL && ( address = inet_addr( host )) == -1UL ) {
+	if ( host != NULL && ( address = inet_addr( host )) == (unsigned long) -1L ) {
 		if ( (hp = gethostbyname( host )) == NULL ) {
 #ifdef HAVE_WINSOCK
 			errno = WSAGetLastError();
-- 
GitLab