switch source tree from k&r to c99
This commit is contained in:
@@ -75,17 +75,17 @@ struct termio termio;
|
||||
#endif
|
||||
|
||||
#ifdef _M_UNIX
|
||||
extern void NDECL(sco_mapon);
|
||||
extern void NDECL(sco_mapoff);
|
||||
extern void sco_mapon(void);
|
||||
extern void sco_mapoff(void);
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern void NDECL(linux_mapon);
|
||||
extern void NDECL(linux_mapoff);
|
||||
extern void linux_mapon(void);
|
||||
extern void linux_mapoff(void);
|
||||
#endif
|
||||
|
||||
#ifdef AUX
|
||||
void
|
||||
catch_stp()
|
||||
catch_stp(void)
|
||||
{
|
||||
signal(SIGTSTP, SIG_DFL);
|
||||
dosuspend();
|
||||
@@ -93,7 +93,7 @@ catch_stp()
|
||||
#endif /* AUX */
|
||||
|
||||
void
|
||||
getwindowsz()
|
||||
getwindowsz(void)
|
||||
{
|
||||
#ifdef USE_WIN_IOCTL
|
||||
/*
|
||||
@@ -116,7 +116,7 @@ getwindowsz()
|
||||
}
|
||||
|
||||
void
|
||||
getioctls()
|
||||
getioctls(void)
|
||||
{
|
||||
#ifdef BSD_JOB_CONTROL
|
||||
(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars);
|
||||
@@ -139,7 +139,7 @@ getioctls()
|
||||
}
|
||||
|
||||
void
|
||||
setioctls()
|
||||
setioctls(void)
|
||||
{
|
||||
#ifdef BSD_JOB_CONTROL
|
||||
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars);
|
||||
@@ -158,7 +158,7 @@ setioctls()
|
||||
|
||||
#ifdef SUSPEND /* No longer implies BSD */
|
||||
int
|
||||
dosuspend()
|
||||
dosuspend(void)
|
||||
{
|
||||
#ifdef SYSCF
|
||||
/* NB: check_user_string() is port-specific. */
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifdef LAN_FEATURES
|
||||
|
||||
void
|
||||
init_lan_features()
|
||||
init_lan_features(void)
|
||||
{
|
||||
lan_username();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ init_lan_features()
|
||||
*/
|
||||
|
||||
char *
|
||||
lan_username()
|
||||
lan_username(void)
|
||||
{
|
||||
char *lu;
|
||||
lu = get_username(&g.lusername_size);
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
#include <unistd.h> /* for getcwd() prototype */
|
||||
#endif
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
void nethack_exit(int) NORETURN;
|
||||
#else
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
|
||||
char *exepath(char *);
|
||||
char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */
|
||||
|
||||
#ifdef TOS
|
||||
@@ -35,28 +42,24 @@ long _stksize = 16 * 1024;
|
||||
|
||||
#ifdef AMIGA
|
||||
extern int bigscreen;
|
||||
void NDECL(preserve_icon);
|
||||
void preserve_icon(void);
|
||||
#endif
|
||||
|
||||
static void FDECL(process_options, (int argc, char **argv));
|
||||
static void NDECL(nhusage);
|
||||
static void process_options(int argc, char **argv);
|
||||
static void nhusage(void);
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
extern void FDECL(nethack_exit, (int)) NORETURN;
|
||||
#else
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
#ifdef PORT_HELP
|
||||
#if defined(MSDOS)
|
||||
void port_help(void);
|
||||
#endif /* MSDOS */
|
||||
#endif /* PORT_HELP */
|
||||
|
||||
#ifdef EXEPATH
|
||||
static char *FDECL(exepath, (char *));
|
||||
#endif
|
||||
int main(int, char **);
|
||||
|
||||
int FDECL(main, (int, char **));
|
||||
|
||||
extern boolean FDECL(pcmain, (int, char **));
|
||||
extern boolean pcmain(int, char **);
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
void NDECL(startup);
|
||||
void startup(void);
|
||||
unsigned _stklen = STKSIZ;
|
||||
#endif
|
||||
|
||||
@@ -66,12 +69,10 @@ unsigned _stklen = STKSIZ;
|
||||
*/
|
||||
int
|
||||
#ifndef __MINGW32__
|
||||
main(argc, argv)
|
||||
main(int argc, char *argv[])
|
||||
#else
|
||||
mingw_main(argc, argv)
|
||||
mingw_main(int argc, char *argv[])
|
||||
#endif
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
boolean resuming;
|
||||
|
||||
@@ -84,9 +85,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
boolean
|
||||
pcmain(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
pcmain(int argc, char *argv[])
|
||||
{
|
||||
NHFILE *nhfp;
|
||||
register char *dir;
|
||||
@@ -455,7 +454,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
* We'll return here if new game player_selection() renames the hero.
|
||||
*/
|
||||
attempt_restore:
|
||||
if ((nhfp = restore_saved_game()) > 0) {
|
||||
if ((nhfp = restore_saved_game()) != 0) {
|
||||
#ifndef NO_SIGNAL
|
||||
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||
#endif
|
||||
@@ -515,9 +514,7 @@ attempt_restore:
|
||||
}
|
||||
|
||||
static void
|
||||
process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
process_options(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -637,7 +634,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
static void
|
||||
nhusage()
|
||||
nhusage(void)
|
||||
{
|
||||
char buf1[BUFSZ], buf2[BUFSZ], *bufptr;
|
||||
|
||||
@@ -678,9 +675,7 @@ nhusage()
|
||||
|
||||
#ifdef CHDIR
|
||||
void
|
||||
chdirx(dir, wr)
|
||||
char *dir;
|
||||
boolean wr;
|
||||
chdirx(char *dir, boolean wr)
|
||||
{
|
||||
#ifdef AMIGA
|
||||
static char thisdir[] = "";
|
||||
@@ -708,7 +703,7 @@ boolean wr;
|
||||
#ifdef PORT_HELP
|
||||
#if defined(MSDOS)
|
||||
void
|
||||
port_help()
|
||||
port_help(void)
|
||||
{
|
||||
/* display port specific help file */
|
||||
display_file(PORT_HELP, 1);
|
||||
@@ -718,7 +713,7 @@ port_help()
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
if (!strcmp(g.plname, WIZARD_NAME))
|
||||
return TRUE;
|
||||
@@ -736,15 +731,12 @@ authorize_wizard_mode()
|
||||
char exepathbuf[EXEPATHBUFSZ];
|
||||
|
||||
char *
|
||||
exepath(str)
|
||||
char *str;
|
||||
exepath(char *str)
|
||||
{
|
||||
char *tmp, *tmp2;
|
||||
int bsize;
|
||||
|
||||
if (!str)
|
||||
return (char *) 0;
|
||||
bsize = EXEPATHBUFSZ;
|
||||
tmp = exepathbuf;
|
||||
Strcpy(tmp, str);
|
||||
tmp2 = strrchr(tmp, PATH_SEPARATOR);
|
||||
@@ -767,7 +759,7 @@ VA_DECL(const char *, fmt)
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sys_random_seed()
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long seed = 0L;
|
||||
unsigned long pid = (unsigned long) getpid();
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#endif
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
void FDECL(nethack_exit, (int)) NORETURN;
|
||||
void nethack_exit(int) NORETURN;
|
||||
#else
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
static void NDECL(msexit);
|
||||
static void msexit(void);
|
||||
|
||||
#ifdef MOVERLAY
|
||||
extern void __far __cdecl _movepause(void);
|
||||
@@ -43,11 +43,12 @@ extern unsigned short __far __cdecl _movefpaused;
|
||||
#define __MOVE_PAUSE_DISK 2 /* Represents the executable file */
|
||||
#define __MOVE_PAUSE_CACHE 4 /* Represents the cache memory */
|
||||
#endif /* MOVERLAY */
|
||||
FILE * fopenp(const char *name, const char *mode);
|
||||
|
||||
#if defined(MICRO)
|
||||
|
||||
void
|
||||
flushout()
|
||||
flushout(void)
|
||||
{
|
||||
(void) fflush(stdout);
|
||||
return;
|
||||
@@ -64,9 +65,11 @@ static const char *COMSPEC =
|
||||
|
||||
#ifdef SHELL
|
||||
int
|
||||
dosh()
|
||||
dosh(void)
|
||||
{
|
||||
#ifndef NOCWD_ASSUMPTIONS
|
||||
extern char orgdir[];
|
||||
#endif
|
||||
char *comspec;
|
||||
#ifndef __GO32__
|
||||
int spawnstat;
|
||||
@@ -132,8 +135,7 @@ dosh()
|
||||
* be room for the \
|
||||
*/
|
||||
void
|
||||
append_slash(name)
|
||||
char *name;
|
||||
append_slash(char *name)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -148,8 +150,7 @@ char *name;
|
||||
}
|
||||
|
||||
void
|
||||
getreturn(str)
|
||||
const char *str;
|
||||
getreturn(const char *str)
|
||||
{
|
||||
#ifdef TOS
|
||||
msmsg("Hit <Return> %s.", str);
|
||||
@@ -194,8 +195,7 @@ VA_DECL(const char *, fmt)
|
||||
#endif
|
||||
|
||||
FILE *
|
||||
fopenp(name, mode)
|
||||
const char *name, *mode;
|
||||
fopenp(const char *name, const char *mode)
|
||||
{
|
||||
char buf[BUFSIZ], *bp, *pp, lastch = 0;
|
||||
FILE *fp;
|
||||
@@ -243,8 +243,7 @@ const char *name, *mode;
|
||||
|
||||
#if defined(MICRO) || defined(OS2)
|
||||
void
|
||||
nethack_exit(code)
|
||||
int code;
|
||||
nethack_exit(int code)
|
||||
{
|
||||
msexit();
|
||||
exit(code);
|
||||
@@ -257,9 +256,9 @@ extern boolean run_from_desktop; /* set in pcmain.c */
|
||||
#endif
|
||||
|
||||
static void
|
||||
msexit()
|
||||
msexit(void)
|
||||
{
|
||||
#ifdef CHDIR
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
extern char orgdir[];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ char erase_char, kill_char;
|
||||
* Called by startup() in termcap.c and after returning from ! or ^Z
|
||||
*/
|
||||
void
|
||||
gettty()
|
||||
gettty(void)
|
||||
{
|
||||
erase_char = '\b';
|
||||
kill_char = 21; /* cntl-U */
|
||||
@@ -33,8 +33,7 @@ gettty()
|
||||
|
||||
/* reset terminal to original state */
|
||||
void
|
||||
settty(s)
|
||||
const char *s;
|
||||
settty(const char *s)
|
||||
{
|
||||
#if defined(MSDOS) && defined(NO_TERMS)
|
||||
gr_finish();
|
||||
@@ -49,15 +48,14 @@ const char *s;
|
||||
|
||||
/* called by init_nhwindows() and resume_nhwindows() */
|
||||
void
|
||||
setftty()
|
||||
setftty(void)
|
||||
{
|
||||
start_screen();
|
||||
}
|
||||
|
||||
#if defined(TIMED_DELAY) && defined(_MSC_VER)
|
||||
void
|
||||
msleep(mseconds)
|
||||
unsigned mseconds;
|
||||
msleep(unsigned mseconds)
|
||||
{
|
||||
/* now uses clock() which is ANSI C */
|
||||
clock_t goal;
|
||||
|
||||
@@ -18,8 +18,8 @@ extern char orgdir[];
|
||||
#endif
|
||||
|
||||
#if defined(TTY_GRAPHICS)
|
||||
extern void NDECL(backsp);
|
||||
extern void NDECL(clear_screen);
|
||||
extern void backsp(void);
|
||||
extern void clear_screen(void);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@@ -30,14 +30,13 @@ static struct stat buf;
|
||||
static struct stat hbuf;
|
||||
#endif
|
||||
|
||||
#ifdef PC_LOCKING
|
||||
static int NDECL(eraseoldlocks);
|
||||
#if defined(PC_LOCKING) && !defined(SELF_RECOVER)
|
||||
static int eraseoldlocks(void);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int
|
||||
uptodate(fd)
|
||||
int fd;
|
||||
uptodate(int fd)
|
||||
{
|
||||
#ifdef WANT_GETHDATE
|
||||
if(fstat(fd, &buf)) {
|
||||
@@ -73,9 +72,10 @@ int fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PC_LOCKING
|
||||
#if defined(PC_LOCKING)
|
||||
#if !defined(SELF_RECOVER)
|
||||
static int
|
||||
eraseoldlocks()
|
||||
eraseoldlocks(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -96,11 +96,12 @@ eraseoldlocks()
|
||||
return 0; /* cannot remove it */
|
||||
return (1); /* success! */
|
||||
}
|
||||
#endif /* SELF_RECOVER */
|
||||
|
||||
void
|
||||
getlock()
|
||||
getlock(void)
|
||||
{
|
||||
register int fd, c, ci, ct, ern;
|
||||
register int fd, c, ci, ct;
|
||||
int fcmask = FCMASK;
|
||||
char tbuf[BUFSZ];
|
||||
const char *fq_lock;
|
||||
@@ -209,8 +210,6 @@ getlock()
|
||||
|
||||
gotlock:
|
||||
fd = creat(fq_lock, fcmask);
|
||||
if (fd == -1)
|
||||
ern = errno;
|
||||
unlock_file(HLOCK);
|
||||
if (fd == -1) {
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
@@ -240,12 +239,11 @@ gotlock:
|
||||
#endif /* PC_LOCKING */
|
||||
|
||||
void
|
||||
regularize(s)
|
||||
regularize(register char *s)
|
||||
/*
|
||||
* normalize file name - we don't like .'s, /'s, spaces, and
|
||||
* lots of other things
|
||||
*/
|
||||
register char *s;
|
||||
{
|
||||
register char *lp;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ struct nhregex {
|
||||
};
|
||||
|
||||
struct nhregex *
|
||||
regex_init()
|
||||
regex_init(void)
|
||||
{
|
||||
struct nhregex *re;
|
||||
|
||||
@@ -30,9 +30,7 @@ regex_init()
|
||||
}
|
||||
|
||||
boolean
|
||||
regex_compile(s, re)
|
||||
const char *s;
|
||||
struct nhregex *re;
|
||||
regex_compile(const char *s, struct nhregex *re)
|
||||
{
|
||||
if (!re)
|
||||
return FALSE;
|
||||
@@ -44,16 +42,13 @@ struct nhregex *re;
|
||||
}
|
||||
|
||||
const char *
|
||||
regex_error_desc(re)
|
||||
struct nhregex *re UNUSED;
|
||||
regex_error_desc(struct nhregex *re UNUSED)
|
||||
{
|
||||
return "pattern match compilation error";
|
||||
}
|
||||
|
||||
boolean
|
||||
regex_match(s, re)
|
||||
const char *s;
|
||||
struct nhregex *re;
|
||||
regex_match(const char *s, struct nhregex *re)
|
||||
{
|
||||
if (!re || !re->pat || !s)
|
||||
return FALSE;
|
||||
@@ -62,8 +57,7 @@ struct nhregex *re;
|
||||
}
|
||||
|
||||
void
|
||||
regex_free(re)
|
||||
struct nhregex *re;
|
||||
regex_free(struct nhregex *re)
|
||||
{
|
||||
if (re) {
|
||||
if (re->pat)
|
||||
|
||||
@@ -52,7 +52,7 @@ struct nhregex {
|
||||
};
|
||||
|
||||
struct nhregex *
|
||||
regex_init()
|
||||
regex_init(void)
|
||||
{
|
||||
return (struct nhregex *) alloc(sizeof(struct nhregex));
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ char *BC, *UP;
|
||||
short ospeed;
|
||||
|
||||
/* exported routines */
|
||||
int FDECL(tgetent, (char *, const char *));
|
||||
int FDECL(tgetflag, (const char *));
|
||||
int FDECL(tgetnum, (const char *));
|
||||
char *FDECL(tgetstr, (const char *, char **));
|
||||
char *FDECL(tgoto, (const char *, int, int));
|
||||
char *FDECL(tparam, (const char *, char *, int, int, int, int, int));
|
||||
void FDECL(tputs, (const char *, int, int (*)(int)));
|
||||
int tgetent(char *, const char *);
|
||||
int tgetflag(const char *);
|
||||
int tgetnum(const char *);
|
||||
char *tgetstr(const char *, char **);
|
||||
char *tgoto(const char *, int, int);
|
||||
char *tparam(const char *, char *, int, int, int, int, int);
|
||||
void tputs(const char *, int, int (*)(int));
|
||||
|
||||
/* local support data */
|
||||
static char *tc_entry;
|
||||
@@ -49,10 +49,10 @@ static short baud_rates[] = {
|
||||
#endif /* !NO_DELAY_PADDING */
|
||||
|
||||
/* local support code */
|
||||
static int FDECL(tc_store, (const char *, const char *));
|
||||
static char *FDECL(tc_find, (FILE *, const char *, char *, int));
|
||||
static char *FDECL(tc_name, (const char *, char *));
|
||||
static const char *FDECL(tc_field, (const char *, const char **));
|
||||
static int tc_store(const char *, const char *);
|
||||
static char *tc_find(FILE *, const char *, char *, int);
|
||||
static char *tc_name(const char *, char *);
|
||||
static const char *tc_field(const char *, const char **);
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
@@ -60,9 +60,8 @@ static const char *FDECL(tc_field, (const char *, const char **));
|
||||
|
||||
/* retrieve the specified terminal entry and return it in `entbuf' */
|
||||
int
|
||||
tgetent(entbuf, term)
|
||||
char *entbuf; /* size must be at least [TCBUFSIZ] */
|
||||
const char *term;
|
||||
tgetent(char *entbuf, /* size must be at least [TCBUFSIZ] */
|
||||
const char *term)
|
||||
{
|
||||
int result;
|
||||
FILE *fp;
|
||||
@@ -96,8 +95,7 @@ const char *term;
|
||||
|
||||
/* copy the entry into the output buffer */
|
||||
static int
|
||||
tc_store(trm, ent)
|
||||
const char *trm, *ent;
|
||||
tc_store(const char *trm, const char *ent)
|
||||
{
|
||||
const char *bar, *col;
|
||||
char *s;
|
||||
@@ -137,11 +135,7 @@ const char *trm, *ent;
|
||||
|
||||
/* search for an entry in the termcap file */
|
||||
static char *
|
||||
tc_find(fp, term, buffer, bufsiz)
|
||||
FILE *fp;
|
||||
const char *term;
|
||||
char *buffer;
|
||||
int bufsiz;
|
||||
tc_find(FILE *fp, const char *term, char *buffer, int bufsiz)
|
||||
{
|
||||
int in, len, first, skip;
|
||||
char *ip, *op, *tc_fetch, tcbuf[TCBUFSIZ];
|
||||
@@ -198,9 +192,7 @@ int bufsiz;
|
||||
|
||||
/* check whether `ent' contains `nam'; return start of field entries */
|
||||
static char *
|
||||
tc_name(nam, ent)
|
||||
const char *nam;
|
||||
char *ent;
|
||||
tc_name(const char *nam, char *ent)
|
||||
{
|
||||
char *nxt, *lst, *p = ent;
|
||||
size_t n = strlen(nam);
|
||||
@@ -220,8 +212,7 @@ char *ent;
|
||||
|
||||
/* look up a numeric entry */
|
||||
int
|
||||
tgetnum(which)
|
||||
const char *which;
|
||||
tgetnum(const char *which)
|
||||
{
|
||||
const char *q, *p = tc_field(which, &q);
|
||||
char numbuf[32];
|
||||
@@ -239,8 +230,7 @@ const char *which;
|
||||
|
||||
/* look up a boolean entry */
|
||||
int
|
||||
tgetflag(which)
|
||||
const char *which;
|
||||
tgetflag(const char *which)
|
||||
{
|
||||
const char *p = tc_field(which, (const char **) 0);
|
||||
|
||||
@@ -249,9 +239,7 @@ const char *which;
|
||||
|
||||
/* look up a string entry; update `*outptr' */
|
||||
char *
|
||||
tgetstr(which, outptr)
|
||||
const char *which;
|
||||
char **outptr;
|
||||
tgetstr(const char *which, char **outptr)
|
||||
{
|
||||
int n;
|
||||
char c, *r, *result;
|
||||
@@ -326,9 +314,7 @@ char **outptr;
|
||||
|
||||
/* look for a particular field name */
|
||||
static const char *
|
||||
tc_field(field, tc_end)
|
||||
const char *field;
|
||||
const char **tc_end;
|
||||
tc_field(const char *field, const char **tc_end)
|
||||
{
|
||||
const char *end, *q, *p = tc_entry;
|
||||
|
||||
@@ -356,20 +342,17 @@ static char cmbuf[64];
|
||||
|
||||
/* produce a string which will position the cursor at <row,col> if output */
|
||||
char *
|
||||
tgoto(cm, col, row)
|
||||
const char *cm;
|
||||
int col, row;
|
||||
tgoto(const char *cm, int col, int row)
|
||||
{
|
||||
return tparam(cm, cmbuf, (int) (sizeof cmbuf), row, col, 0, 0);
|
||||
}
|
||||
|
||||
/* format a parameterized string, ala sprintf */
|
||||
char *
|
||||
tparam(ctl, buf, buflen, row, col, row2, col2)
|
||||
const char *ctl; /* parameter control string */
|
||||
char *buf; /* output buffer */
|
||||
int buflen; /* ought to have been `size_t'... */
|
||||
int row, col, row2, col2;
|
||||
tparam(const char *ctl, /* parameter control string */
|
||||
char *buf, /* output buffer */
|
||||
int buflen, /* ought to have been `size_t'... */
|
||||
int row, int col, int row2, int col2)
|
||||
{
|
||||
int atmp, ac, av[5];
|
||||
char c, *r, *z, *bufend, numbuf[32];
|
||||
@@ -501,10 +484,9 @@ int row, col, row2, col2;
|
||||
|
||||
/* send a string to the terminal, possibly padded with trailing NULs */
|
||||
void
|
||||
tputs(string, range, output_func)
|
||||
const char *string; /* characters to output */
|
||||
int range; /* number of lines affected, used for `*' delays */
|
||||
int FDECL((*output_func),(int)); /* actual output routine;
|
||||
tputs(const char *string, /* characters to output */
|
||||
int range, /* number of lines affected, used for `*' delays */
|
||||
int (*output_func)(int)) /* actual output routine;
|
||||
* return value ignored */
|
||||
{
|
||||
register int c, num = 0;
|
||||
|
||||
@@ -131,7 +131,7 @@ struct tchars inittyb2, curttyb2;
|
||||
* used unconditionally because it conflicts with the 'bool' one.
|
||||
*/
|
||||
#ifdef NEED_HAS_COLORS_DECL
|
||||
int has_colors();
|
||||
int has_colors(void);
|
||||
#endif
|
||||
|
||||
#if defined(TTY_GRAPHICS) && ((!defined(SYSV) && !defined(HPUX)) \
|
||||
@@ -154,8 +154,7 @@ struct termstruct inittyb, curttyb;
|
||||
|
||||
#ifdef POSIX_TYPES
|
||||
static int
|
||||
speednum(speed)
|
||||
speed_t speed;
|
||||
speednum(speed_t speed)
|
||||
{
|
||||
switch (speed) {
|
||||
case B0:
|
||||
@@ -197,7 +196,7 @@ speed_t speed;
|
||||
#endif
|
||||
|
||||
static void
|
||||
setctty()
|
||||
setctty(void)
|
||||
{
|
||||
if (STTY(&curttyb) < 0 || STTY2(&curttyb2) < 0)
|
||||
perror("NetHack (setctty)");
|
||||
@@ -209,7 +208,7 @@ setctty()
|
||||
* Called by startup() in termcap.c and after returning from ! or ^Z
|
||||
*/
|
||||
void
|
||||
gettty()
|
||||
gettty(void)
|
||||
{
|
||||
if (GTTY(&inittyb) < 0 || GTTY2(&inittyb2) < 0)
|
||||
perror("NetHack (gettty)");
|
||||
@@ -231,8 +230,7 @@ gettty()
|
||||
|
||||
/* reset terminal to original state */
|
||||
void
|
||||
settty(s)
|
||||
const char *s;
|
||||
settty(const char *s)
|
||||
{
|
||||
end_screen();
|
||||
if (s)
|
||||
@@ -247,7 +245,7 @@ const char *s;
|
||||
}
|
||||
|
||||
void
|
||||
setftty()
|
||||
setftty(void)
|
||||
{
|
||||
unsigned ef, cf;
|
||||
int change = 0;
|
||||
@@ -314,7 +312,7 @@ setftty()
|
||||
start_screen();
|
||||
}
|
||||
|
||||
void intron() /* enable kbd interupts if enabled when game started */
|
||||
void intron(void) /* enable kbd interupts if enabled when game started */
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
|
||||
@@ -326,7 +324,7 @@ void intron() /* enable kbd interupts if enabled when game started */
|
||||
#endif
|
||||
}
|
||||
|
||||
void introff() /* disable kbd interrupts if required*/
|
||||
void introff(void) /* disable kbd interrupts if required*/
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
|
||||
@@ -349,13 +347,13 @@ int sco_flag_console = 0;
|
||||
int sco_map_valid = -1;
|
||||
unsigned char sco_chanmap_buf[BSIZE];
|
||||
|
||||
void NDECL(sco_mapon);
|
||||
void NDECL(sco_mapoff);
|
||||
void NDECL(check_sco_console);
|
||||
void NDECL(init_sco_cons);
|
||||
void sco_mapon(void);
|
||||
void sco_mapoff(void);
|
||||
void check_sco_console(void);
|
||||
void init_sco_cons(void);
|
||||
|
||||
void
|
||||
sco_mapon()
|
||||
sco_mapon(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && sco_flag_console) {
|
||||
@@ -368,7 +366,7 @@ sco_mapon()
|
||||
}
|
||||
|
||||
void
|
||||
sco_mapoff()
|
||||
sco_mapoff(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && sco_flag_console) {
|
||||
@@ -381,7 +379,7 @@ sco_mapoff()
|
||||
}
|
||||
|
||||
void
|
||||
check_sco_console()
|
||||
check_sco_console(void)
|
||||
{
|
||||
if (isatty(0) && ioctl(0, CONS_GET, 0) != -1) {
|
||||
sco_flag_console = 1;
|
||||
@@ -389,7 +387,7 @@ check_sco_console()
|
||||
}
|
||||
|
||||
void
|
||||
init_sco_cons()
|
||||
init_sco_cons(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && sco_flag_console) {
|
||||
@@ -413,13 +411,13 @@ init_sco_cons()
|
||||
|
||||
int linux_flag_console = 0;
|
||||
|
||||
void NDECL(linux_mapon);
|
||||
void NDECL(linux_mapoff);
|
||||
void NDECL(check_linux_console);
|
||||
void NDECL(init_linux_cons);
|
||||
void linux_mapon(void);
|
||||
void linux_mapoff(void);
|
||||
void check_linux_console(void);
|
||||
void init_linux_cons(void);
|
||||
|
||||
void
|
||||
linux_mapon()
|
||||
linux_mapon(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && linux_flag_console) {
|
||||
@@ -429,7 +427,7 @@ linux_mapon()
|
||||
}
|
||||
|
||||
void
|
||||
linux_mapoff()
|
||||
linux_mapoff(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && linux_flag_console) {
|
||||
@@ -439,7 +437,7 @@ linux_mapoff()
|
||||
}
|
||||
|
||||
void
|
||||
check_linux_console()
|
||||
check_linux_console(void)
|
||||
{
|
||||
struct vt_mode vtm;
|
||||
|
||||
@@ -449,7 +447,7 @@ check_linux_console()
|
||||
}
|
||||
|
||||
void
|
||||
init_linux_cons()
|
||||
init_linux_cons(void)
|
||||
{
|
||||
#ifdef TTY_GRAPHICS
|
||||
if (WINDOWPORT("tty") && linux_flag_console) {
|
||||
@@ -466,20 +464,19 @@ init_linux_cons()
|
||||
|
||||
#ifndef __begui__ /* the Be GUI will define its own error proc */
|
||||
/* fatal error */
|
||||
/*VARARGS1*/
|
||||
void error
|
||||
VA_DECL(const char *, s)
|
||||
void
|
||||
error(const char *s, ...)
|
||||
{
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
va_list the_args;
|
||||
|
||||
va_start(the_args, s);
|
||||
if (iflags.window_inited)
|
||||
exit_nhwindows((char *) 0); /* for tty, will call settty() */
|
||||
if (settty_needed)
|
||||
settty((char *) 0);
|
||||
Vprintf(s, VA_ARGS);
|
||||
Vprintf(s, the_args);
|
||||
(void) putchar('\n');
|
||||
VA_END();
|
||||
va_end(the_args);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif /* !__begui__ */
|
||||
|
||||
@@ -88,9 +88,7 @@ static void outdec(char *, FILE *, int);
|
||||
#define DEC(c) (((c) - ' ') & 077)
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FILE *in, *out;
|
||||
int mode;
|
||||
@@ -179,9 +177,7 @@ char **argv;
|
||||
* copy from in to out, decoding as you go along.
|
||||
*/
|
||||
void
|
||||
decode(in, out)
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
decode(FILE *in, FILE *out)
|
||||
{
|
||||
char buf[80];
|
||||
char *bp;
|
||||
@@ -218,10 +214,7 @@ FILE *out;
|
||||
* output all of them at the end of the file.
|
||||
*/
|
||||
void
|
||||
outdec(p, f, n)
|
||||
char *p;
|
||||
FILE *f;
|
||||
int n;
|
||||
outdec(char *p, FILE *f, int n)
|
||||
{
|
||||
int c1, c2, c3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user