Removed away include of system headers in comstack.h. Instead
authorAdam Dickmeiss <adam@indexdata.dk>
Sun, 16 Jan 2005 21:51:49 +0000 (21:51 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Sun, 16 Jan 2005 21:51:49 +0000 (21:51 +0000)
include them in the various implementation C files.
Added more headers in AC_CHECK_HEADERS.

12 files changed:
client/admin.c
client/bertorture.c
configure.in
include/yaz/comstack.h
include/yaz/xmalloc.h
src/ber_int.c
src/seshigh.c
src/session.h
src/statserv.c
src/tcpdchk.c
src/tcpip.c
src/unix.c

index 0ac0faa..5d28af8 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: admin.c,v 1.18 2005-01-15 19:47:08 adam Exp $
+ * $Id: admin.c,v 1.19 2005-01-16 21:51:49 adam Exp $
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
 #include <time.h>
 #include <assert.h>
 
 #include <time.h>
 #include <assert.h>
 
-#if HAVE_FNMATCH_H
+#if HAVE_DIRENT_H
 #include <dirent.h>
 #include <dirent.h>
+#endif
+#if HAVE_FNMATCH_H
 #include <fnmatch.h>
 #include <fnmatch.h>
+#endif
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
 
 #include <sys/stat.h>
 #endif
 
index 936602a..79db2d2 100644 (file)
@@ -2,14 +2,21 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: bertorture.c,v 1.2 2005-01-15 19:47:08 adam Exp $
+ * $Id: bertorture.c,v 1.3 2005-01-16 21:51:49 adam Exp $
  */
 
 #include <signal.h>
  */
 
 #include <signal.h>
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #include <sys/stat.h>
+#endif
 #include <fcntl.h>
 #include <fcntl.h>
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #include <unistd.h>
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 
 #include <stdlib.h>
 #include <stdio.h>
 
index 22f68b6..b876887 100644 (file)
@@ -1,6 +1,6 @@
 dnl YAZ Toolkit, Index Data 1994-2005
 dnl See the file LICENSE for details.
 dnl YAZ Toolkit, Index Data 1994-2005
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.167 2005-01-11 12:13:18 adam Exp $
+dnl $Id: configure.in,v 1.168 2005-01-16 21:51:49 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 2.0.32)
 AM_MAINTAINER_MODE
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 2.0.32)
 AM_MAINTAINER_MODE
@@ -21,7 +21,7 @@ YAZ_DOC
 dnl 
 dnl
 dnl ------ Headers
 dnl 
 dnl
 dnl ------ Headers
