(w32_getpw, w32_socket, w32_connect, w32_recv, w32_send,
w32_writev_socket, w32_close_socket, getpass, w32_openfd, w32_openhandle, w32_readv_handle, w32_close_handle, sysdep_init, sysdep_stdin_init, w32_select, w32_signal_handler, sigaction, stdin_read_thread, w32_ring_from_file_to_bounce_buf) [_WIN32]: New w32 equivalent functions for POSIX functions. (recvline, sendcmd, tcp_connect, hostconnect, getpass, main, intr, play, ring_to_file, ring_from_file, doexecute, doredir) [_WIN32]: Use new WIN32 equivalent functions. (main) [_WIN32]: Add sysdep_init() to support system dependent initialization for equivalence functions. (play) [_WIN32]: Add sysdef_stdin_init() to support system dependent initialization for reading stdin. (recv_input, play) [_WIN32]: Replace the calls to ring_to_file() and select() with WIN32 specific enhanced versions. Makefile.in: update dependencies with new files. Make.mk: Add using of getopt.c and getopt.h from src/lib/w32 directory. Add getopt.c and getopt.h to tar for client.
This commit is contained in:
parent
006c4bcce4
commit
f082ef9fa6
12 changed files with 750 additions and 110 deletions
95
src/client/sysdep_w32.h
Normal file
95
src/client/sysdep_w32.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Empire - A multi-player, client/server Internet based war game.
|
||||
* Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
||||
* Ken Stevens, Steve McClure
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* See files README, COPYING and CREDITS in the root of the source
|
||||
* tree for related information and legal notices. It is expected
|
||||
* that future projects/authors will amend these files as needed.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* sysdep_w32.h: system dependent support for WIN32 environments
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* Ron Koenderink, 2007
|
||||
*/
|
||||
|
||||
#ifndef _SYSDEF_W32_H
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#include <signal.h>
|
||||
|
||||
extern int getopt(int, char * const[], const char *);
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef int __w64 ssize_t;
|
||||
#endif
|
||||
|
||||
struct passwd {
|
||||
char *pw_name;
|
||||
};
|
||||
|
||||
struct iovec {
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
|
||||
struct sigaction {
|
||||
int sa_flags;
|
||||
void (*sa_handler)(int sig);
|
||||
};
|
||||
|
||||
extern int w32_recv(int socket, char *buffer,
|
||||
size_t buf_size, int flags);
|
||||
extern int w32_send(int socket, char *buffer,
|
||||
size_t buf_size, int flags);
|
||||
extern int w32_close_socket(int fd);
|
||||
extern int w32_socket(int family, int sock_type, int protocol);
|
||||
extern int w32_connect(int sock, struct sockaddr *addr, int addrlen);
|
||||
extern int w32_close_handle(int fd);
|
||||
extern ssize_t w32_readv_handle(int fd, const struct iovec *iov,
|
||||
int iovcnt);
|
||||
extern ssize_t w32_writev_socket(int fd, const struct iovec *iov,
|
||||
int iovcnt);
|
||||
extern int w32_createfd(const char *fname, int oflag, ...);
|
||||
extern int w32_openhandle(const char *fname, int oflag);
|
||||
|
||||
extern int alarm(int time);
|
||||
extern struct passwd *w32_getpw(void);
|
||||
extern char *getpass(char *prompt);
|
||||
extern void sysdep_init(void);
|
||||
|
||||
#define recv(sock, buffer, buf_size, flags) \
|
||||
w32_recv((sock), (buffer), (buf_size), (flags))
|
||||
#define socket(family, sock_type, protocol) \
|
||||
w32_socket((family), (sock_type), (protocol))
|
||||
#define connect(sock, addr, addrlen) \
|
||||
w32_connect((sock), (addr), (addrlen))
|
||||
|
||||
#define pclose _pclose
|
||||
#define popen _popen
|
||||
#define snprintf _snprintf
|
||||
#define getsose() ((void)0)
|
||||
#define putso() ((void)0)
|
||||
#define putse() ((void)0)
|
||||
#endif /* sysdef_w32.h */
|
Loading…
Add table
Add a link
Reference in a new issue