From 450b02ca583cb04e9c6ae522ec430874daf3cd0e Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Fri, 21 May 1999 03:53:37 +0000
Subject: [PATCH] s/WIN32/HAVE_WINSOCK/ remove old Version.c

---
 servers/slapd/back-bdb2/Version.c   | 13 -------------
 servers/slapd/back-ldbm/Version.c   | 13 -------------
 servers/slapd/back-ldbm/modify.c    |  1 +
 servers/slapd/back-passwd/Version.c | 13 -------------
 servers/slapd/back-perl/Version.c   | 10 ----------
 servers/slapd/back-shell/Version.c  | 13 -------------
 servers/slapd/back-tcl/Version.c    | 13 -------------
 servers/slapd/daemon.c              | 21 +++++++++++++--------
 servers/slapd/main.c                |  3 ++-
 9 files changed, 16 insertions(+), 84 deletions(-)
 delete mode 100644 servers/slapd/back-bdb2/Version.c
 delete mode 100644 servers/slapd/back-ldbm/Version.c
 delete mode 100644 servers/slapd/back-passwd/Version.c
 delete mode 100644 servers/slapd/back-perl/Version.c
 delete mode 100644 servers/slapd/back-shell/Version.c
 delete mode 100644 servers/slapd/back-tcl/Version.c

diff --git a/servers/slapd/back-bdb2/Version.c b/servers/slapd/back-bdb2/Version.c
deleted file mode 100644
index 6231e0530f..0000000000
--- a/servers/slapd/back-bdb2/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1995 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Versionstr[] = "  bdb2 backend %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/servers/slapd/back-ldbm/Version.c b/servers/slapd/back-ldbm/Version.c
deleted file mode 100644
index caca46b20d..0000000000
--- a/servers/slapd/back-ldbm/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1995 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Versionstr[] = "  ldbm backend %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c
index bd3aabd21f..42baebcea5 100644
--- a/servers/slapd/back-ldbm/modify.c
+++ b/servers/slapd/back-ldbm/modify.c
@@ -6,6 +6,7 @@
 
 #include <ac/string.h>
 #include <ac/socket.h>
+#include <ac/time.h>
 
 #include "slap.h"
 #include "back-ldbm.h"
diff --git a/servers/slapd/back-passwd/Version.c b/servers/slapd/back-passwd/Version.c
deleted file mode 100644
index 99b0fc21a3..0000000000
--- a/servers/slapd/back-passwd/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1995 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Versionstr[] = "  passwd backend %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/servers/slapd/back-perl/Version.c b/servers/slapd/back-perl/Version.c
deleted file mode 100644
index f5341d85f0..0000000000
--- a/servers/slapd/back-perl/Version.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- *   Copyright 1999, John C. Quillan, All rights reserved.
- *
- *   Redistribution and use in source and binary forms are permitted only
- *   as authorized by the OpenLDAP Public License.  A copy of this
- *   license is available at http://www.OpenLDAP.org/license.html or
- *   in file LICENSE in the top-level directory of the distribution.
- */
-
-static char Versionstr[] = "  perl backend %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/servers/slapd/back-shell/Version.c b/servers/slapd/back-shell/Version.c
deleted file mode 100644
index f29d1ee418..0000000000
--- a/servers/slapd/back-shell/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1995 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Versionstr[] = "  shell backend %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/servers/slapd/back-tcl/Version.c b/servers/slapd/back-tcl/Version.c
deleted file mode 100644
index c896e54251..0000000000
--- a/servers/slapd/back-tcl/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $Id: Version.c,v 1.2 1999/02/18 01:18:39 bcollins Exp $
- *
- * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted only
- * as authorized by the OpenLDAP Public License.  A copy of this
- * license is available at http://www.OpenLDAP.org/license.html or
- * in file LICENSE in the top-level directory of the distribution.
- */
-
-static char Versionstr[] =
-
-"  tcl backend %VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c
index bb182993f1..32485beb26 100644
--- a/servers/slapd/daemon.c
+++ b/servers/slapd/daemon.c
@@ -30,15 +30,19 @@ void hit_socket();
 char *WSAGetLastErrorString();
 
 #define WAKE_LISTENER \
+do {\
     if( wake ) {\
         ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );\
         hit_socket();\
-    }
+    }\
+} while(0)
 #else
 #define WAKE_LISTENER \
+do {\
     if( wake ) {\
         ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );\
-    }
+    }\
+} while(0)
 #endif
 
 static int daemon_initialized = 0;
@@ -183,16 +187,16 @@ set_socket( struct sockaddr_in *addr )
 		int	tmp;
 
 		if ( (tcps = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) {
-#ifndef WIN32
+#ifndef HAVE_WINSOCK
 			int err = errno;
 			Debug( LDAP_DEBUG_ANY,
 				"daemon: socket() failed errno %d (%s)\n", err,
 		    	err > -1 && err < sys_nerr ? sys_errlist[err] :
 		    	"unknown", 0 );
-#endif
-#ifdef WIN32
+#else
 			Debug( LDAP_DEBUG_ANY, 
-				"daemon: socket() failed errno %d (%s)\n", WSAGetLastError(),
+				"daemon: socket() failed errno %d (%s)\n",
+				WSAGetLastError(),
 		    	WSAGetLastErrorString(), 0 );
 #endif
 			exit( 1 );
@@ -621,7 +625,8 @@ int slapd_daemon( int inetd, int tcps )
 	connections_init();
 
 #define SLAPD_LISTENER_THREAD 1
-#if SLAPD_LISTENER_THREAD
+#if defined( SLAPD_LISTENER_THREAD ) || !defined(HAVE_PTHREADS)
+
 	/* listener as a separate THREAD */
 	rc = ldap_pvt_thread_create( &listener_tid,
 		0, slapd_daemon_task, args );
@@ -721,7 +726,7 @@ void
 slap_set_shutdown( int sig )
 {
 	slapd_shutdown = sig;
-#ifndef WIN32
+#ifndef HAVE_WINSOCK
 	if(slapd_listener) {
 		ldap_pvt_thread_kill( listener_tid, LDAP_SIGUSR1 );
 	}
diff --git a/servers/slapd/main.c b/servers/slapd/main.c
index 085e7184fa..e1e85ac113 100644
--- a/servers/slapd/main.c
+++ b/servers/slapd/main.c
@@ -25,7 +25,8 @@ static RETSIGTYPE wait4child( int sig );
  */
 
 #ifndef HAVE_MKVERSION
-const char Versionstr[] = "OpenLDAP Standalone LDAP Server (slapd)";
+const char Versionstr[] =
+	OPENLDAP_PACKAGE " " OPENLDAP_VERSION " Standalone LDAP Server (slapd)";
 #endif
 
 #ifdef LOG_LOCAL4
-- 
GitLab