-AC_CHECK_HEADERS(fnmatch.h wchar.h locale.h langinfo.h)
+AC_CHECK_HEADERS(dirent.h fnmatch.h wchar.h locale.h langinfo.h pwd.h sys/poll.h sys/select.h sys/socket.h sys/stat.h sys/time.h sys/types.h sys/un.h sys/wait.h unistd.h)
 AC_HEADER_STDC
 if test "$ac_cv_header_stdc" = "no"; then
        AC_MSG_WARN(Your system doesn't seem to support ANSI C)
 AC_HEADER_STDC
 if test "$ac_cv_header_stdc" = "no"; then
        AC_MSG_WARN(Your system doesn't seem to support ANSI C)
index f847b50..d03e987 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: comstack.h,v 1.18 2005-01-15 19:47:09 adam Exp $
+ * $Id: comstack.h,v 1.19 2005-01-16 21:51:49 adam Exp $
  */
 
 /** 
  */
 
 /** 
 #define COMSTACK_H
 
 #include <yaz/yconfig.h>
 #define COMSTACK_H
 
 #include <yaz/yconfig.h>
-
-#ifndef _VMS_
-
-# ifdef WIN32
-
-#  include <winsock.h>
-
-# else /* #ifdef WIN32 */
-#  include <sys/types.h>
-#  include <sys/time.h>
-#  include <sys/wait.h>
-
-#  include <netinet/in.h>
-#  include <sys/socket.h>
-#  include <netdb.h>
-#  include <arpa/inet.h>
-
-#  ifdef _AIX
-#   include <sys/select.h>
-#  endif
-
-#  ifndef O_BINARY
-#   define O_BINARY 0
-#  endif
-
-# endif
-#endif /* ifndef _VMS_ */
-
 #include <yaz/oid.h>
 #include <yaz/xmalloc.h>
 
 #include <yaz/oid.h>
 #include <yaz/xmalloc.h>
 
index 61f2485..7a8bd6e 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: xmalloc.h,v 1.5 2005-01-15 19:47:10 adam Exp $
+ * $Id: xmalloc.h,v 1.6 2005-01-16 21:51:49 adam Exp $
  */
 /**
  * \file xmalloc.h
  */
 /**
  * \file xmalloc.h
@@ -33,8 +33,7 @@
 #ifndef XMALLOC_H
 #define XMALLOC_H
 
 #ifndef XMALLOC_H
 #define XMALLOC_H
 
-#include <sys/types.h>
-#include <stdlib.h>
+#include <stddef.h>
 
 #include <yaz/yconfig.h>
 
 
 #include <yaz/yconfig.h>
 
index a05c240..fc89b0d 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_int.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_int.c,v 1.4 2005-01-16 21:51:50 adam Exp $
  */
 
 /** 
  */
 
 /** 
 
 #include <string.h>
 
 
 #include <string.h>
 
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
 #ifdef WIN32
 #include <winsock.h>
 #else
 #ifdef WIN32
 #include <winsock.h>
 #else
-#include <sys/types.h>
 #include <netinet/in.h>
 #endif
 
 #include <netinet/in.h>
 #endif
 
@@ -37,20 +40,22 @@ int ber_integer(ODR o, int *val)
 
     switch (o->direction)
     {
 
     switch (o->direction)
     {
-        case ODR_DECODE:
-            if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
-            {
-                odr_seterror(o, OPROTO, 50);
-                return 0;
-            }
-            o->bp += res;
-            return 1;
-        case ODR_ENCODE:
-            if ((res = ber_encinteger(o, *val)) < 0)
-                return 0;
-            return 1;
-        case ODR_PRINT: return 1;
-        default: odr_seterror(o, OOTHER, 51);  return 0;
+    case ODR_DECODE:
+       if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
+       {
+           odr_seterror(o, OPROTO, 50);
+           return 0;
+       }
+       o->bp += res;
+       return 1;
+    case ODR_ENCODE:
+       if ((res = ber_encinteger(o, *val)) < 0)
+           return 0;
+       return 1;
+    case ODR_PRINT:
+       return 1;
+    default:
+       odr_seterror(o, OOTHER, 51);  return 0;
     }
 }
 
     }
 }
 
index 0e70919..105dbe9 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: seshigh.c,v 1.44 2005-01-15 19:47:14 adam Exp $
+ * $Id: seshigh.c,v 1.45 2005-01-16 21:51:50 adam Exp $
  */
 /**
  * \file seshigh.c
  */
 /**
  * \file seshigh.c
 
 #include <stdlib.h>
 #include <stdio.h>
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <assert.h>
+#include <ctype.h>
+
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 #ifdef WIN32
 #include <io.h>
 #define S_ISREG(x) (x & _S_IFREG)
 #include <process.h>
 #ifdef WIN32
 #include <io.h>
 #define S_ISREG(x) (x & _S_IFREG)
 #include <process.h>
-#include <sys/stat.h>
-#else
-#include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <unistd.h>
 #endif
-#include <assert.h>
-#include <ctype.h>
 
 #include <yaz/yconfig.h>
 #include <yaz/xmalloc.h>
 
 #include <yaz/yconfig.h>
 #include <yaz/xmalloc.h>
@@ -1577,7 +1584,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
                 assoc->init->implementation_name,
                 odr_prepend(assoc->encode, "GFS", resp->implementationName));
 
                 assoc->init->implementation_name,
                 odr_prepend(assoc->encode, "GFS", resp->implementationName));
 
-    version = odr_strdup(assoc->encode, "$Revision: 1.44 $");
+    version = odr_strdup(assoc->encode, "$Revision: 1.45 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     resp->implementationVersion = odr_prepend(assoc->encode,
index 071318d..77919fb 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: session.h,v 1.3 2005-01-15 19:47:14 adam Exp $
+ * $Id: session.h,v 1.4 2005-01-16 21:51:50 adam Exp $
  */
 /**
  * \file session.h
  */
 /**
  * \file session.h
@@ -11,7 +11,6 @@
 #ifndef SESSION_H
 #define SESSION_H
 
 #ifndef SESSION_H
 #define SESSION_H
 
-#include <sys/types.h>
 #include <yaz/comstack.h>
 #include <yaz/odr.h>
 #include <yaz/oid.h>
 #include <yaz/comstack.h>
 #include <yaz/odr.h>
 #include <yaz/oid.h>
index ef149ac..17f27b7 100644 (file)
@@ -5,7 +5,7 @@
  * NT threaded server code by
  *   Chas Woodfield, Fretwell Downing Informatics.
  *
  * NT threaded server code by
  *   Chas Woodfield, Fretwell Downing Informatics.
  *
- * $Id: statserv.c,v 1.18 2005-01-15 19:47:14 adam Exp $
+ * $Id: statserv.c,v 1.19 2005-01-16 21:51:50 adam Exp $
  */
 
 /**
  */
 
 /**
 #include <winsock.h>
 #include <direct.h>
 #include "service.h"
 #include <winsock.h>
 #include <direct.h>
 #include "service.h"
-#else
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #include <unistd.h>
+#endif
+#if HAVE_PWD_H
 #include <pwd.h>
 #endif
 
 #include <pwd.h>
 #endif
 
@@ -93,18 +102,18 @@ statserv_options_block control_block = {
 
 static int max_sessions = 0;
 
 
 static int max_sessions = 0;
 
-static int logbits_set=0;
-static int log_session=0;
-static int log_server=0;
+static int logbits_set = 0;
+static int log_session = 0;
+static int log_server = 0;
 
 /** get_logbits sets global loglevel bits */
 static void get_logbits(int force)
 { /* needs to be called after parsing cmd-line args that can set loglevels!*/
     if (force || !logbits_set)
     {
 
 /** get_logbits sets global loglevel bits */
 static void get_logbits(int force)
 { /* needs to be called after parsing cmd-line args that can set loglevels!*/
     if (force || !logbits_set)
     {
-        logbits_set=1;
-        log_session=yaz_log_module_level("session");
-        log_server=yaz_log_module_level("server");
+        logbits_set = 1;
+        log_session = yaz_log_module_level("session");
+        log_server = yaz_log_module_level("server");
     }
 }
 
     }
 }
 
@@ -683,15 +692,15 @@ int statserv_start(int argc, char **argv)
 #endif
     
 #ifdef WIN32
 #endif
     
 #ifdef WIN32
-    sep='\\';
+    sep = '\\';
 #else
 #else
-    sep='/';
+    sep = '/';
 #endif
     if ((me = strrchr (argv[0], sep)))
        me++; /* get the basename */
     else
        me = argv[0];
 #endif
     if ((me = strrchr (argv[0], sep)))
        me++; /* get the basename */
     else
        me = argv[0];
-    programname=argv[0];
+    programname = argv[0];
 
     if (control_block.options_func(argc, argv))
         return(1);
 
     if (control_block.options_func(argc, argv))
         return(1);
index 841d897..93a80b8 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tcpdchk.c,v 1.5 2005-01-15 19:47:14 adam Exp $
+ * $Id: tcpdchk.c,v 1.6 2005-01-16 21:51:50 adam Exp $
  */
 /**
  * \file tcpdchk.c
  */
 /**
  * \file tcpdchk.c
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
 
+#ifdef WIN32
+#include <winsock.h>
+#else
+#include <netdb.h>
+#include <arpa/inet.h>
+#endif
+
 #include <yaz/yconfig.h>
 #include <yaz/comstack.h>
 #include <yaz/statserv.h>
 #include <yaz/yconfig.h>
 #include <yaz/comstack.h>
 #include <yaz/statserv.h>
@@ -22,7 +29,6 @@
 #include <syslog.h>
 #include <tcpd.h>
 
 #include <syslog.h>
 #include <tcpd.h>
 
-
 int allow_severity = LOG_INFO;  /* not YLOG !! */
 int deny_severity = LOG_WARNING;
 
 int allow_severity = LOG_INFO;  /* not YLOG !! */
 int deny_severity = LOG_WARNING;
 
index 92c9b39..f13b90b 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tcpip.c,v 1.13 2005-01-15 19:47:14 adam Exp $
+ * $Id: tcpip.c,v 1.14 2005-01-16 21:51:50 adam Exp $
  */
 /**
  * \file tcpip.c
  */
 /**
  * \file tcpip.c
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #ifdef WIN32
 
 #ifdef WIN32
+#include <winsock.h>
 #else
 #else
-#include <unistd.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <netinet/tcp.h>
+#endif
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
 #endif
 
 #endif
 
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
 #if HAVE_OPENSSL_SSL_H
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 #if HAVE_OPENSSL_SSL_H
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 #include <yaz/tcpip.h>
 #include <yaz/nmem.h>
 
 #include <yaz/tcpip.h>
 #include <yaz/nmem.h>
 
-#ifdef WIN32
-#else
-#include <netinet/tcp.h>
-#endif
-
 static int tcpip_close(COMSTACK h);
 static int tcpip_put(COMSTACK h, char *buf, int size);
 static int tcpip_get(COMSTACK h, char **buf, int *bufsize);
 static int tcpip_close(COMSTACK h);
 static int tcpip_put(COMSTACK h, char *buf, int size);
 static int tcpip_get(COMSTACK h, char **buf, int *bufsize);
index 194b445..da80f53 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: unix.c,v 1.8 2005-01-15 19:47:14 adam Exp $
+ * $Id: unix.c,v 1.9 2005-01-16 21:51:50 adam Exp $
  * UNIX socket COMSTACK. By Morten Bøgeskov.
  */
 /**
  * UNIX socket COMSTACK. By Morten Bøgeskov.
  */
 /**
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <errno.h>
 #include <errno.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <signal.h>
 
 #include <grp.h>
 #include <fcntl.h>
 #include <signal.h>
 
 #include <grp.h>
+#if HAVE_PWD_H
 #include <pwd.h>
 #include <pwd.h>
+#endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #include <sys/types.h>
+#endif
 
 
+#if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #include <sys/socket.h>
+#endif
+#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #include <sys/stat.h>
+#endif
+#if HAVE_SYS_UN_H
 #include <sys/un.h>
 #include <sys/un.h>
+#endif
 
 
-#include <yaz/comstack.h>
 #include <yaz/unix.h>
 #include <yaz/nmem.h>
 
 #include <yaz/unix.h>
 #include <yaz/nmem.h>
 
@@ -699,4 +710,4 @@ static int unix_set_blocking(COMSTACK p, int blocking)
     p->blocking = blocking;
     return 1;
 }
     p->blocking = blocking;
     return 1;
 }
-#endif
+#endif /* WIN32 */