fix SYSCF so that things build when first defined
Things won't build for ports that first define SYSCF. This moves assure_syscf_file() from unixmain.c to files.c and adjusts extern.h to get it out from under #ifdef UNIX. The call to assure_syscf_file() in options.c was only #ifdef SYSCF, SYSCF_FILE and not UNIX, so new ports #defining SYSCF would get an erro. assure_syscf_file() will be utilized by mswin when SYSCF is defined.
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.5 extern.h $NHDT-Date: 1426496453 2015/03/16 09:00:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.407 $ */
|
/* NetHack 3.5 extern.h $NHDT-Date: 1426966688 2015/03/21 19:38:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.411 $ */
|
||||||
/* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
|
/* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */
|
||||||
/* Copyright (c) Steve Creps, 1988. */
|
/* Copyright (c) Steve Creps, 1988. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -739,6 +739,9 @@ E void FDECL(free_saved_games, (char**));
|
|||||||
#ifdef SELF_RECOVER
|
#ifdef SELF_RECOVER
|
||||||
E boolean NDECL(recover_savefile);
|
E boolean NDECL(recover_savefile);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SYSCF_FILE
|
||||||
|
E void NDECL(assure_syscf_file);
|
||||||
|
#endif
|
||||||
#ifdef HOLD_LOCKFILE_OPEN
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
E void NDECL(really_close);
|
E void NDECL(really_close);
|
||||||
#endif
|
#endif
|
||||||
@@ -2288,9 +2291,6 @@ E void NDECL(port_help);
|
|||||||
E void FDECL(sethanguphandler, (void (*)(int)));
|
E void FDECL(sethanguphandler, (void (*)(int)));
|
||||||
E boolean NDECL(authorize_wizard_mode);
|
E boolean NDECL(authorize_wizard_mode);
|
||||||
E boolean FDECL(check_user_string, (char *));
|
E boolean FDECL(check_user_string, (char *));
|
||||||
# ifdef SYSCF_FILE
|
|
||||||
E void NDECL(assure_syscf_file);
|
|
||||||
# endif
|
|
||||||
#endif /* UNIX */
|
#endif /* UNIX */
|
||||||
|
|
||||||
/* ### unixtty.c ### */
|
/* ### unixtty.c ### */
|
||||||
|
|||||||
+4
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.5 ntconf.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
/* NetHack 3.5 ntconf.h $NHDT-Date: 1426966690 2015/03/21 19:38:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */
|
||||||
/* NetHack 3.5 ntconf.h $Date: 2012/01/15 19:11:38 $ $Revision: 1.35 $ */
|
/* NetHack 3.5 ntconf.h $Date: 2012/01/15 19:11:38 $ $Revision: 1.35 $ */
|
||||||
/* SCCS Id: @(#)ntconf.h 3.5 2002/03/10 */
|
/* SCCS Id: @(#)ntconf.h 3.5 2002/03/10 */
|
||||||
/* Copyright (c) NetHack PC Development Team 1993, 1994. */
|
/* Copyright (c) NetHack PC Development Team 1993, 1994. */
|
||||||
@@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#define SELF_RECOVER /* Allow the game itself to recover from an aborted game */
|
#define SELF_RECOVER /* Allow the game itself to recover from an aborted game */
|
||||||
|
|
||||||
|
#define SYSCF /* Use a global configuration */
|
||||||
|
#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */
|
||||||
|
|
||||||
#define USER_SOUNDS
|
#define USER_SOUNDS
|
||||||
|
|
||||||
#ifdef WIN32CON
|
#ifdef WIN32CON
|
||||||
|
|||||||
+24
-1
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.5 files.c $NHDT-Date: 1426544796 2015/03/16 22:26:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.134 $ */
|
/* NetHack 3.5 files.c $NHDT-Date: 1426966692 2015/03/21 19:38:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.135 $ */
|
||||||
/* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
|
/* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -3199,6 +3199,29 @@ int ifd, ofd;
|
|||||||
/* ---------- END INTERNAL RECOVER ----------- */
|
/* ---------- END INTERNAL RECOVER ----------- */
|
||||||
#endif /*SELF_RECOVER*/
|
#endif /*SELF_RECOVER*/
|
||||||
|
|
||||||
|
/* ---------- OTHER ----------- */
|
||||||
|
|
||||||
|
#ifdef SYSCF
|
||||||
|
# ifdef SYSCF_FILE
|
||||||
|
void
|
||||||
|
assure_syscf_file() {
|
||||||
|
/* All we really care about is the end result - can we read the file?
|
||||||
|
* So just check that directly. */
|
||||||
|
int fd;
|
||||||
|
fd = open(SYSCF_FILE, O_RDONLY);
|
||||||
|
if(fd >= 0){
|
||||||
|
/* readable */
|
||||||
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
raw_printf("Unable to open SYSCF_FILE.\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif /* SYSCF_FILE */
|
||||||
|
#endif /* SYSCF */
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* used by debugpline() to decide whether to issue a message
|
/* used by debugpline() to decide whether to issue a message
|
||||||
from a partiular source file; caller passes __FILE__ and we check
|
from a partiular source file; caller passes __FILE__ and we check
|
||||||
|
|||||||
+5
-2
@@ -1,9 +1,9 @@
|
|||||||
/* NetHack 3.5 pcmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
/* NetHack 3.5 pcmain.c $NHDT-Date: 1426966701 2015/03/21 19:38:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
|
||||||
/* NetHack 3.5 pcmain.c $Date: 2012/01/20 03:41:31 $ $Revision: 1.48 $ */
|
/* NetHack 3.5 pcmain.c $Date: 2012/01/20 03:41:31 $ $Revision: 1.48 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
/* main.c - MSDOS, OS/2, ST, Amiga, and NT NetHack */
|
/* main.c - MSDOS, OS/2, ST, Amiga, and Windows NetHack */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "dlb.h"
|
#include "dlb.h"
|
||||||
@@ -244,6 +244,9 @@ char *argv[];
|
|||||||
|
|
||||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(hackdir,0);
|
chdirx(hackdir,0);
|
||||||
|
#endif
|
||||||
|
#ifdef SYSCF
|
||||||
|
initoptions();
|
||||||
#endif
|
#endif
|
||||||
prscore(argc, argv);
|
prscore(argc, argv);
|
||||||
nethack_exit(EXIT_SUCCESS);
|
nethack_exit(EXIT_SUCCESS);
|
||||||
|
|||||||
+1
-17
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.5 unixmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
|
/* NetHack 3.5 unixmain.c $NHDT-Date: 1426966705 2015/03/21 19:38:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
|
||||||
/* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */
|
/* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -648,20 +648,4 @@ get_unix_pw()
|
|||||||
return pw;
|
return pw;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SYSCF_FILE
|
|
||||||
void
|
|
||||||
assure_syscf_file(){
|
|
||||||
/* All we really care about is the end result - can we read the file?
|
|
||||||
* So just check that directly. */
|
|
||||||
int fd;
|
|
||||||
fd = open(SYSCF_FILE, O_RDONLY);
|
|
||||||
if(fd >= 0){
|
|
||||||
/* readable */
|
|
||||||
close(fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
raw_printf("Unable to open SYSCF_FILE.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*unixmain.c*/
|
/*unixmain.c*/
|
||||||
|
|||||||
Reference in New Issue
Block a user