From 825d22351b1d59c71e98357b4931bf7bb67daa3a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sun, 16 Jan 2005 21:51:49 +0000 Subject: [PATCH] Removed away include of system headers in comstack.h. Instead include them in the various implementation C files. Added more headers in AC_CHECK_HEADERS. --- client/admin.c | 8 ++++++-- client/bertorture.c | 9 ++++++++- configure.in | 4 ++-- include/yaz/comstack.h | 30 +----------------------------- include/yaz/xmalloc.h | 5 ++--- src/ber_int.c | 37 +++++++++++++++++++++---------------- src/seshigh.c | 21 ++++++++++++++------- src/session.h | 3 +-- src/statserv.c | 31 ++++++++++++++++++++----------- src/tcpdchk.c | 10 ++++++++-- src/tcpip.c | 38 ++++++++++++++++++++++++++++---------- src/unix.c | 19 +++++++++++++++---- 12 files changed, 126 insertions(+), 89 deletions(-) diff --git a/client/admin.c b/client/admin.c index 0ac0faa..5d28af8 100644 --- a/client/admin.c +++ b/client/admin.c @@ -2,7 +2,7 @@ * 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 @@ -10,9 +10,13 @@ #include #include -#if HAVE_FNMATCH_H +#if HAVE_DIRENT_H #include +#endif +#if HAVE_FNMATCH_H #include +#endif +#if HAVE_SYS_STAT_H #include #endif diff --git a/client/bertorture.c b/client/bertorture.c index 936602a..79db2d2 100644 --- a/client/bertorture.c +++ b/client/bertorture.c @@ -2,14 +2,21 @@ * 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 +#if HAVE_SYS_TYPES_H #include +#endif +#if HAVE_SYS_STAT_H #include +#endif #include +#if HAVE_UNISTD_H #include +#endif + #include #include diff --git a/configure.in b/configure.in index 22f68b6..b876887 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ 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 @@ -21,7 +21,7 @@ YAZ_DOC 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) diff --git a/include/yaz/comstack.h b/include/yaz/comstack.h index f847b50..d03e987 100644 --- a/include/yaz/comstack.h +++ b/include/yaz/comstack.h @@ -23,7 +23,7 @@ * 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 $ */ /** @@ -35,34 +35,6 @@ #define COMSTACK_H #include - -#ifndef _VMS_ - -# ifdef WIN32 - -# include - -# else /* #ifdef WIN32 */ -# include -# include -# include - -# include -# include -# include -# include - -# ifdef _AIX -# include -# endif - -# ifndef O_BINARY -# define O_BINARY 0 -# endif - -# endif -#endif /* ifndef _VMS_ */ - #include #include diff --git a/include/yaz/xmalloc.h b/include/yaz/xmalloc.h index 61f2485..7a8bd6e 100644 --- a/include/yaz/xmalloc.h +++ b/include/yaz/xmalloc.h @@ -23,7 +23,7 @@ * 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 @@ -33,8 +33,7 @@ #ifndef XMALLOC_H #define XMALLOC_H -#include -#include +#include #include diff --git a/src/ber_int.c b/src/ber_int.c index a05c240..fc89b0d 100644 --- a/src/ber_int.c +++ b/src/ber_int.c @@ -2,7 +2,7 @@ * 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 $ */ /** @@ -19,10 +19,13 @@ #include +#if HAVE_SYS_TYPES_H +#include +#endif + #ifdef WIN32 #include #else -#include #include #endif @@ -37,20 +40,22 @@ int ber_integer(ODR o, int *val) 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; } } diff --git a/src/seshigh.c b/src/seshigh.c index 0e70919..105dbe9 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * 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 @@ -30,18 +30,25 @@ #include #include +#include +#include + +#if HAVE_SYS_TYPES_H #include +#endif +#if HAVE_SYS_STAT_H +#include +#endif + #ifdef WIN32 #include #define S_ISREG(x) (x & _S_IFREG) #include -#include -#else -#include +#endif + +#if HAVE_UNISTD_H #include #endif -#include -#include #include #include @@ -1577,7 +1584,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) 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, diff --git a/src/session.h b/src/session.h index 071318d..77919fb 100644 --- a/src/session.h +++ b/src/session.h @@ -2,7 +2,7 @@ * 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 @@ -11,7 +11,6 @@ #ifndef SESSION_H #define SESSION_H -#include #include #include #include diff --git a/src/statserv.c b/src/statserv.c index ef149ac..17f27b7 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -5,7 +5,7 @@ * 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 $ */ /** @@ -20,8 +20,17 @@ #include #include #include "service.h" -#else +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_WAIT_H +#include +#endif +#if HAVE_UNISTD_H #include +#endif +#if HAVE_PWD_H #include #endif @@ -93,18 +102,18 @@ statserv_options_block control_block = { 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) { - 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 - sep='\\'; + sep = '\\'; #else - sep='/'; + sep = '/'; #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); diff --git a/src/tcpdchk.c b/src/tcpdchk.c index 841d897..93a80b8 100644 --- a/src/tcpdchk.c +++ b/src/tcpdchk.c @@ -2,7 +2,7 @@ * 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 @@ -12,6 +12,13 @@ #include #include +#ifdef WIN32 +#include +#else +#include +#include +#endif + #include #include #include @@ -22,7 +29,6 @@ #include #include - int allow_severity = LOG_INFO; /* not YLOG !! */ int deny_severity = LOG_WARNING; diff --git a/src/tcpip.c b/src/tcpip.c index 92c9b39..f13b90b 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -2,7 +2,7 @@ * 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 @@ -12,15 +12,38 @@ #include #include #include +#include +#include +#include +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_TIME_H +#include +#endif +#if HAVE_UNISTD_H +#include +#endif #ifdef WIN32 +#include #else -#include +#include +#include +#include +#include +#endif + +#if HAVE_SYS_SOCKET_H +#include +#endif +#if HAVE_SYS_SELECT_H +#include +#endif +#if HAVE_SYS_WAIT_H +#include #endif -#include -#include -#include #if HAVE_OPENSSL_SSL_H #include #include @@ -30,11 +53,6 @@ #include #include -#ifdef WIN32 -#else -#include -#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); diff --git a/src/unix.c b/src/unix.c index 194b445..da80f53 100644 --- a/src/unix.c +++ b/src/unix.c @@ -2,7 +2,7 @@ * 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. */ /** @@ -15,20 +15,31 @@ #include #include #include -#include #include +#if HAVE_UNISTD_H +#include +#endif #include #include #include +#if HAVE_PWD_H #include +#endif +#if HAVE_SYS_TYPES_H #include +#endif +#if HAVE_SYS_SOCKET_H #include +#endif +#if HAVE_SYS_STAT_H #include +#endif +#if HAVE_SYS_UN_H #include +#endif -#include #include #include @@ -699,4 +710,4 @@ static int unix_set_blocking(COMSTACK p, int blocking) p->blocking = blocking; return 1; } -#endif +#endif /* WIN32 */ -- 1.7.10.4