-/* $Id: yaz-proxy-main.cpp,v 1.1 2004-03-29 22:48:31 adam Exp $
+/* $Id: yaz-proxy-main.cpp,v 1.2 2004-03-30 18:14:13 adam Exp $
Copyright (c) 1998-2004, Index Data.
This file is part of the yaz-proxy.
02111-1307, USA.
*/
+#ifdef WIN32
+#else
#include <signal.h>
#include <unistd.h>
#include <pwd.h>
+#endif
#include <sys/types.h>
+
#include <stdarg.h>
#if HAVE_GETRLIMIT
static Yaz_Proxy *static_yaz_proxy = 0;
static void sighup_handler(int num)
{
+#if WIN32
+#else
signal(SIGHUP, sighup_handler);
+#endif
if (static_yaz_proxy)
static_yaz_proxy->reconfig();
}
va_list ap;
va_start(ap, fmt);
+#ifdef WIN32
+ vsprintf(buf, fmt, ap);
+#else
vsnprintf(buf, sizeof(buf), fmt, ap);
-
+#endif
yaz_log(LOG_WARN, "%s: %s", (char*) ctx, buf);
va_end (ap);
static void child_run(Yaz_SocketManager *m, int run)
{
+#ifdef WIN32
+#else
signal(SIGHUP, sighup_handler);
+#endif
#if HAVE_XSLT
xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
#endif
+#ifdef WIN32
+#else
yaz_log(LOG_LOG, "0 proxy run=%d pid=%ld", run, (long) getpid());
-
+#endif
if (no_limit_files)
{
#if HAVE_SETRLIMIT
yaz_log(LOG_WARN, "setrlimit unavablable. Option -n ignored");
#endif
}
+#ifdef WIN32
+#else
if (pid_fname)
{
FILE *f = fopen(pid_fname, "w");
}
xfree(uid);
}
+#endif
#if HAVE_GETRLIMIT
struct rlimit limit_data;
getrlimit(RLIMIT_NOFILE, &limit_data);
args(&proxy, argc, argv);
+#ifdef WIN32
+ child_run(&mySocketManager, run);
+#else
if (debug)
{
child_run(&mySocketManager, run);
sleep(1 + run/5);
run++;
}
+#endif
exit (0);
return 0;
}