include Makefiles/Platforms/watcom.mk
EXEC_SUFFIX=.exe
SERVER =
+RCLI =
PLATFORM_P = `uname -p | sed -E "s/[ \\(\\)]/-/g"`
LINK_LIB = ../Library/$(STATICLIB_PREFIX)dataworks$(STATICLIB_SUFFIX)
SERVER = ./Server
+RCLI = ./RemoteClient
SERVER_MODULE = tcpip.o
RCLI_MODULE = tcpip.o
VERSION = `cat Library/dataworks.c | grep " dataworks_version " | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?'`
# $Id$
-.PHONY: all no-doc replace format clean ./Library ./Client ./Document ./Grammar ./Package/PKGBUILD archive archive-prepare archive-cleanup archive-targz archive-zip dosbox prepare-dosbox dosbox-x cleanup-dosbox get-version
+.PHONY: all no-doc replace format clean ./Library ./Client ./Document ./Grammar ./RemoteClient ./Package/PKGBUILD archive archive-prepare archive-cleanup archive-targz archive-zip dosbox prepare-dosbox dosbox-x cleanup-dosbox get-version
-all: ./Grammar ./Library ./Client $(SERVER) ./Document
+all: ./Grammar ./Library ./Client $(SERVER) $(RCLI) ./Document
-no-doc: ./Grammar ./Library ./Client $(SERVER)
+no-doc: ./Grammar ./Library ./Client $(SERVER) $(RCLI)
./Grammar::
$(MAKE) -C $@ $(COMPILE_FLAGS)
./Server:: ./Library
$(MAKE) -C $@ $(COMPILE_FLAGS)
+./RemoteClient:: ./Library
+ $(MAKE) -C $@ $(COMPILE_FLAGS)
+
./Document::
$(MAKE) -C ./Document $(COMPILE_FLAGS)
rm -f dataworks.zip dataworks.tar.gz
rm -rf dataworks-dist
mkdir -p dataworks-dist
+ mkdir -p dataworks-dist/RemoteClient
mkdir -p dataworks-dist/Server
mkdir -p dataworks-dist/Client
mkdir -p dataworks-dist/Library
-cp Library/*.lib dataworks-dist/Library/
-cp Server/dataworks_server$(EXEC_SUFFIX) dataworks-dist/Server/
-rmdir dataworks-dist/Server
+ -cp RemoteClient/dataworks_remote_client$(EXEC_SUFFIX) dataworks-dist/RemoteClient/
+ -rmdir dataworks-dist/RemoteClient
cp Library/*.h dataworks-dist/Library/
cp Client/dataworks$(EXEC_SUFFIX) dataworks-dist/Client/
cp -rf Document/doc/html dataworks-dist/Document/html
- `Package`
Contains files related to package manager
+ - `RemoteClient`
+
+ Contains remote client source code
- `Server`
Contains server source code
OBJS = rcli.o $(RCLI_MODULE)
-all: dataworks_server$(EXEC_SUFFIX)
+all: dataworks_remote_client$(EXEC_SUFFIX)
dataworks_remote_client$(EXEC_SUFFIX): $(OBJS) $(LINK_LIB)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(LINK_LIB) $(RCLILINK_LIB)
--- /dev/null
+/* $Id$ */
+/* --- START LICENSE --- */
+/* -------------------------------------------------------------------------- */
+/* Copyright (c) 2024 Crabware. */
+/* Redistribution and use in source and binary forms, with or without modific */
+/* ation, are permitted provided that the following conditions are met: */
+/* 1. Redistributions of source code must retain the above copyright noti */
+/* ce, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright n */
+/* otice, this list of conditions and the following disclaimer in the documen */
+/* tation and/or other materials provided with the distribution. */
+/* 3. Neither the name of the copyright holder nor the names of its contr */
+/* ibutors may be used to endorse or promote products derived from this softw */
+/* are without specific prior written permission. */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS */
+/* " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH */
+/* E IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO */
+/* SE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CON */
+/* SEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITU */
+/* TE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPT */
+/* ION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S */
+/* TRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN */
+/* Y WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY */
+/* OF SUCH DAMAGE. */
+/* -------------------------------------------------------------------------- */
+/* --- END LICENSE --- */
--- /dev/null
+/* $Id$ */
+/* --- START LICNESE --- */
+/* --- END LICNESE --- */
+
+int main() {}
--- /dev/null
+/* $Id$ */
+/* --- START LICENSE --- */
+/* -------------------------------------------------------------------------- */
+/* Copyright (c) 2024 Crabware. */
+/* Redistribution and use in source and binary forms, with or without modific */
+/* ation, are permitted provided that the following conditions are met: */
+/* 1. Redistributions of source code must retain the above copyright noti */
+/* ce, this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright n */
+/* otice, this list of conditions and the following disclaimer in the documen */
+/* tation and/or other materials provided with the distribution. */
+/* 3. Neither the name of the copyright holder nor the names of its contr */
+/* ibutors may be used to endorse or promote products derived from this softw */
+/* are without specific prior written permission. */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS */
+/* " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH */
+/* E IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO */
+/* SE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CON */
+/* SEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITU */
+/* TE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPT */
+/* ION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S */
+/* TRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN */
+/* Y WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY */
+/* OF SUCH DAMAGE. */
+/* -------------------------------------------------------------------------- */
+/* --- END LICENSE --- */
extern bool auth;
extern char* authfile;
-#ifdef __MINGW32__
+#if defined(__MINGW32__)
+#define USE_WINSOCK
+#endif
+
+#ifdef USE_WINSOCK
#include <process.h>
#include <windows.h>
#include <winsock2.h>
int port = 4096;
int server_socket;
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
struct sockaddr_in server_address;
#else
struct sockaddr_in6 server_address;
db = dataworks_database_open(argv[i]);
}
}
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
WSADATA wsa;
WSAStartup(MAKEWORD(2, 0), &wsa);
#endif
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
if((server_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
#else
if((server_socket = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)) < 0) {
close(server_socket);
return 1;
}
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
#else
int no = 0;
if(setsockopt(server_socket, IPPROTO_IPV6, IPV6_V6ONLY, &no, sizeof(no)) < 0) {
}
#endif
memset(&server_address, 0, sizeof(server_address));
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
server_address.sin_family = AF_INET;
server_address.sin_addr.S_un.S_addr = INADDR_ANY;
server_address.sin_port = htons(port);
close(server_socket);
return 1;
}
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
#else
signal(SIGCHLD, SIG_IGN);
#endif
return 0;
}
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
unsigned int WINAPI pass_sock(LPVOID sockptr) {
int sock = *(int*)sockptr;
#else
#endif
protocol_init(sock);
protocol_loop(sock);
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
closesocket(sock);
#else
close(sock);
struct sockaddr_in claddr;
int clen = sizeof(claddr);
int sock = accept(server_socket, (struct sockaddr*)&claddr, &clen);
-#ifdef __MINGW32__
+#ifdef USE_WINSOCK
HANDLE thread;
thread = (HANDLE)_beginthreadex(NULL, 0, pass_sock, &sock, 0, NULL);
#else