for Microsoft WIN32.
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D WINDOWS=1 /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x406 /d "NDEBUG"
# ADD RSC /l 0x406 /d "NDEBUG"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D WINDOWS=1 /FR /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x406 /d "_DEBUG"
# ADD RSC /l 0x406 /d "_DEBUG"
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: tcpip.c,v $
- * Revision 1.26 1999-01-08 11:23:14 adam
+ * Revision 1.27 1999-02-02 13:57:31 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.26 1999/01/08 11:23:14 adam
* Added const modifier to some of the BER/ODR encoding routines.
*
* Revision 1.25 1998/07/07 15:49:23 adam
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#ifndef WINDOWS
+#ifndef WIN32
#include <unistd.h>
#endif
#include <errno.h>
char buf[128]; /* returned by cs_addrstr */
} tcpip_state;
-#ifdef WINDOWS
+#ifdef WIN32
static int tcpip_init (void)
{
static int initialized = 0;
COMSTACK p;
tcpip_state *state;
int new_socket;
-#ifdef WINDOWS
+#ifdef WIN32
unsigned long tru = 1;
#else
struct protoent *proto;
return 0;
if (s < 0)
{
-#ifndef WINDOWS
+#ifndef WIN32
if (!(proto = getprotobyname("tcp")))
return 0;
if ((s = socket(AF_INET, SOCK_STREAM, proto->p_proto)) < 0)
xmalloc(sizeof(tcpip_state)))))
return 0;
-#ifdef WINDOWS
+#ifdef WIN32
if (!(p->blocking = blocking) && ioctlsocket(s, FIONBIO, &tru) < 0)
#else
if (!(p->blocking = blocking) && fcntl(s, F_SETFL, O_NONBLOCK) < 0)
TRC(fprintf(stderr, "tcpip_connect\n"));
if (connect(h->iofile, (struct sockaddr *) add, sizeof(*add)) < 0)
{
-#ifdef WINDOWS
+#ifdef WIN32
if (WSAGetLastError() == WSAEWOULDBLOCK)
#else
if (errno == EINPROGRESS)
int tcpip_bind(COMSTACK h, void *address, int mode)
{
struct sockaddr *addr = (struct sockaddr *)address;
-#ifdef WINDOWS
+#ifdef WIN32
BOOL one = 1;
#else
unsigned long one = 1;
}
if ((h->newfd = accept(h->iofile, (struct sockaddr*)&addr, &len)) < 0)
{
-#ifdef WINDOWS
+#ifdef WIN32
if (WSAGetLastError() == WSAEWOULDBLOCK)
#else
if (errno == EWOULDBLOCK)
sizeof(addr.sin_addr), AF_INET))
{
h->cerrno = CSDENY;
-#ifdef WINDOWS
+#ifdef WIN32
closesocket(h->iofile);
#else
close(h->iofile);
{
COMSTACK cnew;
tcpip_state *state, *st = (tcpip_state *)h->cprivate;
-#ifdef WINDOWS
+#ifdef WIN32
unsigned long tru = 1;
#endif
h->cerrno = CSYSERR;
return 0;
}
-#ifdef WINDOWS
+#ifdef WIN32
if (!cnew->blocking && ioctlsocket(cnew->iofile, FIONBIO, &tru) < 0)
#else
if (!cnew->blocking && fcntl(cnew->iofile, F_SETFL, O_NONBLOCK) < 0)
return -1;
if ((res = recv(h->iofile, *buf + hasread, CS_TCPIP_BUFCHUNK, 0)) < 0)
{
-#ifdef WINDOWS
+#ifdef WIN32
if (WSAGetLastError() == WSAEWOULDBLOCK)
#else
#ifdef EINPROGRESS
if ((res = send(h->iofile, buf + state->written, size -
state->written, 0)) < 0)
{
-#ifdef WINDOWS
+#ifdef WIN32
if (WSAGetLastError() == WSAEWOULDBLOCK)
#else
if (errno == EAGAIN)
TRC(fprintf(stderr, "tcpip_close\n"));
if (h->iofile != -1)
-#ifdef WINDOWS
+#ifdef WIN32
closesocket(h->iofile);
#else
close(h->iofile);
/*
- * Copyright (c) 1995-1998, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation, in whole or in part, for any purpose, is hereby granted,
* OF THIS SOFTWARE.
*
* $Log: statserv.h,v $
- * Revision 1.13 1998-02-10 10:28:56 adam
+ * Revision 1.14 1999-02-02 13:57:32 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.13 1998/02/10 10:28:56 adam
* Added app_name, service_dependencies, service_display_name and
* options_func. options_func allows us to specify a different function
* to interogate the command line arguments. The other members allow us
int (*options_func)(int argc, char **argv);
int inetd; /* Do we use the inet deamon or not */
-#ifdef WINDOWS
+#ifdef WIN32
/* We only have these members for the windows version */
/* They seemed a bit large to have them there in general */
char service_name[128]; /* NT Service Name */
char app_name[128]; /* Application Name */
char service_dependencies[128]; /* The services we are dependent on */
char service_display_name[128]; /* The service display name */
-#endif /* WINDOWS */
+#endif /* WIN32 */
} statserv_options_block;
int statserv_main(int argc, char **argv);
#ifndef _VMS_
-#ifdef WINDOWS
+#ifdef WIN32
#ifdef YNETINCLUDE
#include <winsock.h>
#endif
-#else /* #ifdef WINDOWS */
+#else /* #ifdef WIN32 */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
#endif /* ifndef _VMS_ */
#ifndef YAZ_EXPORT
-#ifdef WINDOWS
+#ifdef WIN32
#define YAZ_EXPORT __declspec(dllexport)
#else
#define YAZ_EXPORT
#endif
#endif
-#ifdef WINDOWS
+#ifdef WIN32
#define MDF
#else
#ifndef MDF
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: eventl.c,v $
- * Revision 1.26 1998-02-11 11:53:35 adam
+ * Revision 1.27 1999-02-02 13:57:34 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.26 1998/02/11 11:53:35 adam
* Changed code so that it compiles as C++.
*
* Revision 1.25 1998/01/29 13:30:23 adam
#include <yconfig.h>
#include <stdio.h>
#include <assert.h>
-#ifdef WINDOWS
+#ifdef WIN32
#include <winsock.h>
#else
#include <unistd.h>
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "WINDOWS" /FR /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
* Based on code written by
* Chas Woodfield, Fretwell Downing Datasystems.
* $Log: service.c,v $
- * Revision 1.1 1997-11-07 13:31:52 adam
+ * Revision 1.2 1999-02-02 13:57:36 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.1 1997/11/07 13:31:52 adam
* Added NT Service name part of statserv_options_block. Moved NT
* service utility to server library.
*
/* For some strange reason it won't work when part of a lib */
/************************************************************/
-#ifdef WINDOWS
+#ifdef WIN32
#include <windows.h>
#include <stdio.h>
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.85 1998-11-17 09:52:59 adam
+ * Revision 1.86 1999-02-02 13:57:38 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.85 1998/11/17 09:52:59 adam
* Fixed minor bug (introduced by previous commit).
*
* Revision 1.84 1998/11/16 16:02:32 adam
#include <yconfig.h>
#include <stdlib.h>
#include <stdio.h>
-#ifdef WINDOWS
+#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
/*
- * Copyright (c) 1995-1998, Index Data
+ * Copyright (c) 1995-1999, Index Data
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* Chas Woodfield, Fretwell Downing Datasystems.
*
* $Log: statserv.c,v $
- * Revision 1.52 1998-08-21 14:13:34 adam
+ * Revision 1.53 1999-02-02 13:57:39 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.52 1998/08/21 14:13:34 adam
* Added GNU Configure script to build Makefiles.
*
* Revision 1.51 1998/07/07 15:51:03 adam
#include <yconfig.h>
#include <stdio.h>
#include <string.h>
-#ifdef WINDOWS
+#ifdef WIN32
#include <process.h>
#include <winsock.h>
#include <direct.h>
check_options, /* Default routine, for checking the run-time arguments */
0 /* default value for inet deamon */
-#ifdef WINDOWS
+#ifdef WIN32
,"Z39.50 Server", /* NT Service Name */
"Server", /* NT application Name */
"", /* NT Service Dependencies */
"Z39.50 Server" /* NT Service Display Name */
-#endif /* WINDOWS */
+#endif /* WIN32 */
};
/*
* doing all of the listening and accepting in the parent - it's
* safer that way.
*/
-#ifdef WINDOWS
+#ifdef WIN32
typedef struct _ThreadList ThreadList;
logf(LOG_DEBUG, "Setting timeout %d", control_block.idle_timeout);
iochan_setdata(new_chan, newas);
iochan_settimeout(new_chan, control_block.idle_timeout * 60);
-#ifndef WINDOWS
+#ifndef WIN32
logf(LOG_DEBUG, "Determining client address");
a = cs_addrstr(new_line);
logf(LOG_LOG, "Accepted connection from %s", a ? a : "[Unknown]");
}
}
-#else /* WINDOWS */
+#else /* WIN32 */
/* To save having an #ifdef in event_loop we need to define this empty function */
void statserv_remove(IOCHAN pIOChannel)
}
}
-#endif /* WINDOWS */
+#endif /* WIN32 */
static void inetd_connection(int what)
{
pListener = lst;
}
-#ifndef WINDOWS
+#ifndef WIN32
/* For windows we don't need to catch the signals */
static void catchchld(int num)
{
;
signal(SIGCHLD, catchchld);
}
-#endif /* WINDOWS */
+#endif /* WIN32 */
statserv_options_block *statserv_getcontrol(void)
{
int ret;
nmem_init ();
-#ifdef WINDOWS
+#ifdef WIN32
/* We need to initialize the thread list */
ThreadList_Initialize();
-#endif /* WINDOWS */
+#endif /* WIN32 */
-#ifdef WINDOWS
+#ifdef WIN32
if ((me = strrchr (argv[0], '\\')))
me++;
else
if (control_block.options_func(argc, argv))
return(1);
-#ifndef WINDOWS
+#ifndef WIN32
if (control_block.inetd)
inetd_connection(control_block.default_proto);
else
exit(1);
}
}
-#endif /* WINDOWS */
+#endif /* WIN32 */
if ((pListener == NULL) && *control_block.default_listen)
add_listener(control_block.default_listen,
return 0;
}
-#ifdef WINDOWS
+#ifdef WIN32
typedef struct _Args
{
char **argv;
/*
- * Copyright (c) 1995-1998, Index Data.
+ * Copyright (c) 1995-1999, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: nmem.c,v $
- * Revision 1.13 1998-10-19 15:24:21 adam
+ * Revision 1.14 1999-02-02 13:57:40 adam
+ * Uses preprocessor define WIN32 instead of WINDOWS to build code
+ * for Microsoft WIN32.
+ *
+ * Revision 1.13 1998/10/19 15:24:21 adam
* New nmem utility, nmem_transfer, that transfer blocks from one
* NMEM to another.
*
* allocation. Evemtually we'll put in something better.
*/
+#include <assert.h>
#include <xmalloc.h>
#include <nmem.h>
#include <log.h>
-#ifdef WINDOWS
+#ifdef WIN32
#include <windows.h>
#elif _REENTRANT
#define NMEM_CHUNK (4*1024)
-#ifdef WINDOWS
+#ifdef WIN32
static CRITICAL_SECTION critical_section;
#define NMEM_ENTER EnterCriticalSection(&critical_section)
#define NMEM_LEAVE LeaveCriticalSection(&critical_section)
static nmem_block *freelist = NULL; /* "global" freelists */
static nmem_control *cfreelist = NULL;
static int nmem_active_no = 0;
+static int nmem_init_flag = 0;
static void free_block(nmem_block *p)
{
#endif
if (!n)
return xmalloc(size);
+ assert (nmem_init_flag);
NMEM_ENTER;
p = n->blocks;
if (!p || p->size - p->top < size)
void nmem_init (void)
{
-#ifdef WINDOWS
+ nmem_init_flag = 1;
+#ifdef WIN32
InitializeCriticalSection(&critical_section);
#endif
nmem_active_no = 0;
cfreelist = cfreelist->next;
xfree (cfl);
}
-#ifdef WINDOWS
+#ifdef WIN32
DeleteCriticalSection(&critical_section);
#endif
}
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINDOWS=1 /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
TargetName=yaz
SOURCE=$(InputPath)
PostBuild_Desc=Copy Lib and Dll
-PostBuild_Cmds=copy $(OutDir)\$(TargetName).lib $(ProjDir)\lib copy\
- $(OutDir)\$(TargetName).dll $(ProjDir)\..\bin
+PostBuild_Cmds=copy $(OutDir)\$(TargetName).dll $(ProjDir)\..\bin
# End Special Build Tool
!ELSEIF "$(CFG)" == "yaz - Win32 Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINDOWS=1 /FR /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
ProjDir=.
TargetName=yaz
SOURCE=$(InputPath)
-PostBuild_Desc=Copy Lib and Dll
-PostBuild_Cmds=copy $(OutDir)\$(TargetName).lib $(ProjDir)\lib copy\
- $(OutDir)\$(TargetName).dll $(ProjDir)\..\bin
+PostBuild_Desc=Copy Dll
+PostBuild_Cmds=copy $(OutDir)\$(TargetName).dll $(ProjDir)\..\bin
# End Special Build Tool
!ENDIF
# Microsoft Developer Studio Project File - Name="ztest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
!MESSAGE
# Begin Project
-# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WINDOWS" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x406 /d "NDEBUG"
# ADD RSC /l 0x406 /d "NDEBUG"
OutDir=.\Release
ProjDir=.
TargetName=ztest
-SOURCE="$(InputPath)"
+SOURCE=$(InputPath)
PostBuild_Desc=Copy ztest.exe
PostBuild_Cmds=copy $(OutDir)\$(TargetName).exe $(ProjDir)\..\..\bin
# End Special Build Tool
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WINDOWS" /FR /FD /c
-# SUBTRACT CPP /YX
+# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /c
# ADD BASE RSC /l 0x406 /d "_DEBUG"
# ADD RSC /l 0x406 /d "_DEBUG"
BSC32=bscmake.exe
OutDir=.\Debug
ProjDir=.
TargetName=ztest
-SOURCE="$(InputPath)"
+SOURCE=$(InputPath)
PostBuild_Desc=Copy ztest.exe
PostBuild_Cmds=copy $(OutDir)\$(TargetName).exe $(ProjDir)\..\..\bin
# End Special Build Tool