Make mostly gcc -W clean, and other cleanup:

Use const.
Add __noreturn__ attributes.
Add a __format__ attribute.
Add __unused__ attributes.
Use symbolic constants for open() and lseek().
Declare types of all function parameters; convert some function
definitions to ISO C form.
Ensure standard file descriptors are open on startup.
Check for errors writing output of makedefs.
Avoid duplicate definitions of variables.
This commit is contained in:
jsm 2001-03-25 20:43:58 +00:00
parent f69fcce6d5
commit ab8b63434d
52 changed files with 339 additions and 330 deletions

View File

@ -1,3 +1,3 @@
/* $NetBSD: date.h,v 1.3 1995/03/23 08:29:17 cgd Exp $ */ /* $NetBSD: date.h,v 1.4 2001/03/25 20:43:58 jsm Exp $ */
char datestring[] = "Tue Jul 23 1985"; const char datestring[] = "Tue Jul 23 1985";

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.func_tab.h,v 1.4 1997/10/19 16:56:58 christos Exp $ */ /* $NetBSD: def.func_tab.h,v 1.5 2001/03/25 20:43:58 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -10,12 +10,12 @@ struct func_tab {
int (*f_funct) __P((void)); int (*f_funct) __P((void));
}; };
extern struct func_tab cmdlist[]; extern const struct func_tab cmdlist[];
struct ext_func_tab { struct ext_func_tab {
char *ef_txt; const char *ef_txt;
int (*ef_funct) __P((void)); int (*ef_funct) __P((void));
}; };
extern struct ext_func_tab extcmdlist[]; extern const struct ext_func_tab extcmdlist[];
#endif /* _DEF_FUNC_TAB_H_ */ #endif /* _DEF_FUNC_TAB_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.monst.h,v 1.5 2001/01/16 02:50:28 cgd Exp $ */ /* $NetBSD: def.monst.h,v 1.6 2001/03/25 20:43:58 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -7,7 +7,7 @@
#define _DEF_MONST_H_ #define _DEF_MONST_H_
struct monst { struct monst {
struct monst *nmon; struct monst *nmon;
struct permonst *data; const struct permonst *data;
unsigned m_id; unsigned m_id;
xchar mx,my; xchar mx,my;
xchar mdx,mdy; /* if mdispl then pos where last displayed */ xchar mdx,mdy; /* if mdispl then pos where last displayed */

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.objclass.h,v 1.4 1997/10/19 16:57:12 christos Exp $ */ /* $NetBSD: def.objclass.h,v 1.5 2001/03/25 20:43:58 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -8,8 +8,8 @@
/* definition of a class of objects */ /* definition of a class of objects */
struct objclass { struct objclass {
char *oc_name; /* actual name */ const char *oc_name; /* actual name */
char *oc_descr; /* description when name unknown */ const char *oc_descr; /* description when name unknown */
char *oc_uname; /* called by user */ char *oc_uname; /* called by user */
Bitfield(oc_name_known,1); Bitfield(oc_name_known,1);
Bitfield(oc_merge,1); /* merge otherwise equal objects */ Bitfield(oc_merge,1); /* merge otherwise equal objects */

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.objects.h,v 1.4 1997/10/19 16:57:16 christos Exp $ */ /* $NetBSD: def.objects.h,v 1.5 2001/03/25 20:43:58 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -285,7 +285,7 @@ struct objclass objects[] = {
{ NULL, NULL, NULL, 0, 0, ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 } { NULL, NULL, NULL, 0, 0, ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 }
}; };
char obj_symbols[] = { const char obj_symbols[] = {
ILLOBJ_SYM, AMULET_SYM, FOOD_SYM, WEAPON_SYM, TOOL_SYM, ILLOBJ_SYM, AMULET_SYM, FOOD_SYM, WEAPON_SYM, TOOL_SYM,
BALL_SYM, CHAIN_SYM, ROCK_SYM, ARMOR_SYM, POTION_SYM, SCROLL_SYM, BALL_SYM, CHAIN_SYM, ROCK_SYM, ARMOR_SYM, POTION_SYM, SCROLL_SYM,
WAND_SYM, RING_SYM, GEM_SYM, 0 }; WAND_SYM, RING_SYM, GEM_SYM, 0 };

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.permonst.h,v 1.4 1997/10/19 16:57:19 christos Exp $ */ /* $NetBSD: def.permonst.h,v 1.5 2001/03/25 20:43:58 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -7,12 +7,13 @@
#ifndef _DEF_PERMONST_H_ #ifndef _DEF_PERMONST_H_
#define _DEF_PERMONST_H_ #define _DEF_PERMONST_H_
struct permonst { struct permonst {
char *mname,mlet; const char *mname;
char mlet;
schar mlevel,mmove,ac,damn,damd; schar mlevel,mmove,ac,damn,damd;
unsigned pxlth; unsigned pxlth;
}; };
extern struct permonst mons[]; extern const struct permonst mons[];
#define PM_ACID_BLOB &mons[7] #define PM_ACID_BLOB &mons[7]
#define PM_ZOMBIE &mons[13] #define PM_ZOMBIE &mons[13]
#define PM_PIERCER &mons[17] #define PM_PIERCER &mons[17]

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.3 2001/02/05 00:37:43 christos Exp $ */ /* $NetBSD: extern.h,v 1.4 2001/03/25 20:43:58 jsm Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -74,7 +74,7 @@ void nomul __P((int));
int abon __P((void)); int abon __P((void));
int dbon __P((void)); int dbon __P((void));
void losestr __P((int)); void losestr __P((int));
void losehp __P((int, char *)); void losehp __P((int, const char *));
void losehp_m __P((int, struct monst *)); void losehp_m __P((int, struct monst *));
void losexp __P((void)); void losexp __P((void));
int inv_weight __P((void)); int inv_weight __P((void));
@ -82,7 +82,7 @@ int inv_cnt __P((void));
long newuexp __P((void)); long newuexp __P((void));
/* hack.cmd.c */ /* hack.cmd.c */
void rhack __P((char *)); void rhack __P((const char *));
int doextcmd __P((void)); int doextcmd __P((void));
char lowc __P((int)); char lowc __P((int));
char unctrl __P((int)); char unctrl __P((int));
@ -110,7 +110,7 @@ void set_wounded_legs __P((long, int));
void heal_legs __P((void)); void heal_legs __P((void));
/* hack.do_name.c */ /* hack.do_name.c */
coord getpos __P((int, char *)); coord getpos __P((int, const char *));
int do_mname __P((void)); int do_mname __P((void));
void do_oname __P((struct obj *)); void do_oname __P((struct obj *));
int ddocall __P((void)); int ddocall __P((void));
@ -119,8 +119,8 @@ char *xmonnam __P((struct monst *, int));
char *lmonnam __P((struct monst *)); char *lmonnam __P((struct monst *));
char *monnam __P((struct monst *)); char *monnam __P((struct monst *));
char *Monnam __P((struct monst *)); char *Monnam __P((struct monst *));
char *amonnam __P((struct monst *, char *)); char *amonnam __P((struct monst *, const char *));
char *Amonnam __P((struct monst *, char *)); char *Amonnam __P((struct monst *, const char *));
char *Xmonnam __P((struct monst *)); char *Xmonnam __P((struct monst *));
char *visctrl __P((int)); char *visctrl __P((int));
@ -169,26 +169,26 @@ void done1 __P((int));
void done_intr __P((int)); void done_intr __P((int));
void done_hangup __P((int)); void done_hangup __P((int));
void done_in_by __P((struct monst *)); void done_in_by __P((struct monst *));
void done __P((char *)); void done __P((const char *));
void topten __P((void)); void topten __P((void));
void outheader __P((void)); void outheader __P((void));
struct toptenentry; struct toptenentry;
int outentry __P((int, struct toptenentry *, int)); int outentry __P((int, struct toptenentry *, int));
char *itoa __P((int)); char *itoa __P((int));
char *ordin __P((int)); const char *ordin __P((int));
void clearlocks __P((void)); void clearlocks __P((void));
void hangup __P((int)); void hangup __P((int)) __attribute__((__noreturn__));
char *eos __P((char *)); char *eos __P((char *));
void charcat __P((char *, int)); void charcat __P((char *, int));
void prscore __P((int, char **)); void prscore __P((int, char **));
/* hack.engrave.c */ /* hack.engrave.c */
struct engr *engr_at __P((xchar, xchar)); struct engr *engr_at __P((xchar, xchar));
int sengr_at __P((char *, xchar, xchar)); int sengr_at __P((const char *, xchar, xchar));
void u_wipe_engr __P((int)); void u_wipe_engr __P((int));
void wipe_engr_at __P((xchar, xchar, xchar)); void wipe_engr_at __P((xchar, xchar, xchar));
void read_engr_at __P((int, int)); void read_engr_at __P((int, int));
void make_engr_at __P((int, int, char *)); void make_engr_at __P((int, int, const char *));
int doengrave __P((void)); int doengrave __P((void));
void save_engravings __P((int)); void save_engravings __P((int));
void rest_engravings __P((int)); void rest_engravings __P((int));
@ -199,7 +199,7 @@ int hitmm __P((struct monst *, struct monst *));
void mondied __P((struct monst *)); void mondied __P((struct monst *));
void monstone __P((struct monst *)); void monstone __P((struct monst *));
int fightm __P((struct monst *)); int fightm __P((struct monst *));
int thitu __P((int, int, char *)); int thitu __P((int, int, const char *));
boolean hmon __P((struct monst *, struct obj *, int)); boolean hmon __P((struct monst *, struct obj *, int));
int attack __P((struct monst *)); int attack __P((struct monst *));
@ -220,9 +220,9 @@ struct obj *o_on __P((unsigned int, struct obj *));
struct trap *t_at __P((int, int)); struct trap *t_at __P((int, int));
struct gold *g_at __P((int, int)); struct gold *g_at __P((int, int));
struct obj *mkgoldobj __P((long)); struct obj *mkgoldobj __P((long));
struct obj *getobj __P((char *, char *)); struct obj *getobj __P((const char *, const char *));
int ckunpaid __P((struct obj *)); int ckunpaid __P((struct obj *));
int ggetobj __P((char *, int (*fn)(struct obj *), int)); int ggetobj __P((const char *, int (*fn)(struct obj *), int));
int askchain __P((struct obj *, char *, int, int (*)(struct obj *), int askchain __P((struct obj *, char *, int, int (*)(struct obj *),
int (*)(struct obj *), int)); int (*)(struct obj *), int));
char obj_to_let __P((struct obj *)); char obj_to_let __P((struct obj *));
@ -247,7 +247,7 @@ int dosuspend __P((void));
/* hack.lev.c */ /* hack.lev.c */
void savelev __P((int, xchar)); void savelev __P((int, xchar));
void bwrite __P((int, char *, unsigned)); void bwrite __P((int, const void *, unsigned));
void saveobjchn __P((int, struct obj *)); void saveobjchn __P((int, struct obj *));
void savemonchn __P((int, struct monst *)); void savemonchn __P((int, struct monst *));
void savegoldchn __P((int, struct gold *)); void savegoldchn __P((int, struct gold *));
@ -264,7 +264,7 @@ void impossible __P((const char *, ...))
void stop_occupation __P((void)); void stop_occupation __P((void));
/* hack.makemon.c */ /* hack.makemon.c */
struct monst *makemon __P((struct permonst *, int, int)); struct monst *makemon __P((const struct permonst *, int, int));
coord enexto __P((xchar, xchar)); coord enexto __P((xchar, xchar));
int goodpos __P((int, int)); int goodpos __P((int, int));
void rloc __P((struct monst *)); void rloc __P((struct monst *));
@ -312,7 +312,7 @@ void mkgold __P((long, int, int));
/* hack.mkshop.c */ /* hack.mkshop.c */
void mkshop __P((void)); void mkshop __P((void));
void mkzoo __P((int)); void mkzoo __P((int));
struct permonst *morguemon __P((void)); const struct permonst *morguemon __P((void));
void mkswamp __P((void)); void mkswamp __P((void));
int nexttodoor __P((int, int)); int nexttodoor __P((int, int));
int has_dnstairs __P((struct mkroom *)); int has_dnstairs __P((struct mkroom *));
@ -323,8 +323,8 @@ int sq __P((int));
/* hack.mon.c */ /* hack.mon.c */
void movemon __P((void)); void movemon __P((void));
void justswld __P((struct monst *, char *)); void justswld __P((struct monst *, const char *));
void youswld __P((struct monst *, int, int, char *)); void youswld __P((struct monst *, int, int, const char *));
int dochugw __P((struct monst *)); int dochugw __P((struct monst *));
int dochug __P((struct monst *)); int dochug __P((struct monst *));
int m_move __P((struct monst *, int)); int m_move __P((struct monst *, int));
@ -332,7 +332,7 @@ void mpickgold __P((struct monst *));
void mpickgems __P((struct monst *)); void mpickgems __P((struct monst *));
int mfndpos __P((struct monst *, coord[9 ], int[9 ], int)); int mfndpos __P((struct monst *, coord[9 ], int[9 ], int));
int dist __P((int, int)); int dist __P((int, int));
void poisoned __P((char *, char *)); void poisoned __P((const char *, const char *));
void mondead __P((struct monst *)); void mondead __P((struct monst *));
void replmon __P((struct monst *, struct monst *)); void replmon __P((struct monst *, struct monst *));
void relmon __P((struct monst *)); void relmon __P((struct monst *));
@ -340,9 +340,9 @@ void monfree __P((struct monst *));
void dmonsfree __P((void)); void dmonsfree __P((void));
void unstuck __P((struct monst *)); void unstuck __P((struct monst *));
void killed __P((struct monst *)); void killed __P((struct monst *));
void kludge __P((char *, char *)); void kludge __P((const char *, const char *));
void rescham __P((void)); void rescham __P((void));
int newcham __P((struct monst *, struct permonst *)); int newcham __P((struct monst *, const struct permonst *));
void mnexto __P((struct monst *)); void mnexto __P((struct monst *));
int ishuman __P((struct monst *)); int ishuman __P((struct monst *));
void setmangry __P((struct monst *)); void setmangry __P((struct monst *));
@ -367,8 +367,8 @@ char *sitoa __P((int));
char *typename __P((int)); char *typename __P((int));
char *xname __P((struct obj *)); char *xname __P((struct obj *));
char *doname __P((struct obj *)); char *doname __P((struct obj *));
void setan __P((char *, char *)); void setan __P((const char *, char *));
char *aobjnam __P((struct obj *, char *)); char *aobjnam __P((struct obj *, const char *));
char *Doname __P((struct obj *)); char *Doname __P((struct obj *));
struct obj *readobjnam __P((char *)); struct obj *readobjnam __P((char *));
@ -384,17 +384,17 @@ void page_more __P((FILE *, int));
void set_whole_screen __P((void)); void set_whole_screen __P((void));
int readnews __P((void)); int readnews __P((void));
void set_pager __P((int)); void set_pager __P((int));
int page_line __P((char *)); int page_line __P((const char *));
void cornline __P((int, char *)); void cornline __P((int, const char *));
int dohelp __P((void)); int dohelp __P((void));
int page_file __P((char *, boolean)); int page_file __P((const char *, boolean));
int dosh __P((void)); int dosh __P((void));
int child __P((int)); int child __P((int));
/* hack.potion.c */ /* hack.potion.c */
int dodrink __P((void)); int dodrink __P((void));
void pluslvl __P((void)); void pluslvl __P((void));
void strange_feeling __P((struct obj *, char *)); void strange_feeling __P((struct obj *, const char *));
void potionhit __P((struct monst *, struct obj *)); void potionhit __P((struct monst *, struct obj *));
void potionbreathe __P((struct obj *)); void potionbreathe __P((struct obj *));
int dodip __P((void)); int dodip __P((void));
@ -408,7 +408,7 @@ void atl __P((int, int, int));
void on_scr __P((int, int)); void on_scr __P((int, int));
void tmp_at __P((schar, schar)); void tmp_at __P((schar, schar));
void Tmp_at __P((schar, schar)); void Tmp_at __P((schar, schar));
void setclipped __P((void)); void setclipped __P((void)) __attribute__((__noreturn__));
void at __P((xchar, xchar, int)); void at __P((xchar, xchar, int));
void prme __P((void)); void prme __P((void));
int doredraw __P((void)); int doredraw __P((void));
@ -526,16 +526,17 @@ void stoned_dialogue __P((void));
int doredotopl __P((void)); int doredotopl __P((void));
void redotoplin __P((void)); void redotoplin __P((void));
void remember_topl __P((void)); void remember_topl __P((void));
void addtopl __P((char *)); void addtopl __P((const char *));
void xmore __P((char *)); void xmore __P((const char *));
void more __P((void)); void more __P((void));
void cmore __P((char *)); void cmore __P((const char *));
void clrlin __P((void)); void clrlin __P((void));
void pline __P((const char *, ...)) void pline __P((const char *, ...))
__attribute__((__format__(__printf__, 1, 2))); __attribute__((__format__(__printf__, 1, 2)));
void vpline __P((const char *, va_list)); void vpline __P((const char *, va_list))
__attribute__((__format__(__printf__, 1, 0)));
void putsym __P((int)); void putsym __P((int));
void putstr __P((char *)); void putstr __P((const char *));
/* hack.track.c */ /* hack.track.c */
void initrack __P((void)); void initrack __P((void));
@ -546,7 +547,7 @@ coord *gettrack __P((int, int));
struct trap *maketrap __P((int, int, int)); struct trap *maketrap __P((int, int, int));
void dotrap __P((struct trap *)); void dotrap __P((struct trap *));
int mintrap __P((struct monst *)); int mintrap __P((struct monst *));
void selftouch __P((char *)); void selftouch __P((const char *));
void float_up __P((void)); void float_up __P((void));
void float_down __P((void)); void float_down __P((void));
void vtele __P((void)); void vtele __P((void));
@ -561,18 +562,18 @@ void drown __P((void));
/* hack.tty.c */ /* hack.tty.c */
void gettty __P((void)); void gettty __P((void));
void settty __P((char *)); void settty __P((const char *));
void setctty __P((void)); void setctty __P((void));
void setftty __P((void)); void setftty __P((void));
void error __P((const char *, ...)) void error __P((const char *, ...))
__attribute__((__format__(__printf__, 1, 2),__noreturn__)); __attribute__((__format__(__printf__, 1, 2),__noreturn__));
void getlin __P((char *)); void getlin __P((char *));
void getret __P((void)); void getret __P((void));
void cgetret __P((char *)); void cgetret __P((const char *));
void xwaitforspace __P((char *)); void xwaitforspace __P((const char *));
char *parse __P((void)); char *parse __P((void));
char readchar __P((void)); char readchar __P((void));
void end_of_input __P((void)); void end_of_input __P((void)) __attribute__((__noreturn__));
/* hack.u_init.c */ /* hack.u_init.c */
void u_init __P((void)); void u_init __P((void));
@ -647,9 +648,9 @@ void setnotworn __P((struct obj *));
void bhitm __P((struct monst *, struct obj *)); void bhitm __P((struct monst *, struct obj *));
int bhito __P((struct obj *, struct obj *)); int bhito __P((struct obj *, struct obj *));
int dozap __P((void)); int dozap __P((void));
char *exclam __P((int)); const char *exclam __P((int));
void hit __P((char *, struct monst *, char *)); void hit __P((const char *, struct monst *, const char *));
void miss __P((char *, struct monst *)); void miss __P((const char *, struct monst *));
struct monst *bhit __P((int, int, int, int, struct monst *bhit __P((int, int, int, int,
void (*)(struct monst *, struct obj *), void (*)(struct monst *, struct obj *),
int (*)(struct obj *, struct obj *), int (*)(struct obj *, struct obj *),

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.Decl.c,v 1.4 1997/10/19 16:57:30 christos Exp $ */ /* $NetBSD: hack.Decl.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.Decl.c,v 1.4 1997/10/19 16:57:30 christos Exp $"); __RCSID("$NetBSD: hack.Decl.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -35,7 +35,8 @@ struct monst youmonst; /* dummy; used as return value for boomhit */
xchar dlevel = 1; xchar dlevel = 1;
xchar xupstair, yupstair, xdnstair, ydnstair; xchar xupstair, yupstair, xdnstair, ydnstair;
char *save_cm = 0, *killer, *nomovemsg; char *save_cm = 0;
const char *killer, *nomovemsg;
long moves = 1; long moves = 1;
long wailmsg = 0; long wailmsg = 0;
@ -49,4 +50,4 @@ xchar seelx, seehx, seely, seehy; /* corners of lit room */
coord bhitpos; coord bhitpos;
char quitchars[] = " \r\n\033"; const char quitchars[] = " \r\n\033";

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.apply.c,v 1.5 1997/10/19 16:57:32 christos Exp $ */ /* $NetBSD: hack.apply.c,v 1.6 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.apply.c,v 1.5 1997/10/19 16:57:32 christos Exp $"); __RCSID("$NetBSD: hack.apply.c,v 1.6 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -80,7 +80,7 @@ xit:
/* ARGSUSED */ /* ARGSUSED */
static void static void
use_camera(obj) /* */ use_camera(obj) /* */
struct obj *obj; struct obj *obj __attribute__((__unused__));
{ {
struct monst *mtmp; struct monst *mtmp;
if (!getdir(1)) { /* ask: in what direction? */ if (!getdir(1)) { /* ask: in what direction? */
@ -246,7 +246,7 @@ bchit(ddx, ddy, range, sym)
/* ARGSUSED */ /* ARGSUSED */
static void static void
use_whistle(obj) use_whistle(obj)
struct obj *obj; struct obj *obj __attribute__((__unused__));
{ {
struct monst *mtmp = fmon; struct monst *mtmp = fmon;
pline("You produce a high whistling sound."); pline("You produce a high whistling sound.");
@ -264,7 +264,7 @@ use_whistle(obj)
/* ARGSUSED */ /* ARGSUSED */
static void static void
use_magic_whistle(obj) use_magic_whistle(obj)
struct obj *obj; struct obj *obj __attribute__((__unused__));
{ {
struct monst *mtmp = fmon; struct monst *mtmp = fmon;
pline("You produce a strange whistling sound."); pline("You produce a strange whistling sound.");
@ -317,7 +317,7 @@ dig()
} }
} }
} else if (dig_effort > 100) { } else if (dig_effort > 100) {
char *digtxt; const char *digtxt;
struct obj *obj; struct obj *obj;
lev = &levl[dpx][dpy]; lev = &levl[dpx][dpy];

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.bones.c,v 1.4 1997/10/19 16:57:34 christos Exp $ */ /* $NetBSD: hack.bones.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.bones.c,v 1.4 1997/10/19 16:57:34 christos Exp $"); __RCSID("$NetBSD: hack.bones.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -31,7 +31,7 @@ savebones()
return; /* not so many ghosts on low levels */ return; /* not so many ghosts on low levels */
bones[6] = '0' + (dlevel / 10); bones[6] = '0' + (dlevel / 10);
bones[7] = '0' + (dlevel % 10); bones[7] = '0' + (dlevel % 10);
if ((fd = open(bones, 0)) >= 0) { if ((fd = open(bones, O_RDONLY)) >= 0) {
(void) close(fd); (void) close(fd);
return; return;
} }
@ -98,7 +98,7 @@ getbones()
return (0); /* only once in three times do we find bones */ return (0); /* only once in three times do we find bones */
bones[6] = '0' + dlevel / 10; bones[6] = '0' + dlevel / 10;
bones[7] = '0' + dlevel % 10; bones[7] = '0' + dlevel % 10;
if ((fd = open(bones, 0)) < 0) if ((fd = open(bones, O_RDONLY)) < 0)
return (0); return (0);
if ((ok = uptodate(fd)) != 0) { if ((ok = uptodate(fd)) != 0) {
getlev(fd, 0, dlevel); getlev(fd, 0, dlevel);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.c,v 1.4 1997/10/19 16:57:37 christos Exp $ */ /* $NetBSD: hack.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.c,v 1.4 1997/10/19 16:57:37 christos Exp $"); __RCSID("$NetBSD: hack.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -353,7 +353,7 @@ dopickup()
} }
void void
pickup(all) pickup(int all)
{ {
struct gold *gold; struct gold *gold;
struct obj *obj, *obj2; struct obj *obj, *obj2;
@ -836,7 +836,7 @@ losestr(num) /* may kill you; cause may be poison or */
void void
losehp(n, knam) losehp(n, knam)
int n; int n;
char *knam; const char *knam;
{ {
u.uhp -= n; u.uhp -= n;
if (u.uhp > u.uhpmax) if (u.uhp > u.uhpmax)

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.cmd.c,v 1.5 2001/01/16 02:50:28 cgd Exp $ */ /* $NetBSD: hack.cmd.c,v 1.6 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,14 +6,14 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.cmd.c,v 1.5 2001/01/16 02:50:28 cgd Exp $"); __RCSID("$NetBSD: hack.cmd.c,v 1.6 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
#include "extern.h" #include "extern.h"
#include "def.func_tab.h" #include "def.func_tab.h"
struct func_tab cmdlist[] = { const struct func_tab cmdlist[] = {
{ '\020', doredotopl }, { '\020', doredotopl },
{ '\022', doredraw }, { '\022', doredraw },
{ '\024', dotele }, { '\024', dotele },
@ -77,7 +77,7 @@ struct func_tab cmdlist[] = {
{ 0, 0 } { 0, 0 }
}; };
struct ext_func_tab extcmdlist[] = { const struct ext_func_tab extcmdlist[] = {
{ "dip", dodip }, { "dip", dodip },
{ "pray", dopray }, { "pray", dopray },
{ (char *) 0, donull } { (char *) 0, donull }
@ -85,9 +85,9 @@ struct ext_func_tab extcmdlist[] = {
void void
rhack(cmd) rhack(cmd)
char *cmd; const char *cmd;
{ {
struct func_tab *tlist = cmdlist; const struct func_tab *tlist = cmdlist;
boolean firsttime = FALSE; boolean firsttime = FALSE;
int res; int res;
@ -190,7 +190,7 @@ doextcmd()
{ /* here after # - now read a full-word { /* here after # - now read a full-word
* command */ * command */
char buf[BUFSZ]; char buf[BUFSZ];
struct ext_func_tab *efp = extcmdlist; const struct ext_func_tab *efp = extcmdlist;
pline("# "); pline("# ");
getlin(buf); getlin(buf);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.do.c,v 1.4 1997/10/19 16:57:41 christos Exp $ */ /* $NetBSD: hack.do.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.do.c,v 1.4 1997/10/19 16:57:41 christos Exp $"); __RCSID("$NetBSD: hack.do.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */ /* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */
@ -185,7 +185,7 @@ goto_level(newlevel, at_stairs)
if (!level_exists[dlevel]) if (!level_exists[dlevel])
mklev(); mklev();
else { else {
if ((fd = open(lock, 0)) < 0) { if ((fd = open(lock, O_RDONLY)) < 0) {
pline("Cannot open %s .", lock); pline("Cannot open %s .", lock);
pline("Probably someone removed it."); pline("Probably someone removed it.");
done("tricked"); done("tricked");

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.do_name.c,v 1.4 1997/10/19 16:57:46 christos Exp $ */ /* $NetBSD: hack.do_name.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.do_name.c,v 1.4 1997/10/19 16:57:46 christos Exp $"); __RCSID("$NetBSD: hack.do_name.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -16,7 +16,7 @@ __RCSID("$NetBSD: hack.do_name.c,v 1.4 1997/10/19 16:57:46 christos Exp $");
coord coord
getpos(force, goal) getpos(force, goal)
int force; int force;
char *goal; const char *goal;
{ {
int cx, cy, i, c; int cx, cy, i, c;
coord cc; coord cc;
@ -202,7 +202,7 @@ docall(obj)
*str1 = str; *str1 = str;
} }
char *ghostnames[] = {/* these names should have length < PL_NSIZ */ const char *const ghostnames[] = {/* these names should have length < PL_NSIZ */
"adri", "andries", "andreas", "bert", "david", "dirk", "emile", "adri", "andries", "andreas", "bert", "david", "dirk", "emile",
"frans", "fred", "greg", "hether", "jay", "john", "jon", "kay", "frans", "fred", "greg", "hether", "jay", "john", "jon", "kay",
"kenny", "maud", "michiel", "mike", "peter", "robert", "ron", "kenny", "maud", "michiel", "mike", "peter", "robert", "ron",
@ -222,7 +222,7 @@ xmonnam(mtmp, vb)
switch (mtmp->data->mlet) { switch (mtmp->data->mlet) {
case ' ': case ' ':
{ {
char *gn = (char *) mtmp->mextra; const char *gn = (char *) mtmp->mextra;
if (!*gn) { /* might also look in scorefile */ if (!*gn) { /* might also look in scorefile */
gn = ghostnames[rn2(SIZE(ghostnames))]; gn = ghostnames[rn2(SIZE(ghostnames))];
if (!rn2(2)) if (!rn2(2))
@ -277,7 +277,7 @@ Monnam(mtmp)
char * char *
amonnam(mtmp, adj) amonnam(mtmp, adj)
struct monst *mtmp; struct monst *mtmp;
char *adj; const char *adj;
{ {
char *bp = monnam(mtmp); char *bp = monnam(mtmp);
static char buf[BUFSZ]; /* %% */ static char buf[BUFSZ]; /* %% */
@ -291,7 +291,7 @@ amonnam(mtmp, adj)
char * char *
Amonnam(mtmp, adj) Amonnam(mtmp, adj)
struct monst *mtmp; struct monst *mtmp;
char *adj; const char *adj;
{ {
char *bp = amonnam(mtmp, adj); char *bp = amonnam(mtmp, adj);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.dog.c,v 1.4 1997/10/19 16:57:50 christos Exp $ */ /* $NetBSD: hack.dog.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.dog.c,v 1.4 1997/10/19 16:57:50 christos Exp $"); __RCSID("$NetBSD: hack.dog.c,v 1.5 2001/03/25 20:43:59 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -15,11 +15,11 @@ __RCSID("$NetBSD: hack.dog.c,v 1.4 1997/10/19 16:57:50 christos Exp $");
#include "def.edog.h" #include "def.edog.h"
#include "def.mkroom.h" #include "def.mkroom.h"
struct permonst li_dog = const struct permonst li_dog =
{"little dog", 'd', 2, 18, 6, 1, 6, sizeof(struct edog)}; {"little dog", 'd', 2, 18, 6, 1, 6, sizeof(struct edog)};
struct permonst dog = const struct permonst dog =
{"dog", 'd', 4, 16, 5, 1, 6, sizeof(struct edog)}; {"dog", 'd', 4, 16, 5, 1, 6, sizeof(struct edog)};
struct permonst la_dog = const struct permonst la_dog =
{"large dog", 'd', 6, 15, 4, 2, 4, sizeof(struct edog)}; {"large dog", 'd', 6, 15, 4, 2, 4, sizeof(struct edog)};
@ -131,13 +131,12 @@ dogfood(obj)
/* return 0 (no move), 1 (move) or 2 (dead) */ /* return 0 (no move), 1 (move) or 2 (dead) */
int int
dog_move(mtmp, after) dog_move(struct monst *mtmp, int after)
struct monst *mtmp;
{ {
int nx, ny, omx, omy, appr, nearer, j; int nx, ny, omx, omy, appr, nearer, j;
int udist, chi = 0, i, whappr; int udist, chi = 0, i, whappr;
struct monst *mtmp2; struct monst *mtmp2;
struct permonst *mdat = mtmp->data; const struct permonst *mdat = mtmp->data;
struct edog *edog = EDOG(mtmp); struct edog *edog = EDOG(mtmp);
struct obj *obj; struct obj *obj;
struct trap *trap; struct trap *trap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.eat.c,v 1.4 1997/10/19 16:57:53 christos Exp $ */ /* $NetBSD: hack.eat.c,v 1.5 2001/03/25 20:44:00 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.eat.c,v 1.4 1997/10/19 16:57:53 christos Exp $"); __RCSID("$NetBSD: hack.eat.c,v 1.5 2001/03/25 20:44:00 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -22,7 +22,7 @@ char POISONOUS[] = "ADKSVabhks";
#define FAINTED 5 #define FAINTED 5
#define STARVED 6 #define STARVED 6
char *hu_stat[] = { const char *const hu_stat[] = {
"Satiated", "Satiated",
" ", " ",
"Hungry ", "Hungry ",
@ -40,8 +40,8 @@ init_uhunger()
} }
#define TTSZ SIZE(tintxts) #define TTSZ SIZE(tintxts)
struct { const struct {
char *txt; const char *txt;
int nut; int nut;
} tintxts[] = { } tintxts[] = {
{ "It contains first quality peaches - what a surprise!", 40 }, { "It contains first quality peaches - what a surprise!", 40 },

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.end.c,v 1.4 1997/10/19 16:57:55 christos Exp $ */ /* $NetBSD: hack.end.c,v 1.5 2001/03/25 20:44:00 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.end.c,v 1.4 1997/10/19 16:57:55 christos Exp $"); __RCSID("$NetBSD: hack.end.c,v 1.5 2001/03/25 20:44:00 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@ -29,7 +29,7 @@ dodone()
/*ARGSUSED*/ /*ARGSUSED*/
void void
done1(n) done1(n)
int n; int n __attribute__((__unused__));
{ {
(void) signal(SIGINT, SIG_IGN); (void) signal(SIGINT, SIG_IGN);
pline("Really quit?"); pline("Really quit?");
@ -51,7 +51,7 @@ int done_hup;
/*ARGSUSED*/ /*ARGSUSED*/
void void
done_intr(n) done_intr(n)
int n; int n __attribute__((__unused__));
{ {
done_stopprint++; done_stopprint++;
(void) signal(SIGINT, SIG_IGN); (void) signal(SIGINT, SIG_IGN);
@ -95,7 +95,7 @@ done_in_by(mtmp)
/* Be careful not to call panic from here! */ /* Be careful not to call panic from here! */
void void
done(st1) done(st1)
char *st1; const char *st1;
{ {
#ifdef WIZARD #ifdef WIZARD
@ -265,8 +265,8 @@ topten()
int rank, rank0 = -1, rank1 = 0; int rank, rank0 = -1, rank1 = 0;
int occ_cnt = PERSMAX; int occ_cnt = PERSMAX;
struct toptenentry *t0, *t1, *tprev; struct toptenentry *t0, *t1, *tprev;
char *recfile = RECORD; const char *recfile = RECORD;
char *reclock = "record_lock"; const char *reclock = "record_lock";
int sleepct = 300; int sleepct = 300;
FILE *rfile; FILE *rfile;
int flg = 0; int flg = 0;
@ -439,8 +439,7 @@ outheader()
/* so>0: standout line; so=0: ordinary line; so<0: no output, return lth */ /* so>0: standout line; so=0: ordinary line; so<0: no output, return lth */
int int
outentry(rank, t1, so) outentry(int rank, struct toptenentry *t1, int so)
struct toptenentry *t1;
{ {
boolean quit = FALSE, killed = FALSE, starv = FALSE; boolean quit = FALSE, killed = FALSE, starv = FALSE;
char linebuf[BUFSZ]; char linebuf[BUFSZ];
@ -527,7 +526,7 @@ itoa(a)
return (buf); return (buf);
} }
char * const char *
ordin(n) ordin(n)
int n; int n;
{ {
@ -593,7 +592,7 @@ prscore(argc, argv)
int playerct; int playerct;
int rank; int rank;
struct toptenentry *t1, *t2; struct toptenentry *t1, *t2;
char *recfile = RECORD; const char *recfile = RECORD;
FILE *rfile; FILE *rfile;
int flg = 0; int flg = 0;
int i; int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.engrave.c,v 1.4 1997/10/19 16:57:58 christos Exp $ */ /* $NetBSD: hack.engrave.c,v 1.5 2001/03/25 20:44:00 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.engrave.c,v 1.4 1997/10/19 16:57:58 christos Exp $"); __RCSID("$NetBSD: hack.engrave.c,v 1.5 2001/03/25 20:44:00 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -42,7 +42,7 @@ engr_at(x, y)
int int
sengr_at(s, x, y) sengr_at(s, x, y)
char *s; const char *s;
xchar x, y; xchar x, y;
{ {
struct engr *ep = engr_at(x, y); struct engr *ep = engr_at(x, y);
@ -126,7 +126,7 @@ read_engr_at(x, y)
void void
make_engr_at(x, y, s) make_engr_at(x, y, s)
int x, y; int x, y;
char *s; const char *s;
{ {
struct engr *ep; struct engr *ep;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.fight.c,v 1.4 1997/10/19 16:58:00 christos Exp $ */ /* $NetBSD: hack.fight.c,v 1.5 2001/03/25 20:44:00 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.fight.c,v 1.4 1997/10/19 16:58:00 christos Exp $"); __RCSID("$NetBSD: hack.fight.c,v 1.5 2001/03/25 20:44:00 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -20,7 +20,7 @@ int
hitmm(magr, mdef) hitmm(magr, mdef)
struct monst *magr, *mdef; struct monst *magr, *mdef;
{ {
struct permonst *pa = magr->data, *pd = mdef->data; const struct permonst *pa = magr->data, *pd = mdef->data;
int hit; int hit;
schar tmp; schar tmp;
boolean vis; boolean vis;
@ -89,7 +89,7 @@ void
mondied(mdef) mondied(mdef)
struct monst *mdef; struct monst *mdef;
{ {
struct permonst *pd = mdef->data; const struct permonst *pd = mdef->data;
if (letter(pd->mlet) && rn2(3)) { if (letter(pd->mlet) && rn2(3)) {
(void) mkobj_at(pd->mlet, mdef->mx, mdef->my); (void) mkobj_at(pd->mlet, mdef->mx, mdef->my);
if (cansee(mdef->mx, mdef->my)) { if (cansee(mdef->mx, mdef->my)) {
@ -136,7 +136,7 @@ fightm(mtmp)
int int
thitu(tlev, dam, name) thitu(tlev, dam, name)
int tlev, dam; int tlev, dam;
char *name; const char *name;
{ {
char buf[BUFSZ]; char buf[BUFSZ];
setan(name, buf); setan(name, buf);
@ -291,7 +291,7 @@ attack(mtmp)
{ {
schar tmp; schar tmp;
boolean malive = TRUE; boolean malive = TRUE;
struct permonst *mdat; const struct permonst *mdat;
mdat = mtmp->data; mdat = mtmp->data;
u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.h,v 1.7 2001/02/05 00:37:43 christos Exp $ */ /* $NetBSD: hack.h,v 1.8 2001/03/25 20:44:00 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -105,7 +105,7 @@ struct you {
#define Stoned u.uprops[STONED].p_flgs #define Stoned u.uprops[STONED].p_flgs
#define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */
unsigned umconf:1; unsigned umconf:1;
char *usick_cause; const char *usick_cause;
struct prop uprops[LAST_RING+10]; struct prop uprops[LAST_RING+10];
unsigned uswallow:1; /* set if swallowed by a monster */ unsigned uswallow:1; /* set if swallowed by a monster */
@ -133,13 +133,14 @@ extern boolean in_mklev;
extern boolean level_exists[]; extern boolean level_exists[];
extern boolean restoring; extern boolean restoring;
extern char *CD; extern char *CD;
extern char *catmore; extern const char *catmore;
extern char *hname; extern char *hname;
extern char *hu_stat[]; /* in eat.c */ extern const char *const hu_stat[]; /* in eat.c */
extern char *nomovemsg; extern const char *nomovemsg;
extern char *occtxt; extern const char *occtxt;
extern char *save_cm,*killer; extern char *save_cm;
extern char *traps[]; extern const char *killer;
extern const char *const traps[];
extern char SAVEF[]; extern char SAVEF[];
extern char fut_geno[60]; /* idem */ extern char fut_geno[60]; /* idem */
extern char genocided[60]; /* defined in Decl.c */ extern char genocided[60]; /* defined in Decl.c */
@ -148,10 +149,10 @@ extern char mlarge[];
extern char morc; extern char morc;
extern char nul[]; extern char nul[];
extern char plname[PL_NSIZ], pl_character[PL_CSIZ]; extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
extern char quitchars[]; extern const char quitchars[];
extern char sdir[]; /* defined in hack.c */ extern char sdir[]; /* defined in hack.c */
extern char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */ extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
extern char vowels[]; extern const char vowels[];
extern coord bhitpos; /* place where thrown weapon falls to the ground */ extern coord bhitpos; /* place where thrown weapon falls to the ground */
extern int (*afternmv) __P((void)); extern int (*afternmv) __P((void));
extern int (*occupation) __P((void)); extern int (*occupation) __P((void));
@ -172,11 +173,11 @@ extern struct obj *uleft, *uright, *fcobj;
extern struct obj *uball; /* defined if PUNISHED */ extern struct obj *uball; /* defined if PUNISHED */
extern struct obj *uchain; /* defined iff PUNISHED */ extern struct obj *uchain; /* defined iff PUNISHED */
extern struct obj zeroobj; extern struct obj zeroobj;
extern struct permonst li_dog, dog, la_dog; extern const struct permonst li_dog, dog, la_dog;
extern struct permonst pm_eel; extern const struct permonst pm_eel;
extern struct permonst pm_ghost; extern const struct permonst pm_ghost;
extern struct permonst pm_mail_daemon; extern const struct permonst pm_mail_daemon;
extern struct permonst pm_wizard; extern const struct permonst pm_wizard;
#ifndef NOWORM #ifndef NOWORM
extern long wgrowtime[32]; extern long wgrowtime[32];
extern struct wseg *m_atseg; extern struct wseg *m_atseg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.invent.c,v 1.6 1997/10/23 07:05:55 fair Exp $ */ /* $NetBSD: hack.invent.c,v 1.7 2001/03/25 20:44:00 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.invent.c,v 1.6 1997/10/23 07:05:55 fair Exp $"); __RCSID("$NetBSD: hack.invent.c,v 1.7 2001/03/25 20:44:00 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -335,7 +335,7 @@ mkgoldobj(q)
*/ */
struct obj * struct obj *
getobj(let, word) getobj(let, word)
char *let, *word; const char *let, *word;
{ {
struct obj *otmp; struct obj *otmp;
char ilet, ilet1, ilet2; char ilet, ilet1, ilet2;
@ -508,7 +508,7 @@ ckunpaid(otmp)
/* return the number of times fn was called successfully */ /* return the number of times fn was called successfully */
int int
ggetobj(word, fn, max) ggetobj(word, fn, max)
char *word; const char *word;
int (*fn) __P((struct obj *)); int (*fn) __P((struct obj *));
int max; int max;
{ {
@ -799,7 +799,7 @@ dolook()
{ {
struct obj *otmp = NULL, *otmp0 = NULL; struct obj *otmp = NULL, *otmp0 = NULL;
struct gold *gold = NULL; struct gold *gold = NULL;
char *verb = Blind ? "feel" : "see"; const char *verb = Blind ? "feel" : "see";
int ct = 0; int ct = 0;
if (!u.uswallow) { if (!u.uswallow) {
@ -866,6 +866,7 @@ stackobj(obj)
int int
merged(otmp, obj, lose) merged(otmp, obj, lose)
struct obj *otmp, *obj; struct obj *otmp, *obj;
int lose;
{ {
if (obj->otyp == otmp->otyp && if (obj->otyp == otmp->otyp &&
obj->unpaid == otmp->unpaid && obj->unpaid == otmp->unpaid &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.lev.c,v 1.4 1997/10/19 16:58:09 christos Exp $ */ /* $NetBSD: hack.lev.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.lev.c,v 1.4 1997/10/19 16:58:09 christos Exp $"); __RCSID("$NetBSD: hack.lev.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -75,7 +75,7 @@ savelev(fd, lev)
void void
bwrite(fd, loc, num) bwrite(fd, loc, num)
int fd; int fd;
char *loc; const void *loc;
unsigned num; unsigned num;
{ {
/* lint wants the 3rd arg of write to be an int; lint -p an unsigned */ /* lint wants the 3rd arg of write to be an int; lint -p an unsigned */
@ -111,9 +111,9 @@ savemonchn(fd, mtmp)
struct monst *mtmp2; struct monst *mtmp2;
unsigned xl; unsigned xl;
int minusone = -1; int minusone = -1;
struct permonst *monbegin = &mons[0]; const struct permonst *monbegin = &mons[0];
bwrite(fd, (char *) &monbegin, sizeof(monbegin)); bwrite(fd, &monbegin, sizeof(monbegin));
while (mtmp) { while (mtmp) {
mtmp2 = mtmp->nmon; mtmp2 = mtmp->nmon;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.main.c,v 1.5 2000/03/02 18:19:06 kleink Exp $ */ /* $NetBSD: hack.main.c,v 1.6 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.main.c,v 1.5 2000/03/02 18:19:06 kleink Exp $"); __RCSID("$NetBSD: hack.main.c,v 1.6 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@ -24,19 +24,19 @@ __RCSID("$NetBSD: hack.main.c,v 1.5 2000/03/02 18:19:06 kleink Exp $");
int (*afternmv) __P((void)); int (*afternmv) __P((void));
int (*occupation) __P((void)); int (*occupation) __P((void));
char *occtxt; /* defined when occupation != NULL */ const char *occtxt; /* defined when occupation != NULL */
int hackpid; /* current pid */ int hackpid; /* current pid */
int locknum; /* max num of players */ int locknum; /* max num of players */
#ifdef DEF_PAGER #ifdef DEF_PAGER
char *catmore; /* default pager */ const char *catmore; /* default pager */
#endif #endif
char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */ char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */
char *hname; /* name of the game (argv[0] of call) */ char *hname; /* name of the game (argv[0] of call) */
char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */
int main __P((int, char *[])); int main __P((int, char *[]));
static void chdirx __P((char *, boolean)); static void chdirx __P((const char *, boolean));
int int
main(argc, argv) main(argc, argv)
@ -48,6 +48,12 @@ main(argc, argv)
char *dir; char *dir;
#endif #endif
/* Check for dirty tricks with closed fds 0, 1, 2 */
fd = open("/dev/null", O_RDONLY);
if (fd < 3)
exit(1);
close(fd);
hname = argv[0]; hname = argv[0];
hackpid = getpid(); hackpid = getpid();
@ -229,7 +235,7 @@ main(argc, argv)
} }
if ((sfoo = getenv("GENOCIDED")) != NULL) { if ((sfoo = getenv("GENOCIDED")) != NULL) {
if (*sfoo == '!') { if (*sfoo == '!') {
struct permonst *pm = mons; const struct permonst *pm = mons;
char *gp = genocided; char *gp = genocided;
while (pm < mons + CMNUM + 2) { while (pm < mons + CMNUM + 2) {
@ -247,7 +253,7 @@ main(argc, argv)
setftty(); setftty();
(void) sprintf(SAVEF, "save/%d%s", getuid(), plname); (void) sprintf(SAVEF, "save/%d%s", getuid(), plname);
regularize(SAVEF + 5); /* avoid . or / in name */ regularize(SAVEF + 5); /* avoid . or / in name */
if ((fd = open(SAVEF, 0)) >= 0 && if ((fd = open(SAVEF, O_RDONLY)) >= 0 &&
(uptodate(fd) || unlink(SAVEF) == 666)) { (uptodate(fd) || unlink(SAVEF) == 666)) {
(void) signal(SIGINT, done1); (void) signal(SIGINT, done1);
pline("Restoring old save file..."); pline("Restoring old save file...");
@ -484,7 +490,7 @@ impossible(va_alist)
#ifdef CHDIR #ifdef CHDIR
static void static void
chdirx(dir, wr) chdirx(dir, wr)
char *dir; const char *dir;
boolean wr; boolean wr;
{ {
@ -516,7 +522,7 @@ chdirx(dir, wr)
if (dir == NULL) if (dir == NULL)
dir = "."; dir = ".";
if ((fd = open(RECORD, 2)) < 0) { if ((fd = open(RECORD, O_RDWR)) < 0) {
printf("Warning: cannot write %s/%s", dir, RECORD); printf("Warning: cannot write %s/%s", dir, RECORD);
getret(); getret();
} else } else

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.makemon.c,v 1.4 1997/10/19 16:58:17 christos Exp $ */ /* $NetBSD: hack.makemon.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.makemon.c,v 1.4 1997/10/19 16:58:17 christos Exp $"); __RCSID("$NetBSD: hack.makemon.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -23,8 +23,7 @@ struct monst zeromonst;
* note that in this case we return only one of them (the one at [x,y]). * note that in this case we return only one of them (the one at [x,y]).
*/ */
struct monst * struct monst *
makemon(ptr, x, y) makemon(const struct permonst *ptr, int x, int y)
struct permonst *ptr;
{ {
struct monst *mtmp; struct monst *mtmp;
int tmp, ct; int tmp, ct;
@ -169,7 +168,7 @@ foofull:
} }
int int
goodpos(x, y) goodpos(int x, int y)
{ /* used only in mnexto and rloc */ { /* used only in mnexto and rloc */
return ( return (
!(x < 1 || x > COLNO - 2 || y < 1 || y > ROWNO - 2 || !(x < 1 || x > COLNO - 2 || y < 1 || y > ROWNO - 2 ||
@ -213,7 +212,7 @@ mkmon_at(let, x, y)
int x, y; int x, y;
{ {
int ct; int ct;
struct permonst *ptr; const struct permonst *ptr;
for (ct = 0; ct < CMNUM; ct++) { for (ct = 0; ct < CMNUM; ct++) {
ptr = &mons[ct]; ptr = &mons[ct];

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mhitu.c,v 1.4 1997/10/19 16:58:22 christos Exp $ */ /* $NetBSD: hack.mhitu.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mhitu.c,v 1.4 1997/10/19 16:58:22 christos Exp $"); __RCSID("$NetBSD: hack.mhitu.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -20,7 +20,7 @@ int
mhitu(mtmp) mhitu(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
struct permonst *mdat = mtmp->data; const struct permonst *mdat = mtmp->data;
int tmp, ctmp; int tmp, ctmp;
nomul(0); nomul(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mklev.c,v 1.4 1997/10/19 16:58:24 christos Exp $ */ /* $NetBSD: hack.mklev.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mklev.c,v 1.4 1997/10/19 16:58:24 christos Exp $"); __RCSID("$NetBSD: hack.mklev.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <unistd.h> #include <unistd.h>
@ -23,15 +23,12 @@ __RCSID("$NetBSD: hack.mklev.c,v 1.4 1997/10/19 16:58:24 christos Exp $");
#define YLIM 3 #define YLIM 3
boolean secret; /* TRUE while making a vault: increase boolean secret; /* TRUE while making a vault: increase
* [XY]LIM */ * [XY]LIM */
struct mkroom rooms[MAXNROFROOMS + 1];
int smeq[MAXNROFROOMS + 1]; int smeq[MAXNROFROOMS + 1];
coord doors[DOORMAX];
int doorindex; int doorindex;
struct rm zerorm; struct rm zerorm;
schar nxcor; schar nxcor;
boolean goldseen; boolean goldseen;
int nroom; int nroom;
xchar xdnstair, xupstair, ydnstair, yupstair;
/* Definitions used by makerooms() and addrs() */ /* Definitions used by makerooms() and addrs() */
#define MAXRS 50 /* max lth of temp rectangle table - #define MAXRS 50 /* max lth of temp rectangle table -
@ -309,7 +306,7 @@ comp(vx, vy)
} }
coord coord
finddpos(xl, yl, xh, yh) finddpos(int xl, int yl, int xh, int yh)
{ {
coord ff; coord ff;
int x, y; int x, y;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mkmaze.c,v 1.4 1997/10/19 16:58:27 christos Exp $ */ /* $NetBSD: hack.mkmaze.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,13 +6,13 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mkmaze.c,v 1.4 1997/10/19 16:58:27 christos Exp $"); __RCSID("$NetBSD: hack.mkmaze.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
#include "extern.h" #include "extern.h"
#include "def.mkroom.h" /* not really used */ #include "def.mkroom.h" /* not really used */
struct permonst hell_hound = const struct permonst hell_hound =
{"hell hound", 'd', 12, 14, 2, 3, 6, 0}; {"hell hound", 'd', 12, 14, 2, 3, 6, 0};
void void

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mkobj.c,v 1.4 1997/10/19 16:58:29 christos Exp $ */ /* $NetBSD: hack.mkobj.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mkobj.c,v 1.4 1997/10/19 16:58:29 christos Exp $"); __RCSID("$NetBSD: hack.mkobj.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -151,8 +151,7 @@ weight(obj)
} }
void void
mkgold(num, x, y) mkgold(long num, int x, int y)
long num;
{ {
struct gold *gold; struct gold *gold;
long amount = (num ? num : 1 + (rnd(dlevel + 2) * rnd(30))); long amount = (num ? num : 1 + (rnd(dlevel + 2) * rnd(30)));

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mkshop.c,v 1.5 1997/10/19 16:58:31 christos Exp $ */ /* $NetBSD: hack.mkshop.c,v 1.6 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mkshop.c,v 1.5 1997/10/19 16:58:31 christos Exp $"); __RCSID("$NetBSD: hack.mkshop.c,v 1.6 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -16,7 +16,7 @@ __RCSID("$NetBSD: hack.mkshop.c,v 1.5 1997/10/19 16:58:31 christos Exp $");
#include "def.mkroom.h" #include "def.mkroom.h"
#include "def.eshk.h" #include "def.eshk.h"
#define ESHK ((struct eshk *)(&(shk->mextra[0]))) #define ESHK ((struct eshk *)(&(shk->mextra[0])))
schar shprobs[] = {3, 3, 5, 5, 10, 10, 14, 50}; /* their probabilities */ const schar shprobs[] = {3, 3, 5, 5, 10, 10, 14, 50}; /* their probabilities */
void void
mkshop() mkshop()
@ -217,7 +217,7 @@ mkzoo(type)
} }
} }
struct permonst * const struct permonst *
morguemon() morguemon()
{ {
int i = rn2(100), hd = rn2(dlevel); int i = rn2(100), hd = rn2(dlevel);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.mon.c,v 1.4 1997/10/19 16:58:34 christos Exp $ */ /* $NetBSD: hack.mon.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.mon.c,v 1.4 1997/10/19 16:58:34 christos Exp $"); __RCSID("$NetBSD: hack.mon.c,v 1.5 2001/03/25 20:44:01 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -21,7 +21,7 @@ __RCSID("$NetBSD: hack.mon.c,v 1.4 1997/10/19 16:58:34 christos Exp $");
int warnlevel; /* used by movemon and dochugw */ int warnlevel; /* used by movemon and dochugw */
long lastwarntime; long lastwarntime;
int lastwarnlev; int lastwarnlev;
char *warnings[] = { const char *const warnings[] = {
"white", "pink", "red", "ruby", "purple", "black" "white", "pink", "red", "ruby", "purple", "black"
}; };
@ -93,7 +93,7 @@ next_mon:
warnlevel = SIZE(warnings) - 1; warnlevel = SIZE(warnings) - 1;
if (warnlevel >= 0) if (warnlevel >= 0)
if (warnlevel > lastwarnlev || moves > lastwarntime + 5) { if (warnlevel > lastwarnlev || moves > lastwarntime + 5) {
char *rr; const char *rr;
switch (Warning & (LEFT_RING | RIGHT_RING)) { switch (Warning & (LEFT_RING | RIGHT_RING)) {
case LEFT_RING: case LEFT_RING:
rr = "Your left ring glows"; rr = "Your left ring glows";
@ -118,7 +118,7 @@ next_mon:
void void
justswld(mtmp, name) justswld(mtmp, name)
struct monst *mtmp; struct monst *mtmp;
char *name; const char *name;
{ {
mtmp->mx = u.ux; mtmp->mx = u.ux;
@ -137,7 +137,7 @@ void
youswld(mtmp, dam, die, name) youswld(mtmp, dam, die, name)
struct monst *mtmp; struct monst *mtmp;
int dam, die; int dam, die;
char *name; const char *name;
{ {
if (mtmp != u.ustuck) if (mtmp != u.ustuck)
return; return;
@ -178,7 +178,7 @@ int
dochug(mtmp) dochug(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
struct permonst *mdat; const struct permonst *mdat;
int tmp = 0, nearby, scared; int tmp = 0, nearby, scared;
if (mtmp->cham && !rn2(6)) if (mtmp->cham && !rn2(6))
@ -260,8 +260,7 @@ dochug(mtmp)
} }
int int
m_move(mtmp, after) m_move(struct monst *mtmp, int after)
struct monst *mtmp;
{ {
struct monst *mtmp2; struct monst *mtmp2;
int nx, ny, omx, omy, appr, nearer, cnt, i, j; int nx, ny, omx, omy, appr, nearer, cnt, i, j;
@ -623,7 +622,7 @@ dist(x, y)
void void
poisoned(string, pname) poisoned(string, pname)
char *string, *pname; const char *string, *pname;
{ {
int i; int i;
@ -749,7 +748,7 @@ killed(mtmp)
#define NEW_SCORING #define NEW_SCORING
#endif /* lint */ #endif /* lint */
int tmp, nk, x, y; int tmp, nk, x, y;
struct permonst *mdat; const struct permonst *mdat;
if (mtmp->cham) if (mtmp->cham)
mtmp->data = PM_CHAMELEON; mtmp->data = PM_CHAMELEON;
@ -869,8 +868,7 @@ killed(mtmp)
} }
void void
kludge(str, arg) kludge(const char *str, const char *arg)
char *str, *arg;
{ {
if (Blind) { if (Blind) {
if (*str == '%') if (*str == '%')
@ -897,7 +895,7 @@ int
newcham(mtmp, mdat) /* make a chameleon look like a new monster */ newcham(mtmp, mdat) /* make a chameleon look like a new monster */
/* returns 1 if the monster actually changed */ /* returns 1 if the monster actually changed */
struct monst *mtmp; struct monst *mtmp;
struct permonst *mdat; const struct permonst *mdat;
{ {
int mhp, hpn, hpd; int mhp, hpn, hpd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.monst.c,v 1.4 1997/10/19 16:58:36 christos Exp $ */ /* $NetBSD: hack.monst.c,v 1.5 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,14 +6,14 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.monst.c,v 1.4 1997/10/19 16:58:36 christos Exp $"); __RCSID("$NetBSD: hack.monst.c,v 1.5 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
#include "extern.h" #include "extern.h"
#include "def.eshk.h" #include "def.eshk.h"
struct permonst mons[CMNUM + 2] = { const struct permonst mons[CMNUM + 2] = {
{"bat", 'B', 1, 22, 8, 1, 4, 0}, {"bat", 'B', 1, 22, 8, 1, 4, 0},
{"gnome", 'G', 1, 6, 5, 1, 6, 0}, {"gnome", 'G', 1, 6, 5, 1, 6, 0},
{"hobgoblin", 'H', 1, 9, 5, 1, 8, 0}, {"hobgoblin", 'H', 1, 9, 5, 1, 8, 0},
@ -77,11 +77,11 @@ struct permonst mons[CMNUM + 2] = {
{"shopkeeper", '@', 12, 18, 0, 4, 8, sizeof(struct eshk)} {"shopkeeper", '@', 12, 18, 0, 4, 8, sizeof(struct eshk)}
}; };
struct permonst pm_ghost = {"ghost", ' ', 10, 3, -5, 1, 1, sizeof(plname)}; const struct permonst pm_ghost = {"ghost", ' ', 10, 3, -5, 1, 1, sizeof(plname)};
struct permonst pm_wizard = { const struct permonst pm_wizard = {
"wizard of Yendor", '1', 15, 12, -2, 1, 12, 0 "wizard of Yendor", '1', 15, 12, -2, 1, 12, 0
}; };
#ifdef MAIL #ifdef MAIL
struct permonst pm_mail_daemon = {"mail daemon", '2', 100, 1, 10, 0, 0, 0}; const struct permonst pm_mail_daemon = {"mail daemon", '2', 100, 1, 10, 0, 0, 0};
#endif /* MAIL */ #endif /* MAIL */
struct permonst pm_eel = {"giant eel", ';', 15, 6, -3, 3, 6, 0}; const struct permonst pm_eel = {"giant eel", ';', 15, 6, -3, 3, 6, 0};

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.o_init.c,v 1.5 1997/10/19 16:58:37 christos Exp $ */ /* $NetBSD: hack.o_init.c,v 1.6 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.o_init.c,v 1.5 1997/10/19 16:58:37 christos Exp $"); __RCSID("$NetBSD: hack.o_init.c,v 1.6 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <string.h> #include <string.h>
@ -31,7 +31,8 @@ void
init_objects() init_objects()
{ {
int i, j, first, last, sum, end; int i, j, first, last, sum, end;
char let, *tmp; char let;
const char *tmp;
/* /*
* init base; if probs given check that they add up to 100, otherwise * init base; if probs given check that they add up to 100, otherwise
* compute probs; shuffle descriptions * compute probs; shuffle descriptions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.objnam.c,v 1.4 1997/10/19 16:58:39 christos Exp $ */ /* $NetBSD: hack.objnam.c,v 1.5 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.objnam.c,v 1.4 1997/10/19 16:58:39 christos Exp $"); __RCSID("$NetBSD: hack.objnam.c,v 1.5 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -46,8 +46,8 @@ typename(otyp)
{ {
static char buf[BUFSZ]; static char buf[BUFSZ];
struct objclass *ocl = &objects[otyp]; struct objclass *ocl = &objects[otyp];
char *an = ocl->oc_name; const char *an = ocl->oc_name;
char *dn = ocl->oc_descr; const char *dn = ocl->oc_descr;
char *un = ocl->oc_uname; char *un = ocl->oc_uname;
int nn = ocl->oc_name_known; int nn = ocl->oc_name_known;
switch (ocl->oc_olet) { switch (ocl->oc_olet) {
@ -98,8 +98,8 @@ xname(obj)
static char bufr[BUFSZ]; static char bufr[BUFSZ];
char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */ char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */
int nn = objects[obj->otyp].oc_name_known; int nn = objects[obj->otyp].oc_name_known;
char *an = objects[obj->otyp].oc_name; const char *an = objects[obj->otyp].oc_name;
char *dn = objects[obj->otyp].oc_descr; const char *dn = objects[obj->otyp].oc_descr;
char *un = objects[obj->otyp].oc_uname; char *un = objects[obj->otyp].oc_uname;
int pl = (obj->quan != 1); int pl = (obj->quan != 1);
if (!obj->dknown && !Blind) if (!obj->dknown && !Blind)
@ -308,8 +308,7 @@ doname(obj)
/* used only in hack.fight.c (thitu) */ /* used only in hack.fight.c (thitu) */
void void
setan(str, buf) setan(const char *str, char *buf)
char *str, *buf;
{ {
if (strchr(vowels, *str)) if (strchr(vowels, *str))
Sprintf(buf, "an %s", str); Sprintf(buf, "an %s", str);
@ -320,7 +319,7 @@ setan(str, buf)
char * char *
aobjnam(otmp, verb) aobjnam(otmp, verb)
struct obj *otmp; struct obj *otmp;
char *verb; const char *verb;
{ {
char *bp = xname(otmp); char *bp = xname(otmp);
char prefix[PREFIX]; char prefix[PREFIX];
@ -354,8 +353,8 @@ Doname(obj)
return (s); return (s);
} }
char *wrp[] = {"wand", "ring", "potion", "scroll", "gem"}; const char *const wrp[] = {"wand", "ring", "potion", "scroll", "gem"};
char wrpsym[] = {WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM}; const char wrpsym[] = {WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM};
struct obj * struct obj *
readobjnam(bp) readobjnam(bp)
@ -533,7 +532,7 @@ srch:
if (let) if (let)
i = bases[letindex(let)]; i = bases[letindex(let)];
while (i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)) { while (i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)) {
char *zn = objects[i].oc_name; const char *zn = objects[i].oc_name;
if (!zn) if (!zn)
goto nxti; goto nxti;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.pager.c,v 1.5 1997/10/19 16:58:46 christos Exp $ */ /* $NetBSD: hack.pager.c,v 1.6 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.pager.c,v 1.5 1997/10/19 16:58:46 christos Exp $"); __RCSID("$NetBSD: hack.pager.c,v 1.6 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
/* This file contains the command routine dowhatis() and a pager. */ /* This file contains the command routine dowhatis() and a pager. */
@ -69,7 +69,7 @@ static int got_intrup;
void void
intruph(n) intruph(n)
int n; int n __attribute__((__unused__));
{ {
got_intrup++; got_intrup++;
} }
@ -160,7 +160,7 @@ set_pager(mode)
int int
page_line(s) /* returns 1 if we should quit */ page_line(s) /* returns 1 if we should quit */
char *s; const char *s;
{ {
if (cury == LI - 1) { if (cury == LI - 1) {
if (!*s) if (!*s)
@ -198,7 +198,7 @@ page_line(s) /* returns 1 if we should quit */
void void
cornline(mode, text) cornline(mode, text)
int mode; int mode;
char *text; const char *text;
{ {
static struct line { static struct line {
struct line *next_line; struct line *next_line;
@ -307,14 +307,14 @@ dohelp()
int int
page_file(fnam, silent) /* return: 0 - cannot open fnam; 1 - page_file(fnam, silent) /* return: 0 - cannot open fnam; 1 -
* otherwise */ * otherwise */
char *fnam; const char *fnam;
boolean silent; boolean silent;
{ {
#ifdef DEF_PAGER /* this implies that UNIX is defined */ #ifdef DEF_PAGER /* this implies that UNIX is defined */
{ {
/* use external pager; this may give security problems */ /* use external pager; this may give security problems */
int fd = open(fnam, 0); int fd = open(fnam, O_RDONLY);
if (fd < 0) { if (fd < 0) {
if (!silent) if (!silent)
@ -399,7 +399,7 @@ union wait { /* used only for the cast (union wait *) 0 */
#endif /* NOWAITINCLUDE */ #endif /* NOWAITINCLUDE */
int int
child(wt) child(int wt)
{ {
int status; int status;
int f; int f;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.potion.c,v 1.4 1997/10/19 16:58:48 christos Exp $ */ /* $NetBSD: hack.potion.c,v 1.5 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.potion.c,v 1.4 1997/10/19 16:58:48 christos Exp $"); __RCSID("$NetBSD: hack.potion.c,v 1.5 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -224,7 +224,7 @@ pluslvl()
void void
strange_feeling(obj, txt) strange_feeling(obj, txt)
struct obj *obj; struct obj *obj;
char *txt; const char *txt;
{ {
if (flags.beginner) if (flags.beginner)
pline("You have a strange feeling for a moment, then it passes."); pline("You have a strange feeling for a moment, then it passes.");
@ -235,7 +235,7 @@ strange_feeling(obj, txt)
useup(obj); useup(obj);
} }
char *bottlenames[] = { const char *const bottlenames[] = {
"bottle", "phial", "flagon", "carafe", "flask", "jar", "vial" "bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
}; };
@ -244,7 +244,7 @@ potionhit(mon, obj)
struct monst *mon; struct monst *mon;
struct obj *obj; struct obj *obj;
{ {
char *botlnam = bottlenames[rn2(SIZE(bottlenames))]; const char *botlnam = bottlenames[rn2(SIZE(bottlenames))];
boolean uclose, isyou = (mon == &youmonst); boolean uclose, isyou = (mon == &youmonst);
if (isyou) { if (isyou) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.pri.c,v 1.5 1997/10/19 16:58:50 christos Exp $ */ /* $NetBSD: hack.pri.c,v 1.6 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.pri.c,v 1.5 1997/10/19 16:58:50 christos Exp $"); __RCSID("$NetBSD: hack.pri.c,v 1.6 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -344,7 +344,7 @@ pru()
/* print a position that is visible for @ */ /* print a position that is visible for @ */
void void
prl(x, y) prl(int x, int y)
{ {
struct rm *room; struct rm *room;
struct monst *mtmp; struct monst *mtmp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.read.c,v 1.6 2001/02/05 00:37:43 christos Exp $ */ /* $NetBSD: hack.read.c,v 1.7 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.read.c,v 1.6 2001/02/05 00:37:43 christos Exp $"); __RCSID("$NetBSD: hack.read.c,v 1.7 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -573,7 +573,7 @@ int
monstersym(ch) /* arnold@ucsfcgl */ monstersym(ch) /* arnold@ucsfcgl */
char ch; char ch;
{ {
struct permonst *mp; const struct permonst *mp;
/* /*
* can't genocide certain monsters * can't genocide certain monsters

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.rip.c,v 1.5 1997/10/19 16:58:53 christos Exp $ */ /* $NetBSD: hack.rip.c,v 1.6 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,13 +6,13 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.rip.c,v 1.5 1997/10/19 16:58:53 christos Exp $"); __RCSID("$NetBSD: hack.rip.c,v 1.6 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
#include "extern.h" #include "extern.h"
static char *riptop = "\ static const char *riptop = "\
----------\n\ ----------\n\
/ \\\n\ / \\\n\
/ REST \\\n\ / REST \\\n\
@ -20,9 +20,9 @@ static char *riptop = "\
/ PEACE \\\n\ / PEACE \\\n\
/ \\"; / \\";
static char *ripmid = " | %*s%*s |\n"; static const char *ripmid = " | %*s%*s |\n";
static char *ripbot = "\ static const char *ripbot = "\
*| * * * | *\n\ *| * * * | *\n\
_________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______"; _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______";
@ -69,7 +69,7 @@ outrip()
void void
center(line, text) center(line, text)
int line; int line __attribute__((__unused__));
char *text; char *text;
{ {
int n = strlen(text) / 2; int n = strlen(text) / 2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.save.c,v 1.6 1997/10/19 16:58:57 christos Exp $ */ /* $NetBSD: hack.save.c,v 1.7 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.save.c,v 1.6 1997/10/19 16:58:57 christos Exp $"); __RCSID("$NetBSD: hack.save.c,v 1.7 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@ -30,7 +30,7 @@ dosave()
#ifndef NOSAVEONHANGUP #ifndef NOSAVEONHANGUP
void void
hangup(n) hangup(n)
int n; int n __attribute__((__unused__));
{ {
(void) dosave0(1); (void) dosave0(1);
exit(1); exit(1);
@ -77,7 +77,7 @@ dosave0(hu)
if (tmp == dlevel || !level_exists[tmp]) if (tmp == dlevel || !level_exists[tmp])
continue; continue;
glo(tmp); glo(tmp);
if ((ofd = open(lock, 0)) < 0) { if ((ofd = open(lock, O_RDONLY)) < 0) {
if (!hu) if (!hu)
pline("Error while saving: cannot read %s.", lock); pline("Error while saving: cannot read %s.", lock);
(void) close(fd); (void) close(fd);
@ -146,7 +146,7 @@ dorecover(fd)
savelev(nfd, tmp); savelev(nfd, tmp);
(void) close(nfd); (void) close(nfd);
} }
(void) lseek(fd, (off_t) 0, 0); (void) lseek(fd, (off_t) 0, SEEK_SET);
getlev(fd, 0, 0); getlev(fd, 0, 0);
(void) close(fd); (void) close(fd);
(void) unlink(SAVEF); (void) unlink(SAVEF);
@ -225,7 +225,7 @@ restmonchn(fd)
long differ; long differ;
mread(fd, (char *) &monbegin, sizeof(monbegin)); mread(fd, (char *) &monbegin, sizeof(monbegin));
differ = (char *) (&mons[0]) - (char *) (monbegin); differ = (const char *) (&mons[0]) - (const char *) (monbegin);
#ifdef lint #ifdef lint
/* suppress "used before set" warning from lint */ /* suppress "used before set" warning from lint */
@ -243,8 +243,8 @@ restmonchn(fd)
mread(fd, (char *) mtmp, (unsigned) xl + sizeof(struct monst)); mread(fd, (char *) mtmp, (unsigned) xl + sizeof(struct monst));
if (!mtmp->m_id) if (!mtmp->m_id)
mtmp->m_id = flags.ident++; mtmp->m_id = flags.ident++;
mtmp->data = (struct permonst *) mtmp->data = (const struct permonst *)
((char *) mtmp->data + differ); ((const char *) mtmp->data + differ);
if (mtmp->minvent) if (mtmp->minvent)
mtmp->minvent = restobjchn(fd); mtmp->minvent = restobjchn(fd);
mtmp2 = mtmp; mtmp2 = mtmp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.shk.c,v 1.4 1997/10/19 16:59:01 christos Exp $ */ /* $NetBSD: hack.shk.c,v 1.5 2001/03/25 20:44:02 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.shk.c,v 1.4 1997/10/19 16:59:01 christos Exp $"); __RCSID("$NetBSD: hack.shk.c,v 1.5 2001/03/25 20:44:02 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -127,12 +127,12 @@ static long int followmsg; /* last time of follow message */
*/ */
char shtypes[] = { /* 8 shoptypes: 7 specialized, 1 mixed */ const char shtypes[] = { /* 8 shoptypes: 7 specialized, 1 mixed */
RING_SYM, WAND_SYM, WEAPON_SYM, FOOD_SYM, SCROLL_SYM, RING_SYM, WAND_SYM, WEAPON_SYM, FOOD_SYM, SCROLL_SYM,
POTION_SYM, ARMOR_SYM, 0 POTION_SYM, ARMOR_SYM, 0
}; };
static char *shopnam[] = { static const char *const shopnam[] = {
"engagement ring", "walking cane", "antique weapon", "engagement ring", "walking cane", "antique weapon",
"delicatessen", "second hand book", "liquor", "delicatessen", "second hand book", "liquor",
"used armor", "assorted antiques" "used armor", "assorted antiques"
@ -902,7 +902,7 @@ shk_move(shkp)
struct monst *shkp; struct monst *shkp;
{ {
struct monst *mtmp; struct monst *mtmp;
struct permonst *mdat = shkp->data; const struct permonst *mdat = shkp->data;
xchar gx, gy, omx, omy, nx, ny, nix, niy; xchar gx, gy, omx, omy, nx, ny, nix, niy;
schar appr, i; schar appr, i;
int udist; int udist;
@ -1092,7 +1092,7 @@ shopdig(fall)
#endif /* QUEST */ #endif /* QUEST */
int int
online(x, y) online(int x, int y)
{ {
return (x == u.ux || y == u.uy || return (x == u.ux || y == u.uy ||
(x - u.ux) * (x - u.ux) == (y - u.uy) * (y - u.uy)); (x - u.ux) * (x - u.ux) == (y - u.uy) * (y - u.uy));

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.shknam.c,v 1.4 1997/10/19 16:59:03 christos Exp $ */ /* $NetBSD: hack.shknam.c,v 1.5 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,13 +6,13 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.shknam.c,v 1.4 1997/10/19 16:59:03 christos Exp $"); __RCSID("$NetBSD: hack.shknam.c,v 1.5 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
#include "extern.h" #include "extern.h"
char *shkliquors[] = { const char *const shkliquors[] = {
/* Ukraine */ /* Ukraine */
"Njezjin", "Tsjernigof", "Gomel", "Ossipewsk", "Gorlowka", "Njezjin", "Tsjernigof", "Gomel", "Ossipewsk", "Gorlowka",
/* N. Russia */ /* N. Russia */
@ -27,7 +27,7 @@ char *shkliquors[] = {
0 0
}; };
char *shkbooks[] = { const char *const shkbooks[] = {
/* Eire */ /* Eire */
"Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch", "Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch",
"Loughrea", "Croagh", "Maumakeogh", "Ballyjamesduff", "Loughrea", "Croagh", "Maumakeogh", "Ballyjamesduff",
@ -39,7 +39,7 @@ char *shkbooks[] = {
0 0
}; };
char *shkarmors[] = { const char *const shkarmors[] = {
/* Turquie */ /* Turquie */
"Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep", "Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep",
"Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak", "Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak",
@ -50,7 +50,7 @@ char *shkarmors[] = {
0 0
}; };
char *shkwands[] = { const char *const shkwands[] = {
/* Wales */ /* Wales */
"Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach", "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach",
"Rhaeader", "Llandrindod", "Llanfair-ym-muallt", "Rhaeader", "Llandrindod", "Llanfair-ym-muallt",
@ -64,7 +64,7 @@ char *shkwands[] = {
0 0
}; };
char *shkrings[] = { const char *const shkrings[] = {
/* Hollandse familienamen */ /* Hollandse familienamen */
"Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken", "Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken",
"Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy", "Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy",
@ -77,7 +77,7 @@ char *shkrings[] = {
0 0
}; };
char *shkfoods[] = { const char *const shkfoods[] = {
/* Indonesia */ /* Indonesia */
"Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan", "Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan",
"Bandjar", "Parbalingga", "Bojolali", "Sarangan", "Bandjar", "Parbalingga", "Bojolali", "Sarangan",
@ -89,7 +89,7 @@ char *shkfoods[] = {
0 0
}; };
char *shkweapons[] = { const char *const shkweapons[] = {
/* Perigord */ /* Perigord */
"Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard", "Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard",
"Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac", "Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac",
@ -100,7 +100,7 @@ char *shkweapons[] = {
0 0
}; };
char *shkgeneral[] = { const char *const shkgeneral[] = {
/* Suriname */ /* Suriname */
"Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi", "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi",
"Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo", "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo",
@ -118,9 +118,9 @@ char *shkgeneral[] = {
0 0
}; };
struct shk_nx { const struct shk_nx {
char x; char x;
char **xn; const char *const *xn;
} shk_nx[] = { } shk_nx[] = {
{ {
POTION_SYM, shkliquors POTION_SYM, shkliquors
@ -153,8 +153,8 @@ findname(nampt, let)
char *nampt; char *nampt;
char let; char let;
{ {
struct shk_nx *p = shk_nx; const struct shk_nx *p = shk_nx;
char **q; const char *const *q;
int i; int i;
while (p->x && p->x != let) while (p->x && p->x != let)
p++; p++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.timeout.c,v 1.4 1997/10/19 16:59:08 christos Exp $ */ /* $NetBSD: hack.timeout.c,v 1.5 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.timeout.c,v 1.4 1997/10/19 16:59:08 christos Exp $"); __RCSID("$NetBSD: hack.timeout.c,v 1.5 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -55,7 +55,7 @@ timeout()
} }
/* He is being petrified - dialogue by inmet!tower */ /* He is being petrified - dialogue by inmet!tower */
char *stoned_texts[] = { const char *const stoned_texts[] = {
"You are slowing down.",/* 5 */ "You are slowing down.",/* 5 */
"Your limbs are stiffening.", /* 4 */ "Your limbs are stiffening.", /* 4 */
"Your limbs have turned to stone.", /* 3 */ "Your limbs have turned to stone.", /* 3 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.topl.c,v 1.4 1997/10/19 16:59:10 christos Exp $ */ /* $NetBSD: hack.topl.c,v 1.5 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.topl.c,v 1.4 1997/10/19 16:59:10 christos Exp $"); __RCSID("$NetBSD: hack.topl.c,v 1.5 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -81,7 +81,7 @@ remember_topl()
void void
addtopl(s) addtopl(s)
char *s; const char *s;
{ {
curs(tlx, tly); curs(tlx, tly);
if (tlx + strlen(s) > CO) if (tlx + strlen(s) > CO)
@ -94,7 +94,7 @@ addtopl(s)
void void
xmore(s) xmore(s)
char *s; /* allowed chars besides space/return */ const char *s; /* allowed chars besides space/return */
{ {
if (flags.toplin) { if (flags.toplin) {
curs(tlx, tly); curs(tlx, tly);
@ -124,7 +124,7 @@ more()
void void
cmore(s) cmore(s)
char *s; const char *s;
{ {
xmore(s); xmore(s);
} }
@ -252,7 +252,7 @@ putsym(c)
void void
putstr(s) putstr(s)
char *s; const char *s;
{ {
while (*s) while (*s)
putsym(*s++); putsym(*s++);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.trap.c,v 1.5 1998/08/30 09:19:37 veego Exp $ */ /* $NetBSD: hack.trap.c,v 1.6 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.trap.c,v 1.5 1998/08/30 09:19:37 veego Exp $"); __RCSID("$NetBSD: hack.trap.c,v 1.6 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -14,9 +14,9 @@ __RCSID("$NetBSD: hack.trap.c,v 1.5 1998/08/30 09:19:37 veego Exp $");
#include "extern.h" #include "extern.h"
#include "def.mkroom.h" #include "def.mkroom.h"
char vowels[] = "aeiou"; const char vowels[] = "aeiou";
char *traps[] = { const char *const traps[] = {
" bear trap", " bear trap",
"n arrow trap", "n arrow trap",
" dart trap", " dart trap",
@ -243,7 +243,7 @@ mintrap(mtmp)
void void
selftouch(arg) selftouch(arg)
char *arg; const char *arg;
{ {
if (uwep && uwep->otyp == DEAD_COCKATRICE) { if (uwep && uwep->otyp == DEAD_COCKATRICE) {
pline("%s touch the dead cockatrice.", arg); pline("%s touch the dead cockatrice.", arg);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.tty.c,v 1.8 2001/02/05 00:37:43 christos Exp $ */ /* $NetBSD: hack.tty.c,v 1.9 2001/03/25 20:44:03 jsm Exp $ */
/*- /*-
* Copyright (c) 1988, 1993 * Copyright (c) 1988, 1993
@ -38,7 +38,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: hack.tty.c,v 1.8 2001/02/05 00:37:43 christos Exp $"); __RCSID("$NetBSD: hack.tty.c,v 1.9 2001/03/25 20:44:03 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -93,7 +93,7 @@ gettty()
/* reset terminal to original state */ /* reset terminal to original state */
void void
settty(s) settty(s)
char *s; const char *s;
{ {
clear_screen(); clear_screen();
end_screen(); end_screen();
@ -230,7 +230,7 @@ getret()
void void
cgetret(s) cgetret(s)
char *s; const char *s;
{ {
putsym('\n'); putsym('\n');
if (flags.standout) if (flags.standout)
@ -247,7 +247,7 @@ char morc; /* tell the outside world what char he used */
void void
xwaitforspace(s) xwaitforspace(s)
char *s; /* chars allowed besides space or return */ const char *s; /* chars allowed besides space or return */
{ {
int c; int c;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.u_init.c,v 1.5 1997/10/19 16:59:19 christos Exp $ */ /* $NetBSD: hack.u_init.c,v 1.6 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.u_init.c,v 1.5 1997/10/19 16:59:19 christos Exp $"); __RCSID("$NetBSD: hack.u_init.c,v 1.6 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <ctype.h> #include <ctype.h>
@ -22,7 +22,7 @@ __RCSID("$NetBSD: hack.u_init.c,v 1.5 1997/10/19 16:59:19 christos Exp $");
struct you zerou; struct you zerou;
char pl_character[PL_CSIZ]; char pl_character[PL_CSIZ];
char *(roles[]) = { /* must all have distinct first letter */ const char *(roles[]) = { /* must all have distinct first letter */
/* roles[4] may be changed to -woman */ /* roles[4] may be changed to -woman */
"Tourist", "Speleologist", "Fighter", "Knight", "Tourist", "Speleologist", "Fighter", "Knight",
"Cave-man", "Wizard" "Cave-man", "Wizard"

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.unix.c,v 1.7 2001/02/05 00:37:43 christos Exp $ */ /* $NetBSD: hack.unix.c,v 1.8 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.unix.c,v 1.7 2001/02/05 00:37:43 christos Exp $"); __RCSID("$NetBSD: hack.unix.c,v 1.8 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
/* This file collects some Unix dependencies; hack.pager.c contains some more */ /* This file collects some Unix dependencies; hack.pager.c contains some more */
@ -127,7 +127,7 @@ gethdate(name)
*/ */
#define MAXPATHLEN 1024 #define MAXPATHLEN 1024
char *np, *path; const char *np, *path;
char filename[MAXPATHLEN + 1]; char filename[MAXPATHLEN + 1];
if (strchr(name, '/') != NULL || (path = getenv("PATH")) == NULL) if (strchr(name, '/') != NULL || (path = getenv("PATH")) == NULL)
path = ""; path = "";
@ -154,7 +154,7 @@ gethdate(name)
} }
int int
uptodate(fd) uptodate(int fd)
{ {
if (fstat(fd, &buf)) { if (fstat(fd, &buf)) {
pline("Cannot get status of saved level? "); pline("Cannot get status of saved level? ");
@ -247,7 +247,7 @@ getlock()
if (locknum) if (locknum)
lock[0] = 'a' + i++; lock[0] = 'a' + i++;
if ((fd = open(lock, 0)) == -1) { if ((fd = open(lock, O_RDONLY)) == -1) {
if (errno == ENOENT) if (errno == ENOENT)
goto gotlock; /* no such file */ goto gotlock; /* no such file */
perror(lock); perror(lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.vault.c,v 1.4 1997/10/19 16:59:23 christos Exp $ */ /* $NetBSD: hack.vault.c,v 1.5 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.vault.c,v 1.4 1997/10/19 16:59:23 christos Exp $"); __RCSID("$NetBSD: hack.vault.c,v 1.5 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -50,7 +50,7 @@ struct egd {
struct fakecorridor fakecorr[FCSIZ]; struct fakecorridor fakecorr[FCSIZ];
}; };
static struct permonst pm_guard = static const struct permonst pm_guard =
{"guard", '@', 12, 12, -1, 4, 10, sizeof(struct egd)}; {"guard", '@', 12, 12, -1, 4, 10, sizeof(struct egd)};
static struct monst *guard; static struct monst *guard;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.wield.c,v 1.4 1997/10/19 16:59:27 christos Exp $ */ /* $NetBSD: hack.wield.c,v 1.5 2001/03/25 20:44:03 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.wield.c,v 1.4 1997/10/19 16:59:27 christos Exp $"); __RCSID("$NetBSD: hack.wield.c,v 1.5 2001/03/25 20:44:03 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@ -76,8 +76,8 @@ chwepon(otmp, amount)
struct obj *otmp; struct obj *otmp;
int amount; int amount;
{ {
char *color = (amount < 0) ? "black" : "green"; const char *color = (amount < 0) ? "black" : "green";
char *time; const char *time;
if (!uwep || uwep->olet != WEAPON_SYM) { if (!uwep || uwep->olet != WEAPON_SYM) {
strange_feeling(otmp, strange_feeling(otmp,
(amount > 0) ? "Your hands twitch." (amount > 0) ? "Your hands twitch."

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.wizard.c,v 1.4 1997/10/19 16:59:28 christos Exp $ */ /* $NetBSD: hack.wizard.c,v 1.5 2001/03/25 20:44:04 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,7 +6,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.wizard.c,v 1.4 1997/10/19 16:59:28 christos Exp $"); __RCSID("$NetBSD: hack.wizard.c,v 1.5 2001/03/25 20:44:04 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
/* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */ /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */
@ -19,7 +19,7 @@ __RCSID("$NetBSD: hack.wizard.c,v 1.4 1997/10/19 16:59:28 christos Exp $");
#define BOLT_LIM 8 /* from this distance D and 1 will try to hit #define BOLT_LIM 8 /* from this distance D and 1 will try to hit
* you */ * you */
char wizapp[] = "@DNPTUVXcemntx"; const char wizapp[] = "@DNPTUVXcemntx";
/* If he has found the Amulet, make the wizard appear after some time */ /* If he has found the Amulet, make the wizard appear after some time */
void void

View File

@ -1,4 +1,4 @@
/* $NetBSD: hack.zap.c,v 1.4 1997/10/19 16:59:34 christos Exp $ */ /* $NetBSD: hack.zap.c,v 1.5 2001/03/25 20:44:04 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
@ -6,13 +6,13 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.zap.c,v 1.4 1997/10/19 16:59:34 christos Exp $"); __RCSID("$NetBSD: hack.zap.c,v 1.5 2001/03/25 20:44:04 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
#include "extern.h" #include "extern.h"
char *fl[] = { const char *const fl[] = {
"magic missile", "magic missile",
"bolt of fire", "bolt of fire",
"sleep ray", "sleep ray",
@ -279,7 +279,7 @@ dozap()
return (1); return (1);
} }
char * const char *
exclam(force) exclam(force)
int force; int force;
{ {
@ -293,9 +293,9 @@ exclam(force)
void void
hit(str, mtmp, force) hit(str, mtmp, force)
char *str; const char *str;
struct monst *mtmp; struct monst *mtmp;
char *force; /* usually either "." or "!" */ const char *force; /* usually either "." or "!" */
{ {
if (!cansee(mtmp->mx, mtmp->my)) if (!cansee(mtmp->mx, mtmp->my))
pline("The %s hits it.", str); pline("The %s hits it.", str);
@ -305,7 +305,7 @@ hit(str, mtmp, force)
void void
miss(str, mtmp) miss(str, mtmp)
char *str; const char *str;
struct monst *mtmp; struct monst *mtmp;
{ {
if (!cansee(mtmp->mx, mtmp->my)) if (!cansee(mtmp->mx, mtmp->my))
@ -374,7 +374,7 @@ bhit(ddx, ddy, range, sym, fhitm, fhito, obj)
} }
struct monst * struct monst *
boomhit(dx, dy) boomhit(int dx, int dy)
{ {
int i, ct; int i, ct;
struct monst *mtmp; struct monst *mtmp;
@ -441,7 +441,7 @@ buzz(type, sx, sy, dx, dy)
int dx, dy; int dx, dy;
{ {
int abstype = abs(type); int abstype = abs(type);
char *fltxt = (type == -1) ? "blaze of fire" : fl[abstype]; const char *fltxt = (type == -1) ? "blaze of fire" : fl[abstype];
struct rm *lev; struct rm *lev;
xchar range; xchar range;
struct monst *mon; struct monst *mon;

View File

@ -1,15 +1,16 @@
/* $NetBSD: makedefs.c,v 1.6 2000/07/31 11:35:03 simonb Exp $ */ /* $NetBSD: makedefs.c,v 1.7 2001/03/25 20:44:04 jsm Exp $ */
/* /*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*/ */
#ifndef lint #ifndef lint
static char rcsid[] = static const char rcsid[] =
"$NetBSD: makedefs.c,v 1.6 2000/07/31 11:35:03 simonb Exp $"; "$NetBSD: makedefs.c,v 1.7 2001/03/25 20:44:04 jsm Exp $";
#endif /* not lint */ #endif /* not lint */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -23,7 +24,7 @@ char string[STRSZ];
static void readline(void); static void readline(void);
static char nextchar(void); static char nextchar(void);
static int skipuntil(char *); static int skipuntil(const char *);
static int getentry(void); static int getentry(void);
static void capitalize(char *); static void capitalize(char *);
static int letter(int); static int letter(int);
@ -43,7 +44,7 @@ main(argc, argv)
(void) fprintf(stderr, "usage: makedefs file\n"); (void) fprintf(stderr, "usage: makedefs file\n");
exit(1); exit(1);
} }
if ((fd = open(argv[1], 0)) < 0) { if ((fd = open(argv[1], O_RDONLY)) < 0) {
perror(argv[1]); perror(argv[1]);
exit(1); exit(1);
} }
@ -74,6 +75,11 @@ main(argc, argv)
printf("#define LAST_GEM (JADE+1)\n"); printf("#define LAST_GEM (JADE+1)\n");
printf("#define LAST_RING %d\n", propct); printf("#define LAST_RING %d\n", propct);
printf("#define NROFOBJECTS %d\n", i - 1); printf("#define NROFOBJECTS %d\n", i - 1);
fflush(stdout);
if (ferror(stdout)) {
perror("standard output");
exit(1);
}
exit(0); exit(0);
} }
@ -105,9 +111,10 @@ nextchar()
static int static int
skipuntil(s) skipuntil(s)
char *s; const char *s;
{ {
char *sp0, *sp1; const char *sp0;
char *sp1;
loop: loop:
while (*s != nextchar()) while (*s != nextchar())
if (eof) { if (eof) {