Supply prototypes where possible. This uncovered type errors with

thread entrypoints:
(lwpSelect, shutdown_sequence): Parameters didn't match thread entry
point prototype.
(lwpEntryPoint): Arguments didn't match thread entry point prototype.

Change linkage of functions without prototype declaration to static
where possible.

Remove some superflous declarations, replace others by suitable
includes.
This commit is contained in:
Markus Armbruster 2004-02-17 17:59:30 +00:00
parent 7dbb87b0e0
commit 237baffca9
108 changed files with 505 additions and 877 deletions

View file

@ -31,10 +31,10 @@
* Ville Virrankoski, 1995 * Ville Virrankoski, 1995
*/ */
void fill_update_array(); void fill_update_array(int *bp, struct sctstr *sp);
int *get_wp(); int *get_wp(int *bp, struct sctstr *sp, int cm);
int gt_bg_nmbr(); int gt_bg_nmbr(int *bp, struct sctstr *sp, int comm);
void pt_bg_nmbr(); void pt_bg_nmbr(int *bp, struct sctstr *sp, int comm, int amount);
void get_materials(); void get_materials(struct sctstr *sp, int *bp, int *mvec, int check);
extern int mil_dbl_pay; extern int mil_dbl_pay;

View file

@ -97,9 +97,6 @@ extern int att_fight(int, struct combat *, struct emp_qelem *, double,
extern int att_free_lists(struct emp_qelem *, struct emp_qelem *); extern int att_free_lists(struct emp_qelem *, struct emp_qelem *);
extern double att_asupport();
extern double att_dsupport();
extern double att_mine_dsupport();
extern double combat_mob; extern double combat_mob;
extern s_char *att_mode[]; extern s_char *att_mode[];

View file

@ -36,7 +36,6 @@
#ifndef _EMTHREAD_H_ #ifndef _EMTHREAD_H_
#define _EMTHREAD_H_ #define _EMTHREAD_H_
#include "prototype.h"
#include "misc.h" #include "misc.h"
#if defined(_WIN32) #if defined(_WIN32)
@ -66,14 +65,13 @@ typedef struct lwpSem empth_sem_t;
#define EMPTH_PRINT 0x1 #define EMPTH_PRINT 0x1
#define EMPTH_STACKCHECK 0x2 #define EMPTH_STACKCHECK 0x2
typedef void (*vf_ptr) ();
#define EMPTH_KILLED 1 #define EMPTH_KILLED 1
typedef struct empth_ctx_t { typedef struct empth_ctx_t {
char *name; /* thread name */ char *name; /* thread name */
char *desc; /* description */ char *desc; /* description */
void *ud; /* user data */ void *ud; /* user data */
int state; /* my state */ int state; /* my state */
vf_ptr ep; /* entry point */ void (*ep)(void *); /* entry point */
pthread_t id; /* thread id */ pthread_t id; /* thread id */
} empth_t; } empth_t;
@ -110,20 +108,19 @@ typedef void empth_sem_t;
#endif #endif
int empth_init _PROTO((char **ctx, int flags)); int empth_init(char **ctx, int flags);
empth_t *empth_create _PROTO((int, void (*)(), int, empth_t *empth_create(int, void (*)(void *), int, int, char *, char *, void *);
int, char *, char *, void *)); empth_t *empth_self(void);
empth_t *empth_self(); void empth_exit(void);
void empth_exit _PROTO((void)); void empth_yield(void);
void empth_yield _PROTO((void)); void empth_terminate(empth_t *);
void empth_terminate _PROTO((empth_t *)); void empth_select(int fd, int flags);
void empth_select _PROTO((int fd, int flags)); void empth_wakeup(empth_t *);
void empth_wakeup _PROTO((empth_t *)); void empth_sleep(long until);
void empth_sleep _PROTO((long until)); empth_sem_t *empth_sem_create(char *name, int count);
empth_sem_t *empth_sem_create _PROTO((char *name, int count)); void empth_sem_signal(empth_sem_t *);
void empth_sem_signal _PROTO((empth_sem_t *)); void empth_sem_wait(empth_sem_t *);
void empth_sem_wait _PROTO((empth_sem_t *)); void empth_alarm(int);
void empth_alarm _PROTO((int));
#include "prototypes.h" /* must come at end, after defines and typedefs */ #include "prototypes.h" /* must come at end, after defines and typedefs */

View file

@ -109,7 +109,7 @@ extern int ef_vars(int, register s_char *, u_char **,
u_char **, u_short **); u_char **, u_short **);
extern int ef_byname(s_char *); extern int ef_byname(s_char *);
extern int ef_nbread(); extern int ef_nbread(int type, int id, caddr_t ptr);
extern struct empfile empfile[]; extern struct empfile empfile[];
#endif /* _FILE_H_ */ #endif /* _FILE_H_ */

View file

@ -53,7 +53,7 @@ extern int maxitem;
/* procedures using/returning this struct */ /* procedures using/returning this struct */
extern struct ichrstr *whatitem(); extern struct ichrstr *whatitem(s_char *ptr, s_char *prompt);
extern int itm_maxno; extern int itm_maxno;

View file

@ -228,10 +228,7 @@ extern int lnd_support(natid, natid, coord, coord);
extern int lnd_can_attack(struct lndstr *); extern int lnd_can_attack(struct lndstr *);
extern int lnd_fortify (struct lndstr *lp, int hard_amt); extern int lnd_fortify (struct lndstr *lp, int hard_amt);
void landdamage(); void landdamage(struct lndstr *lp, int dam);
void lnd_nav(); s_char *prland(struct lndstr *lp);
int lnd_check_nav();
double sqrt();
s_char *prland();
#endif /* _LAND_H_ */ #endif /* _LAND_H_ */

View file

@ -22,7 +22,6 @@
*/ */
#ifndef _LWP_H_ #ifndef _LWP_H_
#define _LWP_H_ #define _LWP_H_
#include "prototype.h"
#ifdef UCONTEXT #ifdef UCONTEXT
#include <ucontext.h> #include <ucontext.h>
#else /* UCONTEXT */ #else /* UCONTEXT */
@ -42,7 +41,7 @@ struct lwpProc {
#endif /* UCONTEXT */ #endif /* UCONTEXT */
void *sbtm; /* bottom of stack attached to it */ void *sbtm; /* bottom of stack attached to it */
int size; /* size of stack */ int size; /* size of stack */
void (*entry) (); /* entry point */ void (*entry)(void *); /* entry point */
int dead; /* whether the process can be rescheduled */ int dead; /* whether the process can be rescheduled */
int pri; /* which scheduling queue we're on */ int pri; /* which scheduling queue we're on */
long runtime; /* time at which process is restarted */ long runtime; /* time at which process is restarted */
@ -76,27 +75,27 @@ struct lwpSem {
#define LWP_MAX_PRIO 8 #define LWP_MAX_PRIO 8
struct lwpProc *lwpInitSystem _PROTO((int prio, char **ctxp, int flags)); struct lwpProc *lwpInitSystem(int prio, char **ctxp, int flags);
struct lwpProc *lwpCreate _PROTO((int prio, void (*)(), int size, struct lwpProc *lwpCreate(int prio, void (*)(void *), int size,
int flags, char *name, char *desc, int flags, char *name, char *desc,
int argc, char **argv, void *ud)); int argc, char **argv, void *ud);
void lwpExit _PROTO((void)); void lwpExit(void);
void lwpTerminate _PROTO((struct lwpProc * p)); void lwpTerminate(struct lwpProc * p);
void lwpYield _PROTO((void)); void lwpYield(void);
void lwpSleepFd _PROTO((int fd, int flags)); void lwpSleepFd(int fd, int flags);
void lwpSleepUntil _PROTO((long until)); void lwpSleepUntil(long until);
void lwpWakeupFd _PROTO((struct lwpProc * p)); void lwpWakeupFd(struct lwpProc * p);
void *lwpGetUD _PROTO((struct lwpProc * p)); void *lwpGetUD(struct lwpProc * p);
void lwpSetUD _PROTO((struct lwpProc * p, char *ud)); void lwpSetUD(struct lwpProc * p, char *ud);
void lwpSetDesc _PROTO((struct lwpProc * p, char *name, char *desc)); void lwpSetDesc(struct lwpProc * p, char *name, char *desc);
int lwpSetPriority _PROTO((int prio)); int lwpSetPriority(int prio);
void lwpReschedule _PROTO((void)); void lwpReschedule(void);
struct lwpSem *lwpCreateSem _PROTO((char *name, int count)); struct lwpSem *lwpCreateSem(char *name, int count);
void lwpSignal _PROTO((struct lwpSem *)); void lwpSignal(struct lwpSem *);
void lwpWait _PROTO((struct lwpSem *)); void lwpWait(struct lwpSem *);
void lwpSelect _PROTO((int argc, char **argv)); void lwpSelect(void *);
void lwpStatus _PROTO((struct lwpProc * proc, char *format, ...)); void lwpStatus(struct lwpProc * proc, char *format, ...);
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;

View file

@ -57,7 +57,6 @@ typedef unsigned int u_int;
/*#define _POSIX_ */ /*#define _POSIX_ */
#endif #endif
#include "prototype.h"
#include "options.h" #include "options.h"
/* This is the structure we use to keep track of the global mobility /* This is the structure we use to keep track of the global mobility
@ -115,7 +114,6 @@ typedef short coord; /* also change NSC_COORD in nsc.h */
#define hours(x) (60*60*(x)) #define hours(x) (60*60*(x))
#define days(x) (60*60*24*(x)) #define days(x) (60*60*24*(x))
typedef void (*voidfunc) ();
typedef int (*qsort_func_t) (const void *, const void *); typedef int (*qsort_func_t) (const void *, const void *);
/* return codes from command routines */ /* return codes from command routines */
@ -124,70 +122,18 @@ typedef int (*qsort_func_t) (const void *, const void *);
#define RET_SYN 2 /* syntax error in command */ #define RET_SYN 2 /* syntax error in command */
#define RET_SYS 3 /* system error (missing file, etc) */ #define RET_SYS 3 /* system error (missing file, etc) */
#define MAX_DISTPATH_LEN 10 /* Has to go somewhere */ double dmax(double n1, double n2);
double dmin(double n1, double n2);
/* extern s_char *numstr(s_char buf[], int n);
* references to library functions which aren't related to any extern s_char *esplur(int n);
* particular object, and are of general interest extern s_char *splur(int n);
*/ extern s_char *iesplur(int n);
#if !defined(ALPHA) && !defined(__osf__) && !defined(__linux__) && !defined(_WIN32) extern s_char *plur(int n, s_char *no, s_char *yes);
extern long random(); extern s_char *getstarg(s_char *input, s_char *prompt, s_char buf[]);
#endif extern s_char *getstring(s_char *prompt, s_char buf[]);
double dmax _PROTO((double n1, double n2));
double dmin _PROTO((double n1, double n2));
extern s_char *numstr _PROTO((s_char buf[], int n));
extern s_char *esplur _PROTO((int n));
extern s_char *splur _PROTO((int n));
extern s_char *iesplur _PROTO((int n));
extern s_char *plur _PROTO((int n, s_char *no, s_char *yes));
extern s_char *getstarg
_PROTO((s_char *input, s_char *prompt, s_char buf[]));
extern s_char *getstring _PROTO((s_char *prompt, s_char buf[]));
extern s_char *prbuf(s_char *format, ...); extern s_char *prbuf(s_char *format, ...);
/*
* frequently used libc functions
*/
#if !defined(_WIN32)
#if defined(linux)
#ifndef __STDC__
extern char *malloc();
extern char *calloc();
#endif
#else
#if !defined(ALPHA) && !defined(__osf__) && !defined(ultrix) && !defined(hpux) && !defined(FBSD)
extern char *malloc();
extern char *calloc();
#endif
#endif
#endif
#if (!defined (aix) && !defined (sgi))
extern char *ctime();
extern char *strncpy();
extern char *strcpy();
#endif /* !aix && !sgi */
extern time_t time();
#if !defined(_WIN32)
#ifdef linux
#ifndef atof
extern double atof();
#endif
#else
extern double atof();
#endif
#endif
#if !defined(_WIN32)
#if !defined (__ppc__) && !defined (hpux) && !defined (aix) && !defined (linux) && !defined(ALPHA) && !defined(__osf__) && !defined(SUN4) && !defined (Rel4) && !(defined (ultrix) && (defined (__STDC__) || defined (__SYSTEMFIVE) || defined (__POSIX)))
extern char *sprintf();
#endif /* aix */
#endif
#define MAXCHRNV 12 #define MAXCHRNV 12
#include "prototypes.h" /* must come at end, after defines and typedefs */ #include "prototypes.h" /* must come at end, after defines and typedefs */

View file

@ -191,7 +191,6 @@ extern void putrel(struct natstr *np, natid them, int relate);
extern void putreject(struct natstr *np, natid them, int how, int what); extern void putreject(struct natstr *np, natid them, int how, int what);
extern void putcontact(struct natstr *np, natid them, int contact); extern void putcontact(struct natstr *np, natid them, int contact);
extern void agecontact(struct natstr *np); extern void agecontact(struct natstr *np);
extern struct fixnat *natfield();
#define NF_INFORM bit(0) /* Inform me of telegrams right away */ #define NF_INFORM bit(0) /* Inform me of telegrams right away */
#define NF_FLASH bit(1) /* Allow other players to flash me (sicko :) */ #define NF_FLASH bit(1) /* Allow other players to flash me (sicko :) */

View file

@ -34,7 +34,6 @@
#ifndef _NSC_H_ #ifndef _NSC_H_
#define _NSC_H_ #define _NSC_H_
#include "prototype.h"
#include "xy.h" #include "xy.h"
#define NS_LSIZE 128 #define NS_LSIZE 128
@ -55,7 +54,7 @@ struct nstr_sect {
struct range range; /* area of coverage */ struct range range; /* area of coverage */
int dist; /* dist query: range */ int dist; /* dist query: range */
coord cx, cy; /* dist query: center x-y */ coord cx, cy; /* dist query: center x-y */
int (*read) (); /* read function */ int (*read)(int type, int id, caddr_t ptr); /* read function */
int ncond; /* # of selection conditions */ int ncond; /* # of selection conditions */
struct nscstr cond[NS_NCOND]; /* selection conditions */ struct nscstr cond[NS_NCOND]; /* selection conditions */
}; };
@ -72,7 +71,7 @@ struct nstr_item {
int size; /* NS_LIST: size of list */ int size; /* NS_LIST: size of list */
int index; /* NS_LIST: index */ int index; /* NS_LIST: index */
int list[NS_LSIZE]; /* NS_LIST: item list */ int list[NS_LSIZE]; /* NS_LIST: item list */
int (*read) (); /* read function */ int (*read)(int type, int id, caddr_t ptr); /* read function */
int flags; /* EFF_ flags */ int flags; /* EFF_ flags */
int ncond; /* # of selection conditions */ int ncond; /* # of selection conditions */
struct nscstr cond[NS_NCOND]; /* selection conditions */ struct nscstr cond[NS_NCOND]; /* selection conditions */
@ -161,6 +160,6 @@ extern s_char *nstr_comp(struct nscstr *, int *, int, s_char *);
extern int encode(register s_char *, long *, int); extern int encode(register s_char *, long *, int);
extern s_char *decodep _PROTO((register long code, register void *addr)); extern s_char *decodep(register long code, register void *addr);
#endif /* _NSC_H_ */ #endif /* _NSC_H_ */

View file

@ -35,8 +35,6 @@
#ifndef _OPTLIST_H_ #ifndef _OPTLIST_H_
#define _OPTLIST_H_ #define _OPTLIST_H_
#include "prototype.h"
struct option_list { struct option_list {
char *opt_key; char *opt_key;
int *opt_valuep; int *opt_valuep;
@ -44,8 +42,8 @@ struct option_list {
extern struct option_list Options[]; extern struct option_list Options[];
extern void set_option _PROTO((const char *key)); extern void set_option(const char *key);
extern void delete_option _PROTO((const char *key)); extern void delete_option(const char *key);
extern int WORLD_X; extern int WORLD_X;
extern int WORLD_Y; extern int WORLD_Y;
@ -104,7 +102,7 @@ extern int opt_ROLLOVER_AVAIL;
struct keymatch; /* forward decl */ struct keymatch; /* forward decl */
/* function prototype for variable setting routines */ /* function prototype for variable setting routines */
typedef void KmFunc _PROTO((struct keymatch * kp, s_char **av)); typedef void KmFunc(struct keymatch * kp, s_char **av);
/* current known routines */ /* current known routines */
#if defined(__cplusplus) || (defined(__STDC__) &&__STDC__) #if defined(__cplusplus) || (defined(__STDC__) &&__STDC__)

View file

@ -72,10 +72,7 @@ extern int chkpath(natid, s_char *, coord, coord);
extern void pathrange(register coord, register coord, register s_char *, extern void pathrange(register coord, register coord, register s_char *,
int, struct range *); int, struct range *);
extern s_char *masktopath(); extern double sector_mcost(struct sctstr *sp, int do_bonus);
extern long pathtomask();
extern double sector_mcost();
#define P_NONE 0 /* NO destinations allowed */ #define P_NONE 0 /* NO destinations allowed */
#define P_WALKING 1 /* use BestLandPath, only owned */ #define P_WALKING 1 /* use BestLandPath, only owned */

View file

@ -165,14 +165,10 @@ struct shiplook {
#define PLN_LOAD(b, t) (t ? (b * (logx((double)t, (double)50.0) < 1.0 ? 1.0 : \ #define PLN_LOAD(b, t) (t ? (b * (logx((double)t, (double)50.0) < 1.0 ? 1.0 : \
logx((double)t, (double)50.0))) : b) logx((double)t, (double)50.0))) : b)
double sqrt(); double logx(double d, double base);
double logx();
float pln_damage_sect();
void count_planes(); void count_planes();
double sqrt(); s_char *prplane(struct plnstr *pp);
s_char *prplane();
/* src/lib/subs/aircombat.c */ /* src/lib/subs/aircombat.c */

