Portability fixes: don't declare library functions, include
appropriate headers. Also remove some unused declarations.
This commit is contained in:
parent
56dce5a8c4
commit
4ce5f988d0
13 changed files with 19 additions and 156 deletions
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2000, 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 the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
|
|
||||||
* related information and legal notices. It is expected that any future
|
|
||||||
* projects/authors will amend these files as needed.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* h.h: Simple typedef
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
* Steve McClure, 1998
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _H_H_
|
|
||||||
#define _H_H_
|
|
||||||
|
|
||||||
typedef char s_char;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -33,8 +33,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -50,9 +52,6 @@ hostaddr(name, addr)
|
||||||
s_char *name;
|
s_char *name;
|
||||||
struct sockaddr_in *addr;
|
struct sockaddr_in *addr;
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
extern u_long inet_addr();
|
|
||||||
#endif
|
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
|
|
||||||
if (name == 0 || *name == 0)
|
if (name == 0 || *name == 0)
|
||||||
|
@ -80,9 +79,6 @@ s_char *name;
|
||||||
struct sockaddr_in *addr;
|
struct sockaddr_in *addr;
|
||||||
{
|
{
|
||||||
struct servent *sp;
|
struct servent *sp;
|
||||||
#ifndef _WIN32
|
|
||||||
int atoi();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (name == 0 || *name == 0)
|
if (name == 0 || *name == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
@ -58,7 +59,6 @@ void insque();
|
||||||
void remque();
|
void remque();
|
||||||
void initque();
|
void initque();
|
||||||
struct qelem *makeqt();
|
struct qelem *makeqt();
|
||||||
void free();
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ioq_init(ioq, bsize)
|
ioq_init(ioq, bsize)
|
||||||
|
@ -193,8 +193,7 @@ int cc;
|
||||||
* this routine doesn't free memory; this is
|
* this routine doesn't free memory; this is
|
||||||
* left for a higher level.
|
* left for a higher level.
|
||||||
*/
|
*/
|
||||||
static
|
static int
|
||||||
int
|
|
||||||
ioqtobuf(ioq, buf, cc)
|
ioqtobuf(ioq, buf, cc)
|
||||||
register struct ioqueue *ioq;
|
register struct ioqueue *ioq;
|
||||||
s_char *buf;
|
s_char *buf;
|
||||||
|
@ -234,8 +233,7 @@ int cc;
|
||||||
* with one writev for example. This makes the processing
|
* with one writev for example. This makes the processing
|
||||||
* of a full ioqueue still be quick.
|
* of a full ioqueue still be quick.
|
||||||
*/
|
*/
|
||||||
static
|
static int
|
||||||
int
|
|
||||||
ioqtoiov(ioq, iov, max)
|
ioqtoiov(ioq, iov, max)
|
||||||
register struct ioqueue *ioq;
|
register struct ioqueue *ioq;
|
||||||
register struct iovec *iov;
|
register struct iovec *iov;
|
||||||
|
@ -286,8 +284,7 @@ int cc;
|
||||||
* free memory, dequeue io elements
|
* free memory, dequeue io elements
|
||||||
* which are no longer used.
|
* which are no longer used.
|
||||||
*/
|
*/
|
||||||
static
|
static int
|
||||||
int
|
|
||||||
dequeuecc(ioq, cc)
|
dequeuecc(ioq, cc)
|
||||||
register struct ioqueue *ioq;
|
register struct ioqueue *ioq;
|
||||||
register int cc;
|
register int cc;
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int expect();
|
int expect();
|
||||||
int atoi();
|
|
||||||
void sendcmd();
|
void sendcmd();
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
#include "ioqueue.h"
|
#include "ioqueue.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,7 +101,6 @@ s_char *av[];
|
||||||
SECURITY_ATTRIBUTES security;
|
SECURITY_ATTRIBUTES security;
|
||||||
void intr(void);
|
void intr(void);
|
||||||
#endif
|
#endif
|
||||||
extern s_char *getenv();
|
|
||||||
extern s_char empireport[];
|
extern s_char empireport[];
|
||||||
extern s_char empirehost[];
|
extern s_char empirehost[];
|
||||||
fd_set mask;
|
fd_set mask;
|
||||||
|
|
|
@ -36,29 +36,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#ifdef hpux
|
|
||||||
#include <string.h>
|
|
||||||
#else
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
typedef unsigned char u_char;
|
|
||||||
typedef unsigned short u_short;
|
|
||||||
#else
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAXNOC 100
|
|
||||||
|
|
||||||
#define WORLD_X 32
|
|
||||||
#define WORLD_Y 16
|
|
||||||
|
|
||||||
#define ETUS 60 /* Defined here.. may be overridden later,
|
|
||||||
but things still use this define */
|
|
||||||
typedef u_char natid; /* also change NSC_NATID in nsc.h */
|
|
||||||
#if !defined(aix) && !defined(sgi)
|
#if !defined(aix) && !defined(sgi)
|
||||||
#ifndef ultrix /* already defined in ultrix */
|
#ifndef ultrix /* already defined in ultrix */
|
||||||
typedef char s_char; /* change to signed char for aix */
|
typedef char s_char; /* change to signed char for aix */
|
||||||
|
@ -67,65 +45,5 @@ typedef char s_char; /* change to signed char for aix */
|
||||||
typedef signed char s_char;
|
typedef signed char s_char;
|
||||||
#endif /* !aix && !sgi */
|
#endif /* !aix && !sgi */
|
||||||
typedef short coord; /* also change NSC_COORD in nsc.h */
|
typedef short coord; /* also change NSC_COORD in nsc.h */
|
||||||
/*
|
|
||||||
* watch it; your compiler might not like this.
|
|
||||||
* If you think this is bogus, look at /usr/include/struct.h
|
|
||||||
*/
|
|
||||||
#define OFFSET(stype, oset) ((int)(&(((struct stype *)0)->oset)))
|
|
||||||
#define SETOFF(sinst, oset) ((s_char *) (sinst) + (oset))
|
|
||||||
|
|
||||||
#ifndef bit
|
|
||||||
#define bit(x) (1<<(x))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define minutes(x) (60*(x))
|
|
||||||
#define hours(x) (60*60*(x))
|
|
||||||
#define days(x) (60*60*24*(x))
|
|
||||||
|
|
||||||
typedef void (*voidfunc) ();
|
|
||||||
|
|
||||||
/* return codes from command routines */
|
|
||||||
#define RET_OK 0 /* command completed sucessfully */
|
|
||||||
#define RET_FAIL 1 /* command completed unsucessfully [?] */
|
|
||||||
#define RET_SYN 2 /* syntax error in command */
|
|
||||||
#define RET_SYS 3 /* system error (missing file, etc) */
|
|
||||||
|
|
||||||
#define MAX_DISTPATH_LEN 10 /* Has to go somewhere */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* references to library functions which aren't related to any
|
|
||||||
* particular object, and are of general interest
|
|
||||||
*/
|
|
||||||
extern long random();
|
|
||||||
|
|
||||||
extern double dmax();
|
|
||||||
extern double dmin();
|
|
||||||
|
|
||||||
extern s_char *fmt();
|
|
||||||
extern s_char *numstr();
|
|
||||||
extern s_char *esplur();
|
|
||||||
extern s_char *splur();
|
|
||||||
extern s_char *iesplur();
|
|
||||||
extern s_char *plur();
|
|
||||||
extern s_char *getstarg();
|
|
||||||
extern s_char *getstring();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* frequently used libc functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
extern s_char *malloc();
|
|
||||||
extern s_char *calloc();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!defined (aix) && !defined (sgi))
|
|
||||||
extern s_char *ctime();
|
|
||||||
extern s_char *strncpy();
|
|
||||||
extern s_char *strcpy();
|
|
||||||
#endif /* !aix && !sgi */
|
|
||||||
|
|
||||||
extern time_t time();
|
|
||||||
extern double atof();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
* Steve McClure, 1998
|
* Steve McClure, 1998
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,7 +69,6 @@ struct qelem *
|
||||||
makeqt(nelem)
|
makeqt(nelem)
|
||||||
int nelem;
|
int nelem;
|
||||||
{
|
{
|
||||||
extern s_char *malloc();
|
|
||||||
struct qelem *table;
|
struct qelem *table;
|
||||||
struct qelem *qp;
|
struct qelem *qp;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -39,8 +41,6 @@ int ac;
|
||||||
s_char **src;
|
s_char **src;
|
||||||
s_char **dst;
|
s_char **dst;
|
||||||
{
|
{
|
||||||
extern s_char *strcpy();
|
|
||||||
extern s_char *malloc();
|
|
||||||
register s_char *ptr;
|
register s_char *ptr;
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "ioqueue.h"
|
#include "ioqueue.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
@ -61,7 +62,6 @@ void dopipe();
|
||||||
void doexecute();
|
void doexecute();
|
||||||
void output();
|
void output();
|
||||||
void screen();
|
void screen();
|
||||||
void free();
|
|
||||||
int sendeof();
|
int sendeof();
|
||||||
int termio();
|
int termio();
|
||||||
void _noecho();
|
void _noecho();
|
||||||
|
@ -219,7 +219,6 @@ void
|
||||||
dopipe(p)
|
dopipe(p)
|
||||||
s_char *p;
|
s_char *p;
|
||||||
{
|
{
|
||||||
extern FILE *popen();
|
|
||||||
s_char *tag;
|
s_char *tag;
|
||||||
|
|
||||||
if (*p == '|')
|
if (*p == '|')
|
||||||
|
|
|
@ -36,17 +36,16 @@
|
||||||
#include "ioqueue.h"
|
#include "ioqueue.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <malloc.h>
|
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void free();
|
|
||||||
void ioq_write();
|
void ioq_write();
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -54,11 +53,6 @@ serverio(s, ioq)
|
||||||
int s;
|
int s;
|
||||||
struct ioqueue *ioq;
|
struct ioqueue *ioq;
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
extern s_char *realloc();
|
|
||||||
#else
|
|
||||||
extern void *realloc();
|
|
||||||
#endif
|
|
||||||
s_char *buf;
|
s_char *buf;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|
|
@ -35,22 +35,17 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "tags.h"
|
#include "tags.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef Rel4
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif /* Rel4 */
|
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct tagstruct *taglist;
|
struct tagstruct *taglist;
|
||||||
s_char buf[4096];
|
s_char buf[4096];
|
||||||
u_short tagnum;
|
|
||||||
s_char exec[8];
|
s_char exec[8];
|
||||||
|
static unsigned short tagnum;
|
||||||
void free();
|
|
||||||
|
|
||||||
void
|
void
|
||||||
io_init()
|
io_init()
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if defined(aix) || defined(hpux) || defined(sgi)
|
#if defined(aix) || defined(hpux) || defined(sgi)
|
||||||
#include <sys/termio.h>
|
#include <sys/termio.h>
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
@ -65,7 +66,6 @@ void
|
||||||
getsose()
|
getsose()
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
extern s_char *getenv();
|
|
||||||
extern s_char *tgetstr();
|
extern s_char *tgetstr();
|
||||||
#endif
|
#endif
|
||||||
static s_char tbuf[1024];
|
static s_char tbuf[1024];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue