]> git.pond.sub.org Git - empserver/commitdiff
Portability fixes: don't declare library functions, include
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 15 Jan 2004 13:43:50 +0000 (13:43 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 15 Jan 2004 13:43:50 +0000 (13:43 +0000)
appropriate headers.  Also remove some unused declarations.

13 files changed:
src/client/h.h [deleted file]
src/client/host.c
src/client/ioqueue.c
src/client/login.c
src/client/main.c
src/client/misc.h
src/client/queue.c
src/client/saveargv.c
src/client/servcmd.c
src/client/serverio.c
src/client/tags.c
src/client/termio.c
src/client/termlib.c

diff --git a/src/client/h.h b/src/client/h.h
deleted file mode 100644 (file)
index 014f10e..0000000
+++ /dev/null
@@ -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
index fe66d6cc11e5d46aa8f2bea25faeea6d54532b49..ea4ca5da97b97adaac4850c587051b61a0728c4c 100644 (file)
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #ifndef _WIN32
+#include <arpa/inet.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
@@ -50,9 +52,6 @@ hostaddr(name, addr)
 s_char *name;
 struct sockaddr_in *addr;
 {
-#ifndef _WIN32
-    extern u_long inet_addr();
-#endif
     struct hostent *hp;
 
     if (name == 0 || *name == 0)
@@ -80,9 +79,6 @@ s_char *name;
 struct sockaddr_in *addr;
 {
     struct servent *sp;
-#ifndef _WIN32
-    int atoi();
-#endif
 
     if (name == 0 || *name == 0)
        return 0;
index fd7babb44ffd6e5f52ffa00608d3c492ff3d4a01..ec04c41cb42c18f0911b174c48a335e7e2a6031b 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #ifndef _WIN32
 #include <sys/uio.h>
@@ -58,7 +59,6 @@ void insque();
 void remque();
 void initque();
 struct qelem *makeqt();
-void free();
 
 void
 ioq_init(ioq, bsize)
@@ -193,8 +193,7 @@ int cc;
  * this routine doesn't free memory; this is
  * left for a higher level.
  */
-static
-    int
+static int
 ioqtobuf(ioq, buf, cc)
 register struct ioqueue *ioq;
 s_char *buf;
@@ -234,8 +233,7 @@ int cc;
  * with one writev for example.  This makes the processing
  * of a full ioqueue still be quick.
  */
-static
-    int
+static int
 ioqtoiov(ioq, iov, max)
 register struct ioqueue *ioq;
 register struct iovec *iov;
@@ -286,8 +284,7 @@ int cc;
  * free memory, dequeue io elements
  * which are no longer used.
  */
-static
-    int
+static int
 dequeuecc(ioq, cc)
 register struct ioqueue *ioq;
 register int cc;
index c94ad1e815c40443e38ea6759e9bb66e967713bb..1479cc12e57eb9bfb76d0bbfb559be37b5e05edf 100644 (file)
 
 #include <ctype.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #if !defined(_WIN32)
 #include <unistd.h>
 #endif
 
 int expect();
-int atoi();
 void sendcmd();
 
 int
index 5d8574bc910959b10c54c982ebd22f9fc1a3bbb7..5e1bf68e176f924a5dfb527b1be7edf2a631723a 100644 (file)
@@ -42,6 +42,9 @@
 #include "ioqueue.h"
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/time.h>
 #ifndef _WIN32
 #include <pwd.h>
 #endif
@@ -98,7 +101,6 @@ s_char *av[];
     SECURITY_ATTRIBUTES security;
     void intr(void);
 #endif
-    extern s_char *getenv();
     extern s_char empireport[];
     extern s_char empirehost[];
     fd_set mask;
index 25ff05d39878ffd25804017945df31ce41750e07..647f8858dea1f0395adbb1c8673fed755829a185 100644 (file)
 
 #include <ctype.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)
 #ifndef ultrix                 /* already defined in ultrix */
 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;
 #endif /* !aix && !sgi */
 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
index 82c9b6700fa28480e959ac88612a0dba1d3ed61a..4de7856f0e28e0e07c04f305f80cb616c8b4199c 100644 (file)
@@ -31,6 +31,7 @@
  *     Steve McClure, 1998
  */
 
+#include <stdlib.h>
 #if !defined(_WIN32)
 #include <unistd.h>
 #endif
@@ -68,7 +69,6 @@ struct qelem *
 makeqt(nelem)
 int nelem;
 {
-    extern s_char *malloc();
     struct qelem *table;
     struct qelem *qp;
     int i;
index 3d2750559a93afddc426de94f32c231c564851d8..eacebd502d771e94c1f8496eded5a8b9dd2be1d6 100644 (file)
@@ -31,6 +31,8 @@
  *  
  */
 
+#include <stdlib.h>
+#include <string.h>
 #include "misc.h"
 
 void
@@ -39,8 +41,6 @@ int ac;
 s_char **src;
 s_char **dst;
 {
-    extern s_char *strcpy();
-    extern s_char *malloc();
     register s_char *ptr;
     register int i;
 
index f15341fcc1254afa92cc3201410f1dc6cebcd80d..ae4976c5f4369a0748dc7097a15eb2978dfc5834 100644 (file)
@@ -38,6 +38,7 @@
 #include "ioqueue.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 #include <fcntl.h>
 #if !defined(_WIN32)
@@ -61,7 +62,6 @@ void dopipe();
 void doexecute();
 void output();
 void screen();
-void free();
 int sendeof();
 int termio();
 void _noecho();
@@ -219,7 +219,6 @@ void
 dopipe(p)
 s_char *p;
 {
-    extern FILE *popen();
     s_char *tag;
 
     if (*p == '|')
index e08e183b2f4b2cf0452d4d030392abd57a2e190b..29b79b8ed066fce206d9616621a9e79923af7a94 100644 (file)
 #include "ioqueue.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #if !defined(_WIN32)
 #include <unistd.h>
 #endif
 
 #ifdef _WIN32
-#include <malloc.h>
 #include <winsock.h>
 #endif
 
-void free();
 void ioq_write();
 
 int
@@ -54,11 +53,6 @@ serverio(s, ioq)
 int s;
 struct ioqueue *ioq;
 {
-#ifndef _WIN32
-    extern s_char *realloc();
-#else
-    extern void *realloc();
-#endif
     s_char *buf;
     int n;
 
index fd5e59e1ec5802a878f777f6ee9544f29b037ae6..7661110b26ad48d0e4c9681dc22e5280859da4be 100644 (file)
 #include "misc.h"
 #include "tags.h"
 
+#include <stdlib.h>
 #include <stdio.h>
-
-#ifdef Rel4
 #include <string.h>
-#endif /* Rel4 */
-
 #if !defined(_WIN32)
 #include <unistd.h>
 #endif
 
 struct tagstruct *taglist;
 s_char buf[4096];
-u_short tagnum;
 s_char exec[8];
-
-void free();
+static unsigned short tagnum;
 
 void
 io_init()
index 54c44c652dbccb76400e71536c7db548163d78df..6a597efdfb360f124b91bcad78ef3b2472f1e3ad 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #if defined(aix) || defined(hpux) || defined(sgi)
 #include <sys/termio.h>
index 71be68892ce1a8689ec2daebfac75944b4b04d01..bc4f72a8ff426146f8090b7732fcbdb791040b4d 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 #include "misc.h"
 
@@ -65,7 +66,6 @@ void
 getsose()
 {
 #ifndef _WIN32
-    extern s_char *getenv();
     extern s_char *tgetstr();
 #endif
     static s_char tbuf[1024];