View file

@ -39,7 +39,6 @@
#if !defined(_WIN32) #if !defined(_WIN32)
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "prototype.h"
#include "queue.h" #include "queue.h"
#include "misc.h" #include "misc.h"
#include "com.h" #include "com.h"

View file

@ -1,44 +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.
*
* ---
*
* prototype.h: Various prototype stuff
*
* Known contributors to this file:
*
*/
/* this stuff ought to be somewhere general... */
#ifndef _PROTOTYPE_H_
#define _PROTOTYPE_H_
#if defined(__cplusplus) || (defined(__STDC__) &&__STDC__) || defined(_WIN32)
#define _PROTO(x) x
#else
#define _PROTO(x) ()
#define const
#define volatile
#endif
#endif /* _PROTOTYPE_H_ */

View file

@ -58,7 +58,7 @@ extern void shutdwn(int sig);
/* src/lib/empthread/lwp.c */ /* src/lib/empthread/lwp.c */
#ifdef _EMPTH_LWP #ifdef _EMPTH_LWP
extern int empth_init(char **ctx, int flags); extern int empth_init(char **ctx, int flags);
extern empth_t *empth_create(int prio, void (*entry) (), int size, extern empth_t *empth_create(int prio, void (*entry)(void *), int size,
int flags, char *name, char *desc, void *ud); int flags, char *name, char *desc, void *ud);
#if 0 #if 0
extern void empth_setctx(void *ctx); extern void empth_setctx(void *ctx);
@ -79,7 +79,7 @@ extern void empth_alarm(int sig);
/* src/lib/empthread/pthread.c */ /* src/lib/empthread/pthread.c */
#ifdef _EMPTH_POSIX #ifdef _EMPTH_POSIX
extern int empth_init(char **ctx_ptr, int flags); extern int empth_init(char **ctx_ptr, int flags);
extern empth_t *empth_create(int prio, void (*entry) (), extern empth_t *empth_create(int prio, void (*entry)(void *),
int size, int flags, int size, int flags,
char *name, char *desc, void *ud); char *name, char *desc, void *ud);
extern empth_t *empth_self(void); extern empth_t *empth_self(void);
@ -346,9 +346,9 @@ extern s_char *decodep(long, void *);
extern int decode(natid, long, void *, int); extern int decode(natid, long, void *, int);
extern int nstr_exec(struct nscstr *, register int, void *, int); extern int nstr_exec(struct nscstr *, register int, void *, int);
/* path.c */ /* path.c */
extern void bp_enable_cachepath(); extern void bp_enable_cachepath(void);
extern void bp_disable_cachepath(); extern void bp_disable_cachepath(void);
extern void bp_clear_cachepath(); extern void bp_clear_cachepath(void);
extern s_char *BestDistPath(s_char *, struct sctstr *, struct sctstr *, extern s_char *BestDistPath(s_char *, struct sctstr *, struct sctstr *,
double *, int); double *, int);
extern s_char *BestLandPath(s_char *, struct sctstr *, struct sctstr *, extern s_char *BestLandPath(s_char *, struct sctstr *, struct sctstr *,
@ -856,6 +856,6 @@ extern int feed_ship(struct shpstr *, register int *, int, int *, int);
*/ */
/* shutdown.c */ /* shutdown.c */
extern void shutdown_init(void); extern void shutdown_init(void);
extern void shutdown_sequence(int argc, s_char **argv); extern void shutdown_sequence(void *);
#endif /* _PROTOTYPES_H_ */ #endif /* _PROTOTYPES_H_ */

View file

@ -168,7 +168,7 @@ struct dchrstr {
/* things relating to sectors */ /* things relating to sectors */
extern int sctoff(coord x, coord y); extern int sctoff(coord x, coord y);
extern double landgun(); extern double landgun(int effic, int guns);
extern int sct_maxno; extern int sct_maxno;
extern struct dchrstr dchr[]; extern struct dchrstr dchr[];

View file

@ -193,7 +193,7 @@ struct mchrstr {
#define getshipp(n) \ #define getshipp(n) \
(struct shpstr *) ef_ptr(EF_SHIP, n) (struct shpstr *) ef_ptr(EF_SHIP, n)
extern double seagun(); extern double seagun(int effic, int guns);
extern struct mchrstr mchr[]; extern struct mchrstr mchr[];
extern int shp_maxno; extern int shp_maxno;
@ -216,8 +216,7 @@ struct mlist {
#define SHP_FIR(b, t) (t ? (b * (logx((double)t, (double)60.0) < 1.0 ? 1.0 : \ #define SHP_FIR(b, t) (t ? (b * (logx((double)t, (double)60.0) < 1.0 ? 1.0 : \
logx((double)t, (double)60.0))) : b) logx((double)t, (double)60.0))) : b)
double sqrt(); double logx(double d, double base);
double logx();
/* return codes from shp_check_nav */ /* return codes from shp_check_nav */
#define CN_NAVIGABLE (0) #define CN_NAVIGABLE (0)

View file

@ -43,8 +43,6 @@
#include "land.h" #include "land.h"
#include "ship.h" #include "ship.h"
#include "prototype.h"
struct trdstr { struct trdstr {
short ef_type; short ef_type;
natid trd_owner; natid trd_owner;
@ -76,7 +74,7 @@ union trdgenstr {
struct shpstr shp; struct shpstr shp;
}; };
s_char *trade_nameof _PROTO((struct trdstr * tp, union trdgenstr * tgp)); s_char *trade_nameof(struct trdstr * tp, union trdgenstr * tgp);
#define gettrade(n, p) \ #define gettrade(n, p) \
ef_read(EF_TRADE, n, (caddr_t)p) ef_read(EF_TRADE, n, (caddr_t)p)

View file

@ -53,7 +53,6 @@ struct range {
int height; int height;
}; };
extern s_char *xyfmt();
extern s_char *xyas(coord x, coord y, natid country); extern s_char *xyas(coord x, coord y, natid country);
extern s_char *ownxy(struct sctstr *sp); extern s_char *ownxy(struct sctstr *sp);
extern coord xrel(struct natstr *np, coord absx); extern coord xrel(struct natstr *np, coord absx);

View file

@ -46,10 +46,7 @@
#endif #endif
int int
expect(s, match, buf) expect(int s, int match, s_char *buf)
int s;
int match;
s_char *buf;
{ {
int size; int size;
s_char *p; s_char *p;
@ -143,10 +140,7 @@ s_char *buf;
} }
void void
sendcmd(s, cmd, arg) sendcmd(int s, int cmd, s_char *arg)
int s;
int cmd;
s_char *arg;
{ {
extern struct fn fnlist[]; extern struct fn fnlist[];
s_char buf[128]; s_char buf[128];

View file

@ -36,7 +36,7 @@
#define _FNLIST_H_ #define _FNLIST_H_
struct fn { struct fn {
int (*func) (); int (*func)(void);
s_char *name; s_char *name;
int value; int value;
}; };

View file

@ -37,8 +37,7 @@
#endif #endif
int int
handleintr(s) handleintr(int s)
int s;
{ {
extern int interrupt; extern int interrupt;

View file

@ -50,9 +50,7 @@
#include "misc.h" #include "misc.h"
int int
hostaddr(name, addr) hostaddr(s_char *name, struct sockaddr_in *addr)
s_char *name;
struct sockaddr_in *addr;
{ {
struct hostent *hp; struct hostent *hp;
@ -76,9 +74,7 @@ struct sockaddr_in *addr;
} }
int int
hostport(name, addr) hostport(s_char *name, struct sockaddr_in *addr)
s_char *name;
struct sockaddr_in *addr;
{ {
struct servent *sp; struct servent *sp;
@ -101,8 +97,7 @@ struct sockaddr_in *addr;
} }
int int
hostconnect(addr) hostconnect(struct sockaddr_in *addr)
struct sockaddr_in *addr;
{ {
int s; int s;

View file

@ -51,20 +51,18 @@ typedef struct iovec {
#endif #endif
static int ioqtobuf(); static int ioqtobuf(register struct ioqueue *ioq, s_char *buf, int cc);
static int ioqtoiov(); static int ioqtoiov(register struct ioqueue *ioq, register struct iovec *iov, register int max);
static void enqueuecc(); static void enqueuecc(struct ioqueue *ioq, s_char *buf, int cc);
static int dequeuecc(); static int dequeuecc(register struct ioqueue *ioq, register int cc);
void insque(); void insque(struct qelem *, struct qelem *);
void remque(); void remque(struct qelem *);
void initque(); void initque(struct qelem *p);
struct qelem *makeqt(); struct qelem *makeqt(int nelem);
void void
ioq_init(ioq, bsize) ioq_init(struct ioqueue *ioq, int bsize)
struct ioqueue *ioq;
int bsize;
{ {
extern s_char num_teles[]; extern s_char num_teles[];
@ -80,10 +78,7 @@ int bsize;
* return # of iovec initialized. * return # of iovec initialized.
*/ */
int int
ioq_peekiov(ioq, iov, max) ioq_peekiov(struct ioqueue *ioq, struct iovec *iov, int max)
struct ioqueue *ioq;
struct iovec *iov;
int max;
{ {
if (ioq->cc <= 0) if (ioq->cc <= 0)
return 0; return 0;
@ -96,18 +91,13 @@ int max;
* number of bytes actually found. * number of bytes actually found.
*/ */
int int
ioq_peek(ioq, buf, cc) ioq_peek(struct ioqueue *ioq, s_char *buf, int cc)
struct ioqueue *ioq;
s_char *buf;
int cc;
{ {
return ioqtobuf(ioq, buf, cc); return ioqtobuf(ioq, buf, cc);
} }
int int
ioq_dequeue(ioq, cc) ioq_dequeue(struct ioqueue *ioq, int cc)
struct ioqueue *ioq;
int cc;
{ {
if (dequeuecc(ioq, cc) != cc) if (dequeuecc(ioq, cc) != cc)
return 0; return 0;
@ -115,10 +105,7 @@ int cc;
} }
int int
ioq_read(ioq, buf, cc) ioq_read(struct ioqueue *ioq, s_char *buf, int cc)
struct ioqueue *ioq;
s_char *buf;
int cc;
{ {
int n; int n;
@ -129,24 +116,19 @@ int cc;
} }
void void
ioq_write(ioq, buf, cc) ioq_write(struct ioqueue *ioq, s_char *buf, int cc)
struct ioqueue *ioq;
s_char *buf;
int cc;
{ {
enqueuecc(ioq, buf, cc); enqueuecc(ioq, buf, cc);
} }
int int
ioq_qsize(ioq) ioq_qsize(struct ioqueue *ioq)
struct ioqueue *ioq;
{ {
return ioq->cc; return ioq->cc;
} }
void void
ioq_drain(ioq) ioq_drain(struct ioqueue *ioq)
struct ioqueue *ioq;
{ {
struct io *io; struct io *io;
struct qelem *qp; struct qelem *qp;
@ -161,10 +143,7 @@ struct ioqueue *ioq;
} }
s_char * s_char *
ioq_gets(ioq, buf, cc) ioq_gets(struct ioqueue *ioq, s_char *buf, int cc)
struct ioqueue *ioq;
s_char *buf;
int cc;
{ {
register s_char *p; register s_char *p;
register s_char *end; register s_char *end;
@ -195,10 +174,7 @@ int cc;
* left for a higher level. * left for a higher level.
*/ */
static int static int
ioqtobuf(ioq, buf, cc) ioqtobuf(register struct ioqueue *ioq, s_char *buf, int cc)
register struct ioqueue *ioq;
s_char *buf;
int cc;
{ {
register struct io *io; register struct io *io;
struct qelem *qp; struct qelem *qp;
@ -235,10 +211,7 @@ int cc;
* of a full ioqueue still be quick. * of a full ioqueue still be quick.
*/ */
static int static int
ioqtoiov(ioq, iov, max) ioqtoiov(register struct ioqueue *ioq, register struct iovec *iov, register int max)
register struct ioqueue *ioq;
register struct iovec *iov;
register int max;
{ {
register struct io *io; register struct io *io;
register int cc; register int cc;
@ -265,10 +238,7 @@ register int max;
* append a buffer to the end of the ioq. * append a buffer to the end of the ioq.
*/ */
static void static void
enqueuecc(ioq, buf, cc) enqueuecc(struct ioqueue *ioq, s_char *buf, int cc)
struct ioqueue *ioq;
s_char *buf;
int cc;
{ {
struct io *io; struct io *io;
@ -286,9 +256,7 @@ int cc;
* which are no longer used. * which are no longer used.
*/ */
static int static int
dequeuecc(ioq, cc) dequeuecc(register struct ioqueue *ioq, register int cc)
register struct ioqueue *ioq;
register int cc;
{ {
register struct io *io; register struct io *io;
register struct qelem *qp; register struct qelem *qp;

View file

@ -43,16 +43,11 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
int expect(); int expect(int s, int match, s_char *buf);
void sendcmd(); void sendcmd(int s, int cmd, s_char *arg);
int int
login(s, uname, cname, cpass, kill_proc) login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc)
int s;
s_char *uname;
s_char *cname;
s_char *cpass;
int kill_proc;
{ {
s_char tmp[128]; s_char tmp[128];
s_char buf[1024]; s_char buf[1024];

View file

@ -72,27 +72,25 @@ HANDLE hStdIn;
int interrupt; int interrupt;
int sock; int sock;
void saveargv(); void saveargv(int ac, s_char **src, s_char **dst);
void getsose(); void getsose(void);
int hostport(); int hostport(s_char *name, struct sockaddr_in *addr);
int hostaddr(); int hostaddr(s_char *name, struct sockaddr_in *addr);
int hostconnect(); int hostconnect(struct sockaddr_in *addr);
int login(); int login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc);
void ioq_init(); void ioq_init(struct ioqueue *ioq, int bsize);
void io_init(); void io_init(void);
int handleintr(); int handleintr(int);
int termio(); int termio(int fd, int sock, FILE *auxfi);
int serverio(); int serverio(int s, struct ioqueue *ioq);
void servercmd(); void servercmd(struct ioqueue *ioq, FILE *auxfi);
void ioq_drain(); void ioq_drain(struct ioqueue *ioq);
static void intr(int sig); static void intr(int sig);
int int
main(ac, av) main(int ac, s_char **av)
int ac;
s_char *av[];
{ {
#ifdef _WIN32 #ifdef _WIN32
WSADATA WsaData; WSADATA WsaData;

View file

@ -39,9 +39,7 @@
#include "queue.h" #include "queue.h"
void void
insque(p, q) insque(struct qelem *p, struct qelem *q)
struct qelem *p;
struct qelem *q;
{ {
p->q_forw = q->q_forw; p->q_forw = q->q_forw;
p->q_back = q; p->q_back = q;
@ -50,24 +48,21 @@ struct qelem *q;
} }
void void
remque(p) remque(struct qelem *p)
struct qelem *p;
{ {
p->q_back->q_forw = p->q_forw; p->q_back->q_forw = p->q_forw;
p->q_forw->q_back = p->q_back; p->q_forw->q_back = p->q_back;
} }
void void
initque(p) initque(struct qelem *p)
struct qelem *p;
{ {
p->q_forw = p; p->q_forw = p;
p->q_back = p; p->q_back = p;
} }
struct qelem * struct qelem *
makeqt(nelem) makeqt(int nelem)
int nelem;
{ {
struct qelem *table; struct qelem *table;
struct qelem *qp; struct qelem *qp;

View file

@ -36,10 +36,7 @@
#include "misc.h" #include "misc.h"
void void
saveargv(ac, src, dst) saveargv(int ac, s_char **src, s_char **dst)
int ac;
s_char **src;
s_char **dst;
{ {
register s_char *ptr; register s_char *ptr;
register int i; register int i;

View file

@ -48,7 +48,7 @@
#include <io.h> #include <io.h>
#endif #endif
extern s_char *gettag(); extern s_char *gettag(s_char *p);
s_char num_teles[64]; s_char num_teles[64];
static s_char the_prompt[1024]; static s_char the_prompt[1024];
@ -59,23 +59,21 @@ FILE *redir_fp;
FILE *pipe_fp; FILE *pipe_fp;
int exec_fd; int exec_fd;
void prompt(); void prompt(FILE *auxfi);
void doredir(); void doredir(s_char *p);
void dopipe(); void dopipe(s_char *p);
void doexecute(); void doexecute(s_char *p, FILE *auxfi);
void output(); void output(int code, s_char *buf, FILE *auxfi);
void screen(); void screen(register s_char *buf);
int sendeof(); int sendeof(int);
int termio(); int termio(int fd, int sock, FILE *auxfi);
void _noecho(); void _noecho(int);
extern s_char *SO; extern s_char *SO;
extern s_char *SE; extern s_char *SE;
void void
servercmd(ioq, auxfi) servercmd(struct ioqueue *ioq, FILE *auxfi)
struct ioqueue *ioq;
FILE *auxfi;
{ {
s_char *ioq_gets(struct ioqueue *, s_char *, int); s_char *ioq_gets(struct ioqueue *, s_char *, int);
s_char buf[1024]; s_char buf[1024];
@ -133,8 +131,7 @@ FILE *auxfi;
} }
void void
prompt(auxfi) prompt(FILE *auxfi)
FILE *auxfi;
{ {
if (mode == C_PROMPT) { if (mode == C_PROMPT) {
if (redir_fp) { if (redir_fp) {
@ -166,8 +163,7 @@ FILE *auxfi;
* opens redir_fp if successful * opens redir_fp if successful
*/ */
void void
doredir(p) doredir(s_char *p)
s_char *p;
{ {
s_char *how; s_char *how;
s_char *name; s_char *name;
@ -219,8 +215,7 @@ s_char *p;
* opens "pipe_fp" if successful * opens "pipe_fp" if successful
*/ */
void void
dopipe(p) dopipe(s_char *p)
s_char *p;
{ {
s_char *tag; s_char *tag;
@ -250,9 +245,7 @@ s_char *p;
} }
void void
doexecute(p, auxfi) doexecute(s_char *p, FILE *auxfi)
s_char *p;
FILE *auxfi;
{ {
extern int sock; extern int sock;
int fd; int fd;
@ -296,10 +289,7 @@ FILE *auxfi;
} }
void void
output(code, buf, auxfi) output(int code, s_char *buf, FILE *auxfi)
int code;
s_char *buf;
FILE *auxfi;
{ {
switch (code) { switch (code) {
case C_NOECHO: case C_NOECHO:
@ -357,8 +347,7 @@ FILE *auxfi;
} }
void void
screen(buf) screen(register s_char *buf)
register s_char *buf;
{ {
register s_char *sop; register s_char *sop;
register s_char c; register s_char c;

View file

@ -47,12 +47,10 @@
#include <io.h> #include <io.h>
#endif #endif
void ioq_write(); void ioq_write(struct ioqueue *ioq, s_char *buf, int cc);
int int
serverio(s, ioq) serverio(int s, struct ioqueue *ioq)
int s;
struct ioqueue *ioq;
{ {
s_char *buf; s_char *buf;
int n; int n;

View file

@ -48,7 +48,7 @@ s_char exec[8];
static unsigned short tagnum; static unsigned short tagnum;
void void
io_init() io_init(void)
{ {
taglist = NULL; taglist = NULL;
buf[0] = 0; buf[0] = 0;
@ -57,8 +57,7 @@ io_init()
} }
s_char * s_char *
gettag(p) gettag(s_char *p)
s_char *p;
{ {
struct tagstruct *tag1, *tag2; struct tagstruct *tag1, *tag2;

View file

@ -60,13 +60,10 @@ extern s_char exec[];
extern HANDLE hStdIn; extern HANDLE hStdIn;
#endif #endif
int sendeof(); int sendeof(int sock);
int int
termio(fd, sock, auxfi) termio(int fd, int sock, FILE *auxfi)
int fd;
int sock;
FILE *auxfi;
{ {
s_char out[4096]; s_char out[4096];
int i, n; int i, n;
@ -226,8 +223,7 @@ FILE *auxfi;
} }
int int
sendeof(sock) sendeof(int sock)
int sock;
{ {
#ifndef _WIN32 #ifndef _WIN32
if (write(sock, "ctld\n", 5) < 5) { if (write(sock, "ctld\n", 5) < 5) {
@ -245,8 +241,7 @@ int echomode = 1;
#if defined(hpux) || defined(aix) || defined (sgi) || defined(linux) #if defined(hpux) || defined(aix) || defined (sgi) || defined(linux)
void void
_noecho(fd) _noecho(int fd)
int fd;
{ {
struct termio io; struct termio io;
@ -257,8 +252,7 @@ int fd;
} }
void void
_echo(fd) _echo(int fd)
int fd;
{ {
struct termio io; struct termio io;

View file

@ -45,11 +45,10 @@
s_char *SO = 0; s_char *SO = 0;
s_char *SE = 0; s_char *SE = 0;
int tgetent(); int tgetent(char *, char *);
void void
parsedelay(r) parsedelay(s_char *r)
s_char *r;
{ {
s_char *s, *t; s_char *s, *t;
@ -64,10 +63,10 @@ s_char *r;
} }
void void
getsose() getsose(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
extern s_char *tgetstr(); extern s_char *tgetstr(char *, char **);
s_char *cp; s_char *cp;
s_char *term; s_char *term;
static s_char tbuf[1024]; static s_char tbuf[1024];

View file

@ -54,7 +54,7 @@ char *_ipglob_copyright_header =
int int
main() main(void)
{ {
char buf[256]; char buf[256];
char *cp; char *cp;

View file

@ -165,9 +165,9 @@ extern struct as_path *as_find_cachepath(coord fx,
/* Functions that are "private" to algorithm */ /* Functions that are "private" to algorithm */
extern void as_add_cachepath(struct as_data *adp); extern void as_add_cachepath(struct as_data *adp);
extern void as_clear_cachepath(); extern void as_clear_cachepath(void);
extern void as_enable_cachepath(); extern void as_enable_cachepath(void);
extern void as_disable_cachepath(); extern void as_disable_cachepath(void);
extern void as_makepath(struct as_data *adp); extern void as_makepath(struct as_data *adp);
extern void as_free_path(struct as_path *pp); extern void as_free_path(struct as_path *pp);

View file

@ -55,13 +55,13 @@ static struct as_frompath **fromhead = (struct as_frompath **)0;
static int as_cachepath_on = 0; /* Default to off */ static int as_cachepath_on = 0; /* Default to off */
void void
as_enable_cachepath() as_enable_cachepath(void)
{ {
as_cachepath_on = 1; as_cachepath_on = 1;
} }
void void
as_disable_cachepath() as_disable_cachepath(void)
{ {
as_cachepath_on = 0; as_cachepath_on = 0;
} }
@ -135,7 +135,7 @@ as_add_cachepath(struct as_data *adp)
} }
void void
as_clear_cachepath() as_clear_cachepath(void)
{ {
struct as_frompath *from, *from2; struct as_frompath *from, *from2;
struct as_topath *to, *to2; struct as_topath *to, *to2;

View file

@ -47,7 +47,6 @@ as_search(struct as_data *adp)
struct as_queue *qp; struct as_queue *qp;
struct as_path *pp; struct as_path *pp;
#endif /* DEBUG */ #endif /* DEBUG */
struct as_queue *as_extend(struct as_data *adp);
as_reset(adp); as_reset(adp);

View file

@ -67,7 +67,6 @@ anti(void)
double odds, damil, dache; double odds, damil, dache;
int mob; int mob;
int n_cheleft; int n_cheleft;
extern double hap_fact();
if (!snxtsct(&nstr, player->argp[1])) if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN; return RET_SYN;

View file

@ -48,7 +48,7 @@ int
best(void) best(void)
{ {
double cost; double cost;
s_char *BestDistPath(), *BestLandPath(), *s; s_char *s;
struct sctstr s1, s2; struct sctstr s1, s2;
struct nstr_sect nstr, nstr2; struct nstr_sect nstr, nstr2;
s_char buf[1024]; s_char buf[1024];

View file

@ -214,7 +214,6 @@ bomb(void)
static void static void
pin_bomb(struct emp_qelem *list, struct sctstr *target) pin_bomb(struct emp_qelem *list, struct sctstr *target)
{ {
extern s_char *effadv();
struct dchrstr *dcp; struct dchrstr *dcp;
int nplanes; int nplanes;
int nships; int nships;

View file

@ -348,7 +348,6 @@ calc_all(long int (*p_sect)[2], int *taxes, int *Ncivs, int *Nuws,
extern long lnd_money[MAXNOC]; extern long lnd_money[MAXNOC];
extern long air_money[MAXNOC]; extern long air_money[MAXNOC];
extern long tpops[MAXNOC]; extern long tpops[MAXNOC];
extern int mil_dbl_pay;
lnd_money[player->cnum] = sea_money[player->cnum] = 0; lnd_money[player->cnum] = sea_money[player->cnum] = 0;
air_money[player->cnum] = 0; air_money[player->cnum] = 0;

View file

@ -31,6 +31,7 @@
* Steve McClure, 1998-2000 * Steve McClure, 1998-2000
*/ */
#include <math.h>
#ifdef Rel4 #ifdef Rel4
#include <string.h> #include <string.h>
#endif /* Rel4 */ #endif /* Rel4 */
@ -69,9 +70,6 @@ static int build_plane(register struct sctstr *sp,
static int cash; /* static ok */ static int cash; /* static ok */
double sqrt(double);
double logx();
extern int morale_base; extern int morale_base;
extern int sect_mob_neg_factor; extern int sect_mob_neg_factor;
extern int etu_per_update; extern int etu_per_update;
@ -494,7 +492,6 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
int points; int points;
struct natstr *natp; struct natstr *natp;
float eff = ((float)LAND_MINEFF / 100.0); float eff = ((float)LAND_MINEFF / 100.0);
double techfact(int, double);
int mil, lcm, hcm, gun, shell; int mil, lcm, hcm, gun, shell;
int freeland = 0; int freeland = 0;

View file

@ -111,9 +111,7 @@ static int
cons_choose(struct ltcomstr *ltcp) cons_choose(struct ltcomstr *ltcp)
{ {
s_char *p; s_char *p;
extern int disloan(); int (*dis)();
extern int distrea();
int (*dis) ();
struct lonstr *lp; struct lonstr *lp;
struct trtstr *tp; struct trtstr *tp;
s_char prompt[128]; s_char prompt[128];

View file

@ -71,8 +71,6 @@ static long
do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash, do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash,
int for_real) int for_real)
{ {
extern int opt_NO_LCMS;
extern int opt_NO_HCMS;
register int n; register int n;
s_char *p; s_char *p;
int breaksanct; int breaksanct;

View file

@ -53,7 +53,6 @@
int int
diss(void) diss(void)
{ {
int quit(void);
struct sctstr sect; struct sctstr sect;
struct lndstr land; struct lndstr land;
struct shpstr ship; struct shpstr ship;

View file

@ -51,7 +51,6 @@ land(void)
struct nstr_item ni; struct nstr_item ni;
struct lndstr land; struct lndstr land;
int vec[I_MAX + 1]; int vec[I_MAX + 1];
s_char *mission_short_name();
if (!snxtitem(&ni, EF_LAND, player->argp[1])) if (!snxtitem(&ni, EF_LAND, player->argp[1]))
return RET_SYN; return RET_SYN;

View file

@ -53,7 +53,7 @@ ldump(void)
struct nstr_item ni; struct nstr_item ni;
struct lndstr land; struct lndstr land;
int vec[I_MAX + 1]; int vec[I_MAX + 1];
s_char *mission_short_name(); s_char *mission_short_name(int);
int n, i; int n, i;
struct natstr *np; struct natstr *np;
time_t now; time_t now;

View file

@ -257,7 +257,6 @@ look_land(register struct lndstr *lookland)
int vrange; int vrange;
int i; int i;
int dist; int dist;
double techfact(int, double);
drange = techfact(lookland->lnd_tech, (double)lookland->lnd_spy); drange = techfact(lookland->lnd_tech, (double)lookland->lnd_spy);
drange = (drange * ((double)lookland->lnd_effic / 100.0)); drange = (drange * ((double)lookland->lnd_effic / 100.0));

View file

@ -50,7 +50,7 @@ lsta(void)
int nunits; int nunits;
struct nstr_item ni; struct nstr_item ni;
struct lndstr land; struct lndstr land;
s_char *mission_short_name(); s_char *mission_short_name(int);
if (!snxtitem(&ni, EF_LAND, player->argp[1])) if (!snxtitem(&ni, EF_LAND, player->argp[1]))
return RET_SYN; return RET_SYN;

View file

@ -57,7 +57,7 @@ mark(void)
return display_mark(" "); return display_mark(" ");
} }
void static void
pr_mark(struct comstr *comm) pr_mark(struct comstr *comm)
{ {
time_t now; time_t now;

View file

@ -780,7 +780,6 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
struct sctstr firing; struct sctstr firing;
struct nstr_sect ns; struct nstr_sect ns;
struct flist *fp; struct flist *fp;
double techfact(int, double);
extern int torpedo_damage; extern int torpedo_damage;
int gun; int gun;

View file

@ -71,7 +71,6 @@ mission(void)
extern int land_mob_max; extern int land_mob_max;
extern int plane_mob_max; extern int plane_mob_max;
extern double mission_mob_cost; extern double mission_mob_cost;
s_char *nameofitem();
s_char prompt[128]; s_char prompt[128];
s_char buf[1024]; s_char buf[1024];

View file

@ -53,7 +53,6 @@ morale(void)
int i, min; int i, min;
s_char *p; s_char *p;
s_char mess[128]; s_char mess[128];
double techfact(int, double);
s_char buf[1024]; s_char buf[1024];
if (!snxtitem(&np, EF_LAND, player->argp[1])) if (!snxtitem(&np, EF_LAND, player->argp[1]))

View file

@ -46,8 +46,8 @@
#include "optlist.h" #include "optlist.h"
#include "commands.h" #include "commands.h"
#include <fcntl.h> #include <fcntl.h>
#include <math.h>
extern float start_education, start_happiness; extern float start_education, start_happiness;
extern float start_technology, start_research; extern float start_technology, start_research;
@ -321,7 +321,6 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
struct lchrstr *lp; struct lchrstr *lp;
struct nstr_item nstr; struct nstr_item nstr;
struct natstr *natp; struct natstr *natp;
double techfact(int, double);
int lvec[I_MAX + 1]; int lvec[I_MAX + 1];
int extend = 1; int extend = 1;

View file

@ -58,7 +58,7 @@ path(void)
coord cx, cy; coord cx, cy;
int i; int i;
int y; int y;
s_char *pp, *p, *BestDistPath(); s_char *pp, *p;
/* Note this is not re-entrant anyway, so we keep the buffers /* Note this is not re-entrant anyway, so we keep the buffers
around */ around */
static s_char *mapbuf = (s_char *)0; static s_char *mapbuf = (s_char *)0;

View file

@ -38,8 +38,7 @@
#include "nat.h" #include "nat.h"
#include "file.h" #include "file.h"
#include "commands.h" #include "commands.h"
#include "prototypes.h"
extern void shutdown_sequence();
int int
shut(void) shut(void)

View file

@ -42,6 +42,7 @@
#include "path.h" #include "path.h"
#include "file.h" #include "file.h"
#include "commands.h" #include "commands.h"
#include "combat.h"
int int
sinfra(void) sinfra(void)
@ -49,8 +50,6 @@ sinfra(void)
struct sctstr sect; struct sctstr sect;
int nsect; int nsect;
struct nstr_sect nstr; struct nstr_sect nstr;
double sector_mcost();
double sector_strength(struct sctstr *);
if (!snxtsct(&nstr, player->argp[1])) if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN; return RET_SYN;

View file

@ -49,7 +49,7 @@
int int
thre(void) thre(void)
{ {
extern struct ichrstr *whatitem(); extern struct ichrstr *whatitem(s_char *, s_char *);
struct sctstr sect; struct sctstr sect;
struct nstr_sect nstr; struct nstr_sect nstr;
int val; int val;

View file

@ -32,6 +32,8 @@
* Steve McClure, 1996-2000 * Steve McClure, 1996-2000
*/ */
#include <math.h>
#include "misc.h" #include "misc.h"
#include "player.h" #include "player.h"
#include "xy.h" #include "xy.h"

View file

@ -424,8 +424,6 @@ ef_flags(int type)
time_t time_t
ef_mtime(int type) ef_mtime(int type)
{ {
extern time_t fdate(int fd);
if (empfile[type].fd <= 0) if (empfile[type].fd <= 0)
return 0; return 0;
return fdate(empfile[type].fd); return fdate(empfile[type].fd);

View file

@ -110,8 +110,6 @@ kw_find(s_char *name)
s_char * s_char *
kw_parse(int type, s_char *text, int *data) kw_parse(int type, s_char *text, int *data)
{ {
s_char *get_time(s_char *ptr, int *data);
s_char *weekday(s_char *ptr, int *data);
s_char *next; s_char *next;
while (isspace(*text)) while (isspace(*text))

View file

@ -51,7 +51,7 @@
static s_char *logfile = 0; static s_char *logfile = 0;
s_char * s_char *
getlogfile() getlogfile(void)
{ {
return (s_char *)logfile; return (s_char *)logfile;
} }

View file

@ -441,19 +441,19 @@ bp_coord_hash(struct as_coord c)
} }
void void
bp_enable_cachepath() bp_enable_cachepath(void)
{ {
as_enable_cachepath(); as_enable_cachepath();
} }
void void
bp_disable_cachepath() bp_disable_cachepath(void)
{ {
as_disable_cachepath(); as_disable_cachepath();
} }
void void
bp_clear_cachepath() bp_clear_cachepath(void)
{ {
as_clear_cachepath(); as_clear_cachepath();
} }

View file

@ -49,6 +49,7 @@
#include "gen.h" #include "gen.h"
#include "subs.h" #include "subs.h"
#include "lost.h" #include "lost.h"
#include "combat.h"
int int
sect_damage(struct sctstr *sp, int dam, struct emp_qelem *list) sect_damage(struct sctstr *sp, int dam, struct emp_qelem *list)
@ -93,7 +94,6 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
struct plnstr plane; struct plnstr plane;
double real_dam; double real_dam;
int eff; int eff;
double sector_strength();
/* Some sectors are harder/easier to kill.. */ /* Some sectors are harder/easier to kill.. */
/* Average sector has a dstr of 1, so adjust */ /* Average sector has a dstr of 1, so adjust */

View file

@ -46,8 +46,8 @@ empth_init(char **ctx, int flags)
empth_t * empth_t *
empth_create(int prio, void (*entry) (), int size, int flags, char *name, empth_create(int prio, void (*entry)(void *), int size, int flags,
char *desc, void *ud) char *name, char *desc, void *ud)
{ {
/* inherit flags */ /* inherit flags */
if (!flags) if (!flags)

View file

@ -390,7 +390,7 @@ empth_init(char **ctx_ptr, int flags)
* It is also passed to the entry function... * It is also passed to the entry function...
*/ */
empth_t * empth_t *
empth_create(int prio, void (*entry) (), int size, int flags, empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud) char *name, char *desc, void *ud)
{ {
loc_Thread_t *pThread = NULL; loc_Thread_t *pThread = NULL;

View file

@ -57,9 +57,9 @@ static pthread_mutex_t mtx_ctxsw; /* thread in critical section */
#if 0 #if 0
static void empth_setctx _PROTO((void *)); static void empth_setctx(void *);
#endif #endif
static void empth_restorectx _PROTO(()); static void empth_restorectx();
static void * static void *
empth_start(void *ctx) empth_start(void *ctx)
@ -176,7 +176,7 @@ empth_init(char **ctx_ptr, int flags)
* More then that priority is not needed even in lwp threads. * More then that priority is not needed even in lwp threads.
*/ */
empth_t * empth_t *
empth_create(int prio, void (*entry) (), int size, int flags, empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud) char *name, char *desc, void *ud)
{ {
pthread_t t; pthread_t t;

View file

@ -392,9 +392,8 @@ struct keymatch configkeys[] = {
{NULL, NULL, (caddr_t)0, 0, NULL} {NULL, NULL, (caddr_t)0, 0, NULL}
}; };
static void fixup_files _PROTO((void)); static void fixup_files(void);
static struct keymatch *keylookup static struct keymatch *keylookup(s_char *key, struct keymatch tbl[]);
_PROTO((s_char *key, struct keymatch tbl[]));
/* /*

View file

@ -37,8 +37,6 @@
s_char * s_char *
getstarg(s_char *input, s_char *prompt, s_char *buf) getstarg(s_char *input, s_char *prompt, s_char *buf)
{ {
extern s_char *getstring(s_char *prompt, s_char *buf);
*buf = '\0'; *buf = '\0';
if (input == 0 || *input == 0) { if (input == 0 || *input == 0) {
if (getstring(prompt, buf) == 0) if (getstring(prompt, buf) == 0)

View file

@ -72,7 +72,7 @@ struct iop {
int flags; int flags;
s_char *assoc; s_char *assoc;
int bufsize; int bufsize;
int (*notify) (); int (*notify)(void);
}; };
void void
@ -81,7 +81,7 @@ io_init(void)
} }
struct iop * struct iop *
io_open(int fd, int flags, int bufsize, int (*notify) (void), io_open(int fd, int flags, int bufsize, int (*notify)(void),
s_char *assoc) s_char *assoc)
{ {
struct iop *iop; struct iop *iop;

View file

@ -37,7 +37,6 @@
int int
onearg(s_char *arg, s_char *prompt) onearg(s_char *arg, s_char *prompt)
{ {
extern s_char *getstring(s_char *prompt, s_char *buf);
int n; int n;
s_char buf[1024]; s_char buf[1024];

View file

@ -48,7 +48,8 @@ static struct lwpProc *tempcontext;
struct lwpProc *initcontext = NULL; struct lwpProc *initcontext = NULL;
int startpoint; int startpoint;
startcontext() static void
startcontext(void)
{ {
int space[10000]; int space[10000];
int x; int x;
@ -64,9 +65,7 @@ startcontext()
} }
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
struct lwpProc holder; struct lwpProc holder;
int endpoint; int endpoint;
@ -96,9 +95,7 @@ void *sp;
#elif defined(hpux) #elif defined(hpux)
void void
lwpInitContext(newp, sp) lwpInitContext(volatile struct lwpProc *volatile newp, void *sp)
volatile struct lwpProc *volatile newp;
void *sp;
{ {
static jmp_buf *cpp; static jmp_buf *cpp;
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;
@ -113,8 +110,7 @@ void *sp;
} }
int int
lwpSave(jb) lwpSave(jmp_buf jb)
jmp_buf jb;
{ {
/* save stack pointer and return program counter */ /* save stack pointer and return program counter */
asm("stw %sp, 4(%arg0)"); asm("stw %sp, 4(%arg0)");
@ -149,8 +145,7 @@ jmp_buf jb;
} }
void void
lwpRestore(jb) lwpRestore(jmp_buf jb)
jmp_buf jb;
{ {
/* restore stack pointer and program counter */ /* restore stack pointer and program counter */
asm volatile ("ldw 4(%arg0), %sp"); asm volatile ("ldw 4(%arg0), %sp");
@ -185,9 +180,7 @@ jmp_buf jb;
#elif defined(BSD386) #elif defined(BSD386)
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
newp->context[2] = (int)sp; newp->context[2] = (int)sp;
newp->context[0] = (int)lwpEntryPoint; newp->context[0] = (int)lwpEntryPoint;
@ -196,9 +189,7 @@ void *sp;
#elif defined(FBSD) #elif defined(FBSD)
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
setjmp(newp->context); setjmp(newp->context);
newp->context->_jb[2] = (int)sp; newp->context->_jb[2] = (int)sp;
@ -209,9 +200,7 @@ void *sp;
#elif defined(__linux__) #elif defined(__linux__)
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
#if defined(__GLIBC__) && (__GLIBC__ >= 2) #if defined(__GLIBC__) && (__GLIBC__ >= 2)
#if defined(__PPC__) #if defined(__PPC__)
@ -232,9 +221,7 @@ void *sp;
#elif defined(SUN3) #elif defined(SUN3)
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
newp->context[2] = (int)sp; newp->context[2] = (int)sp;
newp->context[3] = (int)lwpEntryPoint; newp->context[3] = (int)lwpEntryPoint;
@ -245,9 +232,7 @@ void *sp;
#include <stdio.h> #include <stdio.h>
void void
lwpInitContext(newp, stack) lwpInitContext(struct lwpProc *newp, void *stack)
struct lwpProc *newp;
void *stack;
{ {
int *sp = (int *)stack; int *sp = (int *)stack;
int *fp = 0; int *fp = 0;
@ -282,8 +267,7 @@ void *stack;
} }
int int
lwpSave(jb) lwpSave(jmp_buf jb)
jmp_buf jb;
{ {
asm("movl 4(ap), r0"); /* r0 = &jb */ asm("movl 4(ap), r0"); /* r0 = &jb */
asm("movl r6, (r0)"); /* jb[0] = r6 */ asm("movl r6, (r0)"); /* jb[0] = r6 */
@ -298,8 +282,7 @@ jmp_buf jb;
} }
void void
lwpRestore(jb) lwpRestore(jmp_buf jb)
jmp_buf jb;
{ {
asm("movl 4(ap), r0"); /* r0 = &jb */ asm("movl 4(ap), r0"); /* r0 = &jb */
asm("movl (r0), r6"); /* r6 = jb[0] */ asm("movl (r0), r6"); /* r6 = jb[0] */
@ -319,9 +302,7 @@ jmp_buf jb;
#elif defined(SUN4) #elif defined(SUN4)
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
static jmp_buf *cpp; static jmp_buf *cpp;
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;
@ -377,9 +358,7 @@ void *sp;
*/ */
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
newp->context[4] = (int)sp; newp->context[4] = (int)sp;
newp->context[5] = (int)lwpEntryPoint; newp->context[5] = (int)lwpEntryPoint;
@ -395,9 +374,7 @@ void *sp;
*/ */
void void
lwpInitContext(newp, spp) lwpInitContext(struct lwpProc *newp, stack_t *spp)
struct lwpProc *newp;
stack_t *spp;
{ {
getcontext(&(newp->context)); getcontext(&(newp->context));
newp->context.uc_stack.ss_sp = spp->ss_sp; newp->context.uc_stack.ss_sp = spp->ss_sp;
@ -410,9 +387,7 @@ stack_t *spp;
#include <c_asm.h> #include <c_asm.h>
void void
lwpInitContext(newp, sp) lwpInitContext(struct lwpProc *newp, void *sp)
struct lwpProc *newp;
void *sp;
{ {
extern long *_gp; extern long *_gp;
@ -425,15 +400,13 @@ void *sp;
} }
int int
lwpSave(jb) lwpSave(jmp_buf jb)
jmp_buf jb;
{ {
return _setjmp(jb); return _setjmp(jb);
} }
void void
lwpRestore(jb) lwpRestore(jmp_buf jb)
jmp_buf jb;
{ {
/* resume, but get the pv from the jmp_buf */ /* resume, but get the pv from the jmp_buf */
asm("ldq %pv, 248(%a0)"); asm("ldq %pv, 248(%a0)");

View file

@ -58,14 +58,13 @@ static int oldmask;
extern char *strdup(); extern char *strdup();
#endif /* NOSTRDUP */ #endif /* NOSTRDUP */
static void lwpStackCheckInit(); static void lwpStackCheckInit(struct lwpProc *newp);
static int lwpStackCheck(); static int lwpStackCheck(struct lwpProc *newp);
static void lwpStackCheckUsed(); static void lwpStackCheckUsed(struct lwpProc *newp);
/* check stack direction */ /* check stack direction */
static int static int
growsdown(x) growsdown(void *x)
void *x;
{ {
int y; int y;
@ -86,7 +85,7 @@ void *x;
* processes here and free them. * processes here and free them.
*/ */
void void
lwpReschedule() lwpReschedule(void)
{ {
extern struct lwpQueue LwpSchedQ[]; extern struct lwpQueue LwpSchedQ[];
static int lcount = LCOUNT; static int lcount = LCOUNT;
@ -195,9 +194,8 @@ lwpReschedule()
* lwpEntryPoint -- process entry point. * lwpEntryPoint -- process entry point.
*/ */
void void
lwpEntryPoint() lwpEntryPoint(void)
{ {
extern struct lwpProc *LwpCurrent;
#ifdef POSIXSIGNALS #ifdef POSIXSIGNALS
sigset_t set; sigset_t set;
#endif /* POSIXSIGNALS */ #endif /* POSIXSIGNALS */
@ -215,8 +213,7 @@ lwpEntryPoint()
*LwpContextPtr = LwpCurrent->ud; *LwpContextPtr = LwpCurrent->ud;
lwpStatus(LwpCurrent, "starting at entry point"); lwpStatus(LwpCurrent, "starting at entry point");
(*LwpCurrent->entry) (LwpCurrent->argc, LwpCurrent->argv, (*LwpCurrent->entry)(LwpCurrent->ud);
LwpCurrent->ud);
lwpExit(); lwpExit();
#ifdef BOUNDS_CHECK #ifdef BOUNDS_CHECK
BOUNDS_CHECKING_ON; BOUNDS_CHECKING_ON;
@ -229,18 +226,8 @@ lwpEntryPoint()
* lwpCreate -- create a process. * lwpCreate -- create a process.
*/ */
struct lwpProc * struct lwpProc *
lwpCreate(priority, entry, size, flags, name, desc, argc, argv, ud) lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name, char *desc, int argc, char **argv, void *ud)
int priority;
void (*entry) ();
int size;
int flags;
char *name;
char *desc;
int argc;
char *argv[];
void *ud;
{ {
extern struct lwpProc *LwpCurrent;
struct lwpProc *newp; struct lwpProc *newp;
int *s, x; int *s, x;
#ifdef UCONTEXT #ifdef UCONTEXT
@ -329,8 +316,7 @@ void *ud;
} }
void void
lwpDestroy(proc) lwpDestroy(struct lwpProc *proc)
struct lwpProc *proc;
{ {
if (proc->flags & LWP_STACKCHECK) { if (proc->flags & LWP_STACKCHECK) {
lwpStackCheckUsed(proc); lwpStackCheckUsed(proc);
@ -355,12 +341,8 @@ struct lwpProc *proc;
* lwpReady -- put process on ready queue. if null, assume current. * lwpReady -- put process on ready queue. if null, assume current.
*/ */
void void
lwpReady(p) lwpReady(struct lwpProc *p)
struct lwpProc *p;
{ {
extern struct lwpProc *LwpCurrent;
extern struct lwpQueue LwpSchedQ[];
if (!p) if (!p)
p = LwpCurrent; p = LwpCurrent;
lwpStatus(p, "added to run queue"); lwpStatus(p, "added to run queue");
@ -371,8 +353,7 @@ struct lwpProc *p;
* return user's data * return user's data
*/ */
void * void *
lwpGetUD(p) lwpGetUD(struct lwpProc *p)
struct lwpProc *p;
{ {
if (!p) if (!p)
p = LwpCurrent; p = LwpCurrent;
@ -383,9 +364,7 @@ struct lwpProc *p;
* set user's data * set user's data
*/ */
void void
lwpSetUD(p, ud) lwpSetUD(struct lwpProc *p, char *ud)
struct lwpProc *p;
char *ud;
{ {
if (!p) if (!p)
p = LwpCurrent; p = LwpCurrent;
@ -396,10 +375,7 @@ char *ud;
* set name & desc * set name & desc
*/ */
void void
lwpSetDesc(p, name, desc) lwpSetDesc(struct lwpProc *p, char *name, char *desc)
struct lwpProc *p;
char *name;
char *desc;
{ {
if (!p) if (!p)
p = LwpCurrent; p = LwpCurrent;
@ -413,7 +389,7 @@ char *desc;
* lwpYield -- yield the processor to another thread. * lwpYield -- yield the processor to another thread.
*/ */
void void
lwpYield() lwpYield(void)
{ {
lwpStatus(LwpCurrent, "yielding control"); lwpStatus(LwpCurrent, "yielding control");
lwpReady(LwpCurrent); lwpReady(LwpCurrent);
@ -424,7 +400,7 @@ lwpYield()
* cause the current process to be scheduled for deletion. * cause the current process to be scheduled for deletion.
*/ */
void void
lwpExit() lwpExit(void)
{ {
lwpStatus(LwpCurrent, "marking self as dead"); lwpStatus(LwpCurrent, "marking self as dead");
LwpCurrent->dead = 1; LwpCurrent->dead = 1;
@ -436,8 +412,7 @@ lwpExit()
* remove any lingering FD action * remove any lingering FD action
*/ */
void void
lwpTerminate(p) lwpTerminate(struct lwpProc *p)
struct lwpProc *p;
{ {
lwpStatus(p, "terminating process"); lwpStatus(p, "terminating process");
p->dead = 1; p->dead = 1;
@ -450,8 +425,7 @@ struct lwpProc *p;
* if the new priority is lower than the old, we reschedule. * if the new priority is lower than the old, we reschedule.
*/ */
int int
lwpSetPriority(new) lwpSetPriority(int new)
int new;
{ {
int old = LwpCurrent->pri; int old = LwpCurrent->pri;
@ -470,13 +444,8 @@ int new;
* initialise the coroutine structures * initialise the coroutine structures
*/ */
struct lwpProc * struct lwpProc *
lwpInitSystem(pri, ctxptr, flags) lwpInitSystem(int pri, char **ctxptr, int flags)
int pri;
char **ctxptr;
int flags;
{ {
extern struct lwpQueue LwpSchedQ[];
extern struct lwpProc *LwpCurrent;
struct lwpQueue *q; struct lwpQueue *q;
int i, *stack; int i, *stack;
struct lwpProc *sel; struct lwpProc *sel;
@ -517,8 +486,7 @@ int flags;
* used. * used.
*/ */
static void static void
lwpStackCheckInit(newp) lwpStackCheckInit(struct lwpProc *newp)
struct lwpProc *newp;
{ {
register int i; register int i;
register long *lp; register long *lp;
@ -542,8 +510,7 @@ struct lwpProc *newp;
* down the entire process. * down the entire process.
*/ */
static int static int
lwpStackCheck(newp) lwpStackCheck(struct lwpProc *newp)
struct lwpProc *newp;
{ {
register int end, amt; register int end, amt;
register unsigned int i; register unsigned int i;
@ -602,8 +569,7 @@ struct lwpProc *newp;
* Figure out how much stack was used by this thread. * Figure out how much stack was used by this thread.
*/ */
static void static void
lwpStackCheckUsed(newp) lwpStackCheckUsed(struct lwpProc *newp)
struct lwpProc *newp;
{ {
register int i; register int i;
register long *lp; register long *lp;

View file

@ -30,13 +30,13 @@
#define LCOUNT -1 #define LCOUNT -1
#ifdef hpux #ifdef hpux
int lwpSave _PROTO((jmp_buf)); int lwpSave(jmp_buf);
void lwpRestore _PROTO((jmp_buf)); void lwpRestore(jmp_buf);
#endif #endif
#if defined(MIPS) || defined(AIX32) || defined(ALPHA) || defined(__vax) #if defined(MIPS) || defined(AIX32) || defined(ALPHA) || defined(__vax)
int lwpSave _PROTO((jmp_buf)); int lwpSave(jmp_buf);
void lwpRestore _PROTO((jmp_buf)); void lwpRestore(jmp_buf);
#elif defined(SUN4) #elif defined(SUN4)
#define lwpSave(x) _setjmp(x) #define lwpSave(x) _setjmp(x)
#define lwpRestore(x) _longjmp(x, 1) #define lwpRestore(x) _longjmp(x, 1)
@ -78,27 +78,27 @@ typedef struct {
#endif #endif
/* internal routines */ /* internal routines */
void lwpAddTail _PROTO((struct lwpQueue *, struct lwpProc *)); void lwpAddTail(struct lwpQueue *, struct lwpProc *);
struct lwpProc *lwpGetFirst _PROTO((struct lwpQueue *)); struct lwpProc *lwpGetFirst(struct lwpQueue *);
void lwpReschedule _PROTO((void)); void lwpReschedule(void);
void lwpReady _PROTO((struct lwpProc *)); void lwpReady(struct lwpProc *);
void lwpOnalarm _PROTO((void)); void lwpOnalarm(void);
#ifdef UCONTEXT #ifdef UCONTEXT
void lwpInitContext _PROTO((struct lwpProc *, stack_t *)); void lwpInitContext(struct lwpProc *, stack_t *);
#else /* GETCONTEXT */ #else /* GETCONTEXT */
#ifdef hpc #ifdef hpc
void lwpInitContext _PROTO((struct lwpProc *, void *)); void lwpInitContext(struct lwpProc *, void *);
#else #else
#ifdef hpux #ifdef hpux
void lwpInitContext _PROTO((volatile struct lwpProc * volatile, void *)); void lwpInitContext(volatile struct lwpProc * volatile, void *);
#else #else
void lwpInitContext _PROTO((struct lwpProc *, void *)); void lwpInitContext(struct lwpProc *, void *);
#endif /* hpux */ #endif /* hpux */
#endif /* hpc */ #endif /* hpc */
#endif /* GETCONTEXT */ #endif /* GETCONTEXT */
void lwpEntryPoint _PROTO((void)); void lwpEntryPoint(void);
void lwpInitSelect _PROTO((struct lwpProc * self)); void lwpInitSelect(struct lwpProc * self);
void lwpDestroy _PROTO((struct lwpProc * proc)); void lwpDestroy(struct lwpProc * proc);
#endif /* _LWP_H */ #endif /* _LWP_H */

View file

@ -23,14 +23,6 @@
#ifndef _LWP_H #ifndef _LWP_H
#define _LWP_H #define _LWP_H
#ifndef _PROTO
#ifdef __cplusplus
#define _PROTO(x) x
#else
#define _PROTO(x) ()
#endif
#endif
#include <setjmp.h> #include <setjmp.h>
#include <sys/time.h> #include <sys/time.h>
@ -67,24 +59,23 @@ struct lwpSem {
#define LWP_MAX_PRIO 8 #define LWP_MAX_PRIO 8
struct lwpProc *lwpInitSystem _PROTO((int)); struct lwpProc *lwpInitSystem(int);
struct lwpProc *lwpCreate struct lwpProc *lwpCreate(int, void (*)(void *), int, int, char **, void *);
_PROTO((int, void (*)(), int, int, char **, void *)); void lwpExit(void);
void lwpExit _PROTO((void)); void lwpTerminate(struct lwpProc *);
void lwpTerminate _PROTO((struct lwpProc *)); void lwpYield(void);
void lwpYield _PROTO((void)); void lwpSleepFd(int fd, int flags);
void lwpSleepFd _PROTO((int fd, int flags)); void lwpSleepUntil(long until);
void lwpSleepUntil _PROTO((long until)); void lwpWakeupFd(struct lwpProc *);
void lwpWakeupFd _PROTO((struct lwpProc *)); void *lwpGetUD(struct lwpProc *);
void *lwpGetUD _PROTO((struct lwpProc *)); void lwpSetUD(struct lwpProc *, char *);
void lwpSetUD _PROTO((struct lwpProc *, char *)); int lwpSetPriority(int);
int lwpSetPriority _PROTO((int)); void lwpReschedule();
void lwpReschedule _PROTO(());
struct lwpSem *lwpCreateSem _PROTO((int)); struct lwpSem *lwpCreateSem(int);
void lwpSignal _PROTO((struct lwpSem *)); void lwpSignal(struct lwpSem *);
void lwpWait _PROTO((struct lwpSem *)); void lwpWait(struct lwpSem *);
void lwpSelect _PROTO((int argc, char **argv)); void lwpSelect(int argc, char **argv);
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;

View file

@ -27,8 +27,7 @@
#if defined(_EMPTH_LWP) #if defined(_EMPTH_LWP)
struct lwpProc * struct lwpProc *
lwpGetFirst(q) lwpGetFirst(struct lwpQueue *q)
struct lwpQueue *q;
{ {
struct lwpProc *head; struct lwpProc *head;
@ -38,9 +37,7 @@ struct lwpQueue *q;
} }
void void
lwpAddTail(q, p) lwpAddTail(register struct lwpQueue *q, register struct lwpProc *p)
register struct lwpQueue *q;
register struct lwpProc *p;
{ {
if (!q->tail) if (!q->tail)
q->head = p; q->head = p;

View file

@ -62,8 +62,7 @@ struct lwpSelect {
struct lwpSelect LwpSelect; struct lwpSelect LwpSelect;
void void
lwpInitSelect(proc) lwpInitSelect(struct lwpProc *proc)
struct lwpProc *proc;
{ {
LwpSelect.maxfd = 0; LwpSelect.maxfd = 0;
LwpSelect.nfds = 0; LwpSelect.nfds = 0;
@ -82,9 +81,7 @@ struct lwpProc *proc;
} }
void void
lwpSleepFd(fd, mask) lwpSleepFd(int fd, int mask)
int fd;
int mask;
{ {
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;
@ -116,8 +113,7 @@ int mask;
} }
void void
lwpWakeupFd(proc) lwpWakeupFd(struct lwpProc *proc)
struct lwpProc *proc;
{ {
if (proc->fd < 0) if (proc->fd < 0)
return; return;
@ -132,8 +128,7 @@ struct lwpProc *proc;
} }
void void
lwpSleepUntil(until) lwpSleepUntil(long int until)
long until;
{ {
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;
@ -149,9 +144,7 @@ long until;
/*ARGSUSED*/ /*ARGSUSED*/
void void
lwpSelect(argc, argv) lwpSelect(void *arg)
int argc;
char **argv;
{ {
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;
struct lwpProc *us = LwpCurrent; struct lwpProc *us = LwpCurrent;

View file

@ -38,9 +38,7 @@ extern char *strdup();
* create a lwpSemaphore. * create a lwpSemaphore.
*/ */
struct lwpSem * struct lwpSem *
lwpCreateSem(name, count) lwpCreateSem(char *name, int count)
char *name;
int count;
{ {
struct lwpSem *new; struct lwpSem *new;
@ -57,8 +55,7 @@ int count;
* the blocked process has a higher priority than ours'. * the blocked process has a higher priority than ours'.
*/ */
void void
lwpSignal(s) lwpSignal(struct lwpSem *s)
struct lwpSem *s;
{ {
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;
@ -78,8 +75,7 @@ struct lwpSem *s;
* wait on a lwpSemaphore * wait on a lwpSemaphore
*/ */
void void
lwpWait(s) lwpWait(struct lwpSem *s)
struct lwpSem *s;
{ {
extern struct lwpProc *LwpCurrent; extern struct lwpProc *LwpCurrent;

View file

@ -40,195 +40,195 @@
#include "nat.h" #include "nat.h"
#include "file.h" #include "file.h"
extern int add(); extern int add(void);
extern int anti(); extern int anti(void);
extern int assa(); extern int assa(void);
extern int atta(); extern int atta(void);
extern int boar(); extern int boar(void);
extern int bdes(); extern int bdes(void);
extern int bomb(); extern int bomb(void);
extern int buil(); extern int buil(void);
extern int chan(); extern int chan(void);
extern int coas(); extern int coas(void);
extern int comm(); extern int comm(void);
extern int coun(); extern int coun(void);
extern int decl(); extern int decl(void);
extern int deli(); extern int deli(void);
extern int show(); extern int show(void);
extern int show_motd(void); extern int show_motd(void);
extern int desi(); extern int desi(void);
extern int diss(); extern int diss(void);
extern int drop(); extern int drop(void);
extern int echo(void); extern int echo(void);
extern int enli(); extern int enli(void);
extern int fire(); extern int fire(void);
extern int flee(); extern int flee(void);
extern int fly(); extern int fly(void);
extern int force(); extern int force(void);
extern int info(); extern int info(void);
extern int apro(); extern int apro(void);
extern int load(); extern int load(void);
extern int look(); extern int look(void);
extern int map(); extern int map(void);
extern int mine(); extern int mine(void);
extern int move(); extern int move(void);
extern int nati(); extern int nati(void);
extern int navi(); extern int navi(void);
extern int head(), news(); extern int head(void), news(void);
extern int nuke(); extern int nuke(void);
extern int offs(); extern int offs(void);
extern int para(); extern int para(void);
extern int path(); extern int path(void);
extern int payo(); extern int payo(void);
extern int powe(); extern int powe(void);
extern int rada(); extern int rada(void);
extern int rea(); extern int rea(void);
extern int real(); extern int real(void);
extern int reco(); extern int reco(void);
extern int rout(); extern int rout(void);
extern int sona(); extern int sona(void);
extern int spy(); extern int spy(void);
extern int tele(); extern int tele(void);
extern int tend(); extern int tend(void);
extern int torp(); extern int torp(void);
extern int tran(); extern int tran(void);
extern int trea(); extern int trea(void);
extern int turn(); extern int turn(void);
extern int vers(); extern int vers(void);
/* /*
* new commands * new commands
*/ */
extern int repo(); extern int repo(void);
extern int laun(); extern int laun(void);
extern int new(); extern int new(void);
extern int shoo(); extern int shoo(void);
extern int thre(); extern int thre(void);
extern int dist(); extern int dist(void);
extern int sct(); extern int sct(void);
extern int plan(); extern int plan(void);
extern int arm(); extern int arm(void);
extern int hard(); extern int hard(void);
extern int upgr(); extern int upgr(void);
extern int surv(); extern int surv(void);
extern int capi(); extern int capi(void);
extern int orig(); extern int orig(void);
extern int conv(); extern int conv(void);
extern int leve(); extern int leve(void);
extern int cuto(); extern int cuto(void);
extern int prod(); extern int prod(void);
extern int wai(); extern int wai(void);
extern int carg(); extern int carg(void);
extern int terr(); extern int terr(void);
extern int sate(); extern int sate(void);
extern int give(); extern int give(void);
extern int edit(); extern int edit(void);
extern int wipe(); extern int wipe(void);
extern int dump(); extern int dump(void);
extern int ldump(); extern int ldump(void);
extern int ndump(); extern int ndump(void);
extern int pdump(); extern int pdump(void);
extern int pboa(); extern int pboa(void);
extern int sdump(); extern int sdump(void);
extern int lost(); extern int lost(void);
extern int explore(); extern int explore(void);
extern int reso(); extern int reso(void);
extern int scra(); extern int scra(void);
extern int rela(); extern int rela(void);
extern int brea(); extern int brea(void);
extern int upda(); extern int upda(void);
extern int hidd(); extern int hidd(void);
extern int orde(); extern int orde(void);
extern int qorde(); extern int qorde(void);
extern int sorde(); extern int sorde(void);
extern int reje(); extern int reje(void);
extern int acce(); extern int acce(void);
extern int sabo(); extern int sabo(void);
extern int scut(); extern int scut(void);
extern int grin(); extern int grin(void);
extern int shar(); extern int shar(void);
extern int sail(); /* Forsman's hacks */ extern int sail(void); /* Forsman's hacks */
extern int foll(); extern int foll(void);
extern int mobq(); extern int mobq(void);
extern int name(); extern int name(void);
extern int range(); extern int range(void);
extern int zdon(); extern int zdon(void);
extern int fuel(); extern int fuel(void);
extern int multifire(); extern int multifire(void);
extern int retr(); extern int retr(void);
extern int budg(); extern int budg(void);
extern int wire(); extern int wire(void);
extern int stop(); extern int stop(void);
extern int start(); extern int start(void);
extern int land(); extern int land(void);
extern int supp(); extern int supp(void);
extern int lboa(); extern int lboa(void);
extern int lcarg(); extern int lcarg(void);
extern int lload(); extern int lload(void);
extern int army(); extern int army(void);
extern int lrange(); extern int lrange(void);
extern int morale(); extern int morale(void);
extern int lretr(); extern int lretr(void);
extern int landmine(); extern int landmine(void);
extern int fort(); extern int fort(void);
extern int march(); extern int march(void);
extern int llook(); extern int llook(void);
extern int mission(); extern int mission(void);
extern int work(); extern int work(void);
extern int ltend(); extern int ltend(void);
extern int cede(); extern int cede(void);
extern int best(); extern int best(void);
extern int newe(); extern int newe(void);
extern int starve(); extern int starve(void);
extern int setres(); extern int setres(void);
extern int setsector(); extern int setsector(void);
extern int disa(); extern int disa(void);
extern int enab(); extern int enab(void);
/* /*
* Undeclared functions * Undeclared functions
*/ */
extern int quit(void); extern int quit(void);
extern int cens(); extern int cens(void);
extern int demo(); extern int demo(void);
extern int shi(); extern int shi(void);
extern int wing(); extern int wing(void);
extern int execute(void); extern int execute(void);
extern int explain(void); extern int explain(void);
extern int set(); extern int set(void);
extern int flash(void); extern int flash(void);
extern int wall(); extern int wall(void);
extern int shut(); extern int shut(void);
extern int togg(); extern int togg(void);
extern int stre(); extern int stre(void);
extern int skyw(); extern int skyw(void);
extern int play(); extern int play(void);
extern int swaps(); extern int swaps(void);
extern int trad(); extern int trad(void);
extern int mark(); extern int mark(void);
extern int buy(); extern int buy(void);
extern int mult(); extern int mult(void);
extern int sell(); extern int sell(void);
extern int rese(); extern int rese(void);
extern int repa(); extern int repa(void);
extern int fina(); extern int fina(void);
extern int coll(); extern int coll(void);
extern int cons(); extern int cons(void);
extern int ledg(); extern int ledg(void);
extern int shark(); extern int shark(void);
extern int offe(); extern int offe(void);
extern int mobupdate(); extern int mobupdate(void);
extern int sinfra(); extern int sinfra(void);
extern int improve(); extern int improve(void);
extern int lsta(); extern int lsta(void);
extern int pstat(); extern int pstat(void);
extern int sstat(); extern int sstat(void);
struct cmndstr player_coms[] = { struct cmndstr player_coms[] = {
/* command form cost addr permit */ /* command form cost addr permit */

View file

@ -163,7 +163,6 @@ command(void)
{ {
register unsigned int x; register unsigned int x;
s_char *redir; s_char *redir;
int kill_player();
s_char scanspace[1024]; s_char scanspace[1024];
if (getcommand(player->combuf) < 0) if (getcommand(player->combuf) < 0)

View file

@ -148,7 +148,6 @@ int
print_found(struct shiplook *head) print_found(struct shiplook *head)
{ {
struct shiplook *s; struct shiplook *s;
extern s_char *effadv(int);
int first; int first;
struct mchrstr *mp; struct mchrstr *mp;
struct shpstr ship; struct shpstr ship;

View file

@ -157,9 +157,7 @@ prcom(int inon, struct combat *com)
/* Doing a sneak attack */ /* Doing a sneak attack */
static void static void
do_sneak(def, success) do_sneak(struct combat *def, int success)
struct combat *def;
int success;
{ {
struct sctstr sect; struct sctstr sect;
struct natstr *natp = getnatp(player->cnum); struct natstr *natp = getnatp(player->cnum);
@ -1147,7 +1145,6 @@ att_combat_eff(struct combat *com)
{ {
double eff = 1.0; double eff = 1.0;
double str; double str;
double sector_strength(struct sctstr *sp);
struct shpstr ship; struct shpstr ship;
if (com->type == EF_SECTOR) { if (com->type == EF_SECTOR) {

View file

@ -315,7 +315,6 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas)
void void
lnd_takemob(struct emp_qelem *list, double loss) lnd_takemob(struct emp_qelem *list, double loss)
{ {
extern double combat_mob;
struct emp_qelem *qp, *next; struct emp_qelem *qp, *next;
struct llist *llp; struct llist *llp;
int new; int new;

View file

@ -140,7 +140,7 @@ collateral_damage(coord x, coord y, int dam, struct emp_qelem *list)
return 0; return 0;
} }
int static int
only_subs(struct emp_qelem *list) only_subs(struct emp_qelem *list)
{ {
struct emp_qelem *qp; struct emp_qelem *qp;
@ -977,7 +977,6 @@ show_mission(int type, struct nstr_item *np)
int int
oprange(struct genitem *gp, int type, int *radius) oprange(struct genitem *gp, int type, int *radius)
{ {
double techfact(int, double);
int range; int range;
struct shpstr ship; struct shpstr ship;
struct lndstr land; struct lndstr land;

View file

@ -60,8 +60,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
coord curx, cury, oldx, oldy; coord curx, cury, oldx, oldy;
coord tmpx, tmpy; coord tmpx, tmpy;
coord dx, dy; coord dx, dy;
s_char *movstr, *BestLandPath(s_char *, struct sctstr *, s_char *movstr;
struct sctstr *, double *, int);
double sect_mcost; double sect_mcost;
double total_mcost; double total_mcost;
double mv_cost; double mv_cost;

View file

@ -133,7 +133,6 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
/* Is this the originally scared ship, or a follower */ /* Is this the originally scared ship, or a follower */
{ {
extern double techfact(int, double);
struct sctstr sect; struct sctstr sect;
register int n; register int n;
register int m; register int m;
@ -425,7 +424,6 @@ retreat_land1(struct lndstr *lp, s_char code, int orig)
/* Is this the originally scared unit, or a follower */ /* Is this the originally scared unit, or a follower */
{ {
extern double techfact(int, double);
struct sctstr sect; struct sctstr sect;
register int n; register int n;
register int m; register int m;

View file

@ -41,6 +41,7 @@
* (bailey@mcs.kent.edu) * (bailey@mcs.kent.edu)
*/ */
#include <math.h>
#include "misc.h" #include "misc.h"
#include "player.h" #include "player.h"
#include "nuke.h" #include "nuke.h"
@ -55,8 +56,6 @@
#include "nat.h" #include "nat.h"
#include "prototypes.h" #include "prototypes.h"
double sqrt(double);
double logx(double, double);
/* /*
* This cruft really belongs in the empglb.c file. * This cruft really belongs in the empglb.c file.

View file

@ -380,8 +380,6 @@ shp_mess(s_char *str, struct mlist *mlp)
static int static int
shp_check_nav(struct sctstr *sect) shp_check_nav(struct sctstr *sect)
{ {
extern struct dchrstr dchr[];
switch (dchr[sect->sct_type].d_flg & 03) { switch (dchr[sect->sct_type].d_flg & 03) {
case NAVOK: case NAVOK:
break; break;

View file

@ -64,7 +64,6 @@ takeover(register struct sctstr *sp, natid newown)
struct nstr_item ni; struct nstr_item ni;
struct plnstr p; struct plnstr p;
struct lndstr land; struct lndstr land;
extern double hap_fact(struct natstr *, struct natstr *);
extern int etu_per_update; extern int etu_per_update;
extern int sect_mob_neg_factor; extern int sect_mob_neg_factor;

View file

@ -45,14 +45,13 @@
#include "update.h" #include "update.h"
#include "subs.h" #include "subs.h"
#include "common.h" #include "common.h"
#include "prototypes.h"
int int
dodistribute(struct sctstr *sp, int imex, s_char *path, double dist_i_cost, dodistribute(struct sctstr *sp, int imex, s_char *path, double dist_i_cost,
double dist_e_cost) double dist_e_cost)
/* import or export? */ /* import or export? */
{ {
struct sctstr *getdistsp();
float distpathcost();
struct ichrstr *ip; struct ichrstr *ip;
struct sctstr *dist; struct sctstr *dist;
int amt; int amt;

View file

@ -72,9 +72,9 @@ static s_char *finish_path = "h"; /* Placeholder indicating path exists */
#endif /* SAVE_FINISH_PATHS */ #endif /* SAVE_FINISH_PATHS */
static void assemble_dist_paths(struct distinfo *distptrs); static void assemble_dist_paths(struct distinfo *distptrs);
s_char *BestDistPath(); s_char *BestDistPath(s_char *, struct sctstr *, struct sctstr *, double *, int);
s_char *ReversePath(s_char *path); s_char *ReversePath(s_char *path);
double pathcost(); double pathcost(struct sctstr *, s_char *, int);
void void
finish_sects(int etu) finish_sects(int etu)
@ -240,8 +240,7 @@ assemble_dist_paths(struct distinfo *distptrs)
} }
} }
s_char s_char *
*
ReversePath(s_char *path) ReversePath(s_char *path)
{ {
s_char *patharray = "aucdefjhigklmyopqrstbvwxnz"; s_char *patharray = "aucdefjhigklmyopqrstbvwxnz";

View file

@ -121,7 +121,6 @@ upd_land(register struct lndstr *lp, int landno, register int etus,
int vec[I_MAX + 1]; int vec[I_MAX + 1];
int cvec[I_MAX + 1]; int cvec[I_MAX + 1];
int n; int n;
double techfact(int, double);
int min = morale_base - (int)np->nat_level[NAT_HLEV]; int min = morale_base - (int)np->nat_level[NAT_HLEV];
int mult; int mult;
extern double money_land; extern double money_land;
@ -245,7 +244,6 @@ static int
landrepair(register struct lndstr *land, int *vec, struct natstr *np, landrepair(register struct lndstr *land, int *vec, struct natstr *np,
int *bp, int etus) int *bp, int etus)
{ {
extern int mil_dbl_pay;
extern int land_grow_scale; extern int land_grow_scale;
register int delta; register int delta;
struct sctstr *sp; struct sctstr *sp;

View file

@ -56,7 +56,7 @@ static void do_mob_plane(register struct plnstr *, register int);
static void do_mob_sect(register struct sctstr *sp, register int etus); static void do_mob_sect(register struct sctstr *sp, register int etus);
static void do_mob_ship(register struct shpstr *, register int); static void do_mob_ship(register struct shpstr *, register int);
int static int
increase_mob(time_t * counter, float mult) increase_mob(time_t * counter, float mult)
{ {
time_t secs; time_t secs;

View file

@ -241,7 +241,6 @@ nav_loadship(register struct shpstr *sp, natid cnum)
int int
nav_ship(register struct shpstr *sp) nav_ship(register struct shpstr *sp)
{ {
extern double techfact(int, double);
struct sctstr *sectp; struct sctstr *sectp;
s_char *cp, item; s_char *cp, item;
int stopping; int stopping;

View file

@ -59,8 +59,6 @@
int int
check_nav(struct sctstr *sect) check_nav(struct sctstr *sect)
{ {
extern struct dchrstr dchr[];
switch (dchr[sect->sct_type].d_flg & 03) { switch (dchr[sect->sct_type].d_flg & 03) {
case NAVOK: case NAVOK:
break; break;

View file

@ -144,7 +144,6 @@ revolt(struct sctstr *sp)
void void
guerrilla(struct sctstr *sp) guerrilla(struct sctstr *sp)
{ {
extern s_char *effadv();
struct sctstr *nsp; struct sctstr *nsp;
int recruit; int recruit;
int move; int move;
@ -168,9 +167,7 @@ guerrilla(struct sctstr *sp)
int val; int val;
int oldmob; int oldmob;
struct lndstr *lp; struct lndstr *lp;
s_char *nxtitemp(struct nstr_item *np, int owner);
struct nstr_item ni; struct nstr_item ni;
extern double hap_fact();
mc = cc = 0; mc = cc = 0;
recruit = 0; recruit = 0;
@ -463,7 +460,6 @@ take_casualties(struct sctstr *sp, int mc)
int cantake; int cantake;
int nunits = 0, each, deq; int nunits = 0, each, deq;
struct lndstr *lp; struct lndstr *lp;
s_char *nxtitemp(struct nstr_item *np, int owner);
struct nstr_item ni; struct nstr_item ni;
/* casualties come out of mil first */ /* casualties come out of mil first */

View file

@ -445,7 +445,6 @@ feed_ship(struct shpstr *sp, register int *vec, int etus, int *needed,
int starved, lvec[I_MAX + 1]; int starved, lvec[I_MAX + 1];
struct nstr_item ni; struct nstr_item ni;
struct lndstr *lp; struct lndstr *lp;
s_char *nxtitemp(struct nstr_item *np, int owner);
if (opt_NOFOOD) if (opt_NOFOOD)
return 0; /* no food no work to do */ return 0; /* no food no work to do */

View file

@ -40,8 +40,7 @@
/*ARGSUSED*/ /*ARGSUSED*/
void void
player_kill_idle(argv) player_kill_idle(void *argv)
void *argv;
{ {
extern int max_idle; extern int max_idle;
struct player *p; struct player *p;

View file

@ -43,8 +43,7 @@
/*ARGSUSED*/ /*ARGSUSED*/
void void
delete_lostitems(argv) delete_lostitems(void *argv)
void *argv;
{ {
extern int lost_items_timeout; extern int lost_items_timeout;
time_t now; time_t now;

Some files were not shown because too many files have changed in this diff Show more