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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -165,9 +165,9 @@ extern struct as_path *as_find_cachepath(coord fx,
/* Functions that are "private" to algorithm */
extern void as_add_cachepath(struct as_data *adp);
extern void as_clear_cachepath();
extern void as_enable_cachepath();
extern void as_disable_cachepath();
extern void as_clear_cachepath(void);
extern void as_enable_cachepath(void);
extern void as_disable_cachepath(void);
extern void as_makepath(struct as_data *adp);
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 */
void
as_enable_cachepath()
as_enable_cachepath(void)
{
as_cachepath_on = 1;
}
void
as_disable_cachepath()
as_disable_cachepath(void)
{
as_cachepath_on = 0;
}
@ -135,7 +135,7 @@ as_add_cachepath(struct as_data *adp)
}
void
as_clear_cachepath()
as_clear_cachepath(void)
{
struct as_frompath *from, *from2;
struct as_topath *to, *to2;

View file

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

View file

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

View file

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

View file

@ -214,7 +214,6 @@ bomb(void)
static void
pin_bomb(struct emp_qelem *list, struct sctstr *target)
{
extern s_char *effadv();
struct dchrstr *dcp;
int nplanes;
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 air_money[MAXNOC];
extern long tpops[MAXNOC];
extern int mil_dbl_pay;
lnd_money[player->cnum] = sea_money[player->cnum] = 0;
air_money[player->cnum] = 0;

View file

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

View file

@ -111,9 +111,7 @@ static int
cons_choose(struct ltcomstr *ltcp)
{
s_char *p;
extern int disloan();
extern int distrea();
int (*dis) ();
int (*dis)();
struct lonstr *lp;
struct trtstr *tp;
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,
int for_real)
{
extern int opt_NO_LCMS;
extern int opt_NO_HCMS;
register int n;
s_char *p;
int breaksanct;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -57,7 +57,7 @@ mark(void)
return display_mark(" ");
}
void
static void
pr_mark(struct comstr *comm)
{
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 nstr_sect ns;
struct flist *fp;
double techfact(int, double);
extern int torpedo_damage;
int gun;

View file

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

View file

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

View file

@ -46,8 +46,8 @@
#include "optlist.h"
#include "commands.h"
#include <fcntl.h>
#include <math.h>
extern float start_education, start_happiness;
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 nstr_item nstr;
struct natstr *natp;
double techfact(int, double);
int lvec[I_MAX + 1];
int extend = 1;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -110,8 +110,6 @@ kw_find(s_char *name)
s_char *
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;
while (isspace(*text))

View file

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

View file

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

View file

@ -49,6 +49,7 @@
#include "gen.h"
#include "subs.h"
#include "lost.h"
#include "combat.h"
int
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;
double real_dam;
int eff;
double sector_strength();
/* Some sectors are harder/easier to kill.. */
/* Average sector has a dstr of 1, so adjust */

View file

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

View file

@ -390,7 +390,7 @@ empth_init(char **ctx_ptr, int flags)
* It is also passed to the entry function...
*/
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)
{
loc_Thread_t *pThread = NULL;

View file

@ -57,9 +57,9 @@ static pthread_mutex_t mtx_ctxsw; /* thread in critical section */
#if 0
static void empth_setctx _PROTO((void *));
static void empth_setctx(void *);
#endif
static void empth_restorectx _PROTO(());
static void empth_restorectx();
static void *
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.
*/
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)
{
pthread_t t;

View file

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

View file

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

View file

@ -72,7 +72,7 @@ struct iop {
int flags;
s_char *assoc;
int bufsize;
int (*notify) ();
int (*notify)(void);
};
void
@ -81,7 +81,7 @@ io_init(void)
}
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)
{
struct iop *iop;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -140,7 +140,7 @@ collateral_damage(coord x, coord y, int dam, struct emp_qelem *list)
return 0;
}
int
static int
only_subs(struct emp_qelem *list)
{
struct emp_qelem *qp;
@ -977,7 +977,6 @@ show_mission(int type, struct nstr_item *np)
int
oprange(struct genitem *gp, int type, int *radius)
{
double techfact(int, double);
int range;
struct shpstr ship;
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 tmpx, tmpy;
coord dx, dy;
s_char *movstr, *BestLandPath(s_char *, struct sctstr *,
struct sctstr *, double *, int);
s_char *movstr;
double sect_mcost;
double total_mcost;
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 */
{
extern double techfact(int, double);
struct sctstr sect;
register int n;
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 */
{
extern double techfact(int, double);
struct sctstr sect;
register int n;
register int m;

View file

@ -41,6 +41,7 @@
* (bailey@mcs.kent.edu)
*/
#include <math.h>
#include "misc.h"
#include "player.h"
#include "nuke.h"
@ -55,8 +56,6 @@
#include "nat.h"
#include "prototypes.h"
double sqrt(double);
double logx(double, double);
/*
* 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
shp_check_nav(struct sctstr *sect)
{
extern struct dchrstr dchr[];
switch (dchr[sect->sct_type].d_flg & 03) {
case NAVOK:
break;

View file

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

View file

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

View file

@ -72,9 +72,9 @@ static s_char *finish_path = "h"; /* Placeholder indicating path exists */
#endif /* SAVE_FINISH_PATHS */
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);
double pathcost();
double pathcost(struct sctstr *, s_char *, int);
void
finish_sects(int etu)
@ -240,8 +240,7 @@ assemble_dist_paths(struct distinfo *distptrs)
}
}
s_char
*
s_char *
ReversePath(s_char *path)
{
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 cvec[I_MAX + 1];
int n;
double techfact(int, double);
int min = morale_base - (int)np->nat_level[NAT_HLEV];
int mult;
extern double money_land;
@ -245,7 +244,6 @@ static int
landrepair(register struct lndstr *land, int *vec, struct natstr *np,
int *bp, int etus)
{
extern int mil_dbl_pay;
extern int land_grow_scale;
register int delta;
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_ship(register struct shpstr *, register int);
int
static int
increase_mob(time_t * counter, float mult)
{
time_t secs;

View file

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

View file

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

View file

@ -144,7 +144,6 @@ revolt(struct sctstr *sp)
void
guerrilla(struct sctstr *sp)
{
extern s_char *effadv();
struct sctstr *nsp;
int recruit;
int move;
@ -168,9 +167,7 @@ guerrilla(struct sctstr *sp)
int val;
int oldmob;
struct lndstr *lp;
s_char *nxtitemp(struct nstr_item *np, int owner);
struct nstr_item ni;
extern double hap_fact();
mc = cc = 0;
recruit = 0;
@ -463,7 +460,6 @@ take_casualties(struct sctstr *sp, int mc)
int cantake;
int nunits = 0, each, deq;
struct lndstr *lp;
s_char *nxtitemp(struct nstr_item *np, int owner);
struct nstr_item ni;
/* 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];
struct nstr_item ni;
struct lndstr *lp;
s_char *nxtitemp(struct nstr_item *np, int owner);
if (opt_NOFOOD)
return 0; /* no food no work to do */

View file

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

View file

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

View file

@ -68,10 +68,10 @@
s_char program[] = "server";
extern void player_accept();
extern void player_kill_idle();
extern void update_sched();
extern void delete_lostitems();
extern void player_accept(void *);
extern void player_kill_idle(void *);
extern void update_sched(void *);
extern void delete_lostitems(void *);
void nullify_objects(void);
void init_files(void);
void close_files(void);
@ -81,18 +81,16 @@ static void loc_NTInit(void);
static void loc_NTTerm(void);
#endif
extern void mobility_init();
extern void mobility_check();
extern void market_update();
extern void mobility_init(void);
extern void mobility_check(void *);
extern void market_update(void *);
#if !defined(_WIN32)
static int mainpid = 0;
#endif
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char **argv)
{
time_t now;
int hour[2];

View file

@ -42,8 +42,7 @@
/*ARGSUSED*/
void
check_all_markets(argv)
void *argv;
check_all_markets(void *argv)
{
player->proc = empth_self();
player->cnum = 0;
@ -67,8 +66,7 @@ void *argv;
/*ARGSUSED*/
void
market_update(argv)
void *argv;
market_update(void *argv)
{
time_t now;
struct player *dp;

View file

@ -50,9 +50,7 @@ shutdown_init(void)
}
void
shutdown_sequence(argc, argv)
int argc;
s_char **argv;
shutdown_sequence(void *argv)
{
struct natstr *god;
struct tm *tm;

View file

@ -42,9 +42,7 @@
/*ARGSUSED*/
void
mobility_check(argv)
void *argv;
mobility_check(void *argv)
{
extern s_char *timestampfil;
extern int updating_mob;
@ -93,7 +91,7 @@ void *argv;
}
void
mobility_init()
mobility_init(void)
{
extern s_char *timestampfil;
extern int updating_mob;

View file

@ -41,14 +41,13 @@
empth_sem_t *update_sem;
extern void update_main();
extern void update_wait();
extern void update_main(void *);
extern void update_wait(void *argv);
time_t update_time;
/*ARGSUSED*/
void
update_sched(argv)
void *argv;
update_sched(void *argv)
{
extern int s_p_etu;
extern int etu_per_update;
@ -110,8 +109,7 @@ void *argv;
/*ARGSUSED*/
void
update_wait(argv)
void *argv;
update_wait(void *argv)
{
struct player *p;
int running;

View file

@ -87,7 +87,7 @@ static int quiet = 0;
#define PLATMIN 36 /* plate altitude for plateau */
#define HIGHMIN 98 /* plate altitude for mountains */
static void qprint _PROTO((const char *str));
static void qprint(const char *str);
static const char *outfile = "newcap_script";
/* mark the continents with a * so you can tell them
@ -170,10 +170,10 @@ void translate_continents(void);
int map_symbol(int x, int y);
static void fl_sct_init(coord x, coord y, s_char *ptr);
void print_vars();
void print_vars(void);
void fl_move(int);
void next_coast();
void grow_islands();
void next_coast(int c, int x, int y, int *xp, int *yp);
void grow_islands(void);
/****************************************************************************
MAIN
@ -262,7 +262,7 @@ main(int argc, char *argv[])
}
void
print_vars()
print_vars(void)
{
if (quiet)
return;
@ -279,9 +279,8 @@ print_vars()
printf("World dimensions: %dx%d\n", WORLD_X, WORLD_Y);
}
int
my_sqrt(n)
int n;
static int
my_sqrt(int n)
{
int i;
@ -492,9 +491,8 @@ init(void)
/* How isolated is capital j?
*/
int
iso(j, newx, newy)
int j, newx, newy;
static int
iso(int j, int newx, int newy)
{
int i, md, d = WORLD_X + WORLD_Y;
@ -550,8 +548,7 @@ stable(void)
*/
void
fl_move(j)
int j;
fl_move(int j)
{
int i, n, newx, newy;
@ -573,9 +570,8 @@ int j;
/* Look for a coastal sector of continent c
*/
void
find_coast(c)
int c;
static void
find_coast(int c)
{
int i, j;
@ -589,9 +585,8 @@ int c;
/* Used for measuring distances
*/
int
next_vector(n)
int n;
static int
next_vector(int n)
{
int i;
@ -608,9 +603,8 @@ int n;
/* Test to see if we're allowed to grow there: the arguments di and id
*/
int
try_to_grow(c, newx, newy, d)
int c, newx, newy, d;
static int
try_to_grow(int c, int newx, int newy, int d)
{
int i, j, px, py;
@ -640,8 +634,7 @@ int c, newx, newy, d;
*/
void
next_coast(c, x, y, xp, yp)
int c, x, y, *xp, *yp;
next_coast(int c, int x, int y, int *xp, int *yp)
{
int i, nx, ny, wat = 0;
@ -667,7 +660,7 @@ int c, x, y, *xp, *yp;
/* Choose a sector to grow from
*/
int
static int
new_try(int c)
{
int i, starti;
@ -695,9 +688,8 @@ new_try(int c)
/* Grow continent c by 1 sector
*/
int
grow_one_sector(c)
int c;
static int
grow_one_sector(int c)
{
int done, coast_search, try1, x, y, newx, newy, i, n, sx, sy;
@ -774,9 +766,8 @@ grow_continents(void)
/* Choose a place to start growing an island from
*/
int
place_island(c, xp, yp)
int c, *xp, *yp;
static int
place_island(int c, int *xp, int *yp)
{
int d, sx, sy;
int ssy = rnd(WORLD_Y);
@ -806,7 +797,7 @@ int c, *xp, *yp;
*/
void
grow_islands()
grow_islands(void)
{
int c, x, y, isiz;
@ -839,9 +830,8 @@ create_elevations(void)
/* Generic function for finding the distance to the closest sea, land, or
mountain
*/
int
distance_to_what(x, y, flag)
int x, y, flag;
static int
distance_to_what(int x, int y, int flag)
{
int j, d, px, py;
@ -987,9 +977,8 @@ elevate_sea(void)
ADD THE RESOURCES
****************************************************************************/
int
set_fert(e)
int e;
static int
set_fert(int e)
{
int fert = 0;
if (e < LANDMIN)
@ -1001,9 +990,8 @@ int e;
return fert;
}
int
set_oil(e)
int e;
static int
set_oil(int e)
{
int oil = 0;
if (e < LANDMIN)
@ -1015,9 +1003,8 @@ int e;
return oil;
}
int
set_iron(e)
int e;
static int
set_iron(int e)
{
int iron = 0;
if (e >= IRON_MIN && e < HIGHMIN)
@ -1027,9 +1014,8 @@ int e;
return iron;
}
int
set_gold(e)
int e;
static int
set_gold(int e)
{
int gold = 0;
if (e >= GOLD_MIN) {
@ -1043,9 +1029,8 @@ int e;
return gold;
}
int
set_uran(e)
int e;
static int
set_uran(int e)
{
int uran = 0;
if (e >= URAN_MIN && e < HIGHMIN)
@ -1055,9 +1040,8 @@ int e;
return uran;
}
void
add_resources(sct)
struct sctstr *sct;
static void
add_resources(struct sctstr *sct)
{
sct->sct_fertil = set_fert(sct->sct_elev);
sct->sct_oil = set_oil(sct->sct_elev);
@ -1249,8 +1233,7 @@ write_newcap_script(void)
}
static void
qprint(str)
const char *str;
qprint(const char *str)
{
if (quiet == 0)
fputs(str, stdout);

View file

@ -72,7 +72,6 @@ static void file_sct_init(coord x, coord y, s_char *ptr);
int
main(int argc, char *argv[])
{
extern s_char *annfil;
extern s_char *timestampfil;
extern s_char *infodir;
extern s_char *commfil;

View file

@ -36,9 +36,7 @@
#include "prototypes.h"
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char **argv)
{
if (argc > 1)
emp_config(argv[1]);