switch source tree from k&r to c99
This commit is contained in:
+26
-37
@@ -27,46 +27,42 @@ void js_globals_init();
|
||||
#if !defined(_BULL_SOURCE) && !defined(__sgi) && !defined(_M_UNIX)
|
||||
#if !defined(SUNOS4) && !(defined(ULTRIX) && defined(__GNUC__))
|
||||
#if defined(POSIX_TYPES) || defined(SVR4) || defined(HPUX)
|
||||
extern struct passwd *FDECL(getpwuid, (uid_t));
|
||||
extern struct passwd *getpwuid(uid_t);
|
||||
#else
|
||||
extern struct passwd *FDECL(getpwuid, (int));
|
||||
extern struct passwd *getpwuid, (int);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
extern struct passwd *FDECL(getpwnam, (const char *));
|
||||
extern struct passwd *getpwnam(const char *);
|
||||
#ifdef CHDIR
|
||||
static void FDECL(chdirx, (const char *, BOOLEAN_P));
|
||||
static void chdirx(const char *, boolean);
|
||||
#endif /* CHDIR */
|
||||
static boolean NDECL(whoami);
|
||||
static void FDECL(process_options, (int, char **));
|
||||
static boolean whoami(void);
|
||||
static void process_options(int, char **);
|
||||
|
||||
#ifdef _M_UNIX
|
||||
extern void NDECL(check_sco_console);
|
||||
extern void NDECL(init_sco_cons);
|
||||
extern void check_sco_console(void);
|
||||
extern void init_sco_cons(void);
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
extern void NDECL(check_linux_console);
|
||||
extern void NDECL(init_linux_cons);
|
||||
extern void check_linux_console(void);
|
||||
extern void init_linux_cons(void);
|
||||
#endif
|
||||
|
||||
static void NDECL(wd_message);
|
||||
static void wd_message(void);
|
||||
static boolean wiz_error_flag = FALSE;
|
||||
static struct passwd *NDECL(get_unix_pw);
|
||||
static struct passwd *get_unix_pw(void);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
/* if WebAssembly, export this API and don't optimize it out */
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
|
||||
#else /* !__EMSCRIPTEN__ */
|
||||
|
||||
int
|
||||
nhmain(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
nhmain(int argc, char *argv[])
|
||||
|
||||
#endif /* __EMSCRIPTEN__ */
|
||||
{
|
||||
@@ -342,9 +338,7 @@ char *argv[];
|
||||
|
||||
/* caveat: argv elements might be arbitrary long */
|
||||
static void
|
||||
process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
process_options(int argc, char *argv[])
|
||||
{
|
||||
int i, l;
|
||||
|
||||
@@ -464,9 +458,7 @@ char *argv[];
|
||||
|
||||
#ifdef CHDIR
|
||||
static void
|
||||
chdirx(dir, wr)
|
||||
const char *dir;
|
||||
boolean wr;
|
||||
chdirx(const char *dir, boolean wr)
|
||||
{
|
||||
if (dir /* User specified directory? */
|
||||
#ifdef HACKDIR
|
||||
@@ -524,7 +516,7 @@ boolean wr;
|
||||
|
||||
/* returns True iff we set plname[] to username which contains a hyphen */
|
||||
static boolean
|
||||
whoami()
|
||||
whoami(void)
|
||||
{
|
||||
/*
|
||||
* Who am i? Algorithm: 1. Use name as specified in NETHACKOPTIONS
|
||||
@@ -557,8 +549,7 @@ whoami()
|
||||
|
||||
#ifndef NO_SIGNAL
|
||||
void
|
||||
sethanguphandler(handler)
|
||||
void FDECL((*handler), (int));
|
||||
sethanguphandler(void (*handler)(int))
|
||||
{
|
||||
#ifdef SA_RESTART
|
||||
/* don't want reads to restart. If SA_RESTART is defined, we know
|
||||
@@ -586,7 +577,7 @@ void FDECL((*handler), (int));
|
||||
|
||||
#ifdef PORT_HELP
|
||||
void
|
||||
port_help()
|
||||
port_help(void)
|
||||
{
|
||||
/*
|
||||
* Display unix-specific help. Just show contents of the helpfile
|
||||
@@ -598,7 +589,7 @@ port_help()
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
authorize_wizard_mode(void)
|
||||
{
|
||||
struct passwd *pw = get_unix_pw();
|
||||
|
||||
@@ -611,7 +602,7 @@ authorize_wizard_mode()
|
||||
}
|
||||
|
||||
static void
|
||||
wd_message()
|
||||
wd_message(void)
|
||||
{
|
||||
if (wiz_error_flag) {
|
||||
if (sysopt.wizards && sysopt.wizards[0]) {
|
||||
@@ -631,8 +622,7 @@ wd_message()
|
||||
* be room for the /
|
||||
*/
|
||||
void
|
||||
append_slash(name)
|
||||
char *name;
|
||||
append_slash(char *name)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -647,8 +637,7 @@ char *name;
|
||||
}
|
||||
|
||||
boolean
|
||||
check_user_string(optstr)
|
||||
const char *optstr;
|
||||
check_user_string(const char *optstr)
|
||||
{
|
||||
struct passwd *pw;
|
||||
int pwlen;
|
||||
@@ -684,7 +673,7 @@ const char *optstr;
|
||||
}
|
||||
|
||||
static struct passwd *
|
||||
get_unix_pw()
|
||||
get_unix_pw(void)
|
||||
{
|
||||
char *user;
|
||||
unsigned uid;
|
||||
@@ -715,7 +704,7 @@ get_unix_pw()
|
||||
}
|
||||
|
||||
char *
|
||||
get_login_name()
|
||||
get_login_name(void)
|
||||
{
|
||||
static char buf[BUFSZ];
|
||||
struct passwd *pw = get_unix_pw();
|
||||
@@ -728,7 +717,7 @@ get_login_name()
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sys_random_seed()
|
||||
sys_random_seed(void)
|
||||
{
|
||||
unsigned long seed = 0L;
|
||||
unsigned long pid = (unsigned long) getpid();
|
||||
|
||||
Reference in New Issue
Block a user