diff --git a/include/vmsconf.h b/include/vmsconf.h index a815e704a..9f061563b 100644 --- a/include/vmsconf.h +++ b/include/vmsconf.h @@ -172,7 +172,13 @@ PANICTRACE_GDB=2 #at conclusion of panic, show a call traceback and then * The remainder of the file should not need to be changed. */ -/* data librarian defs */ +/* This used to be force-defined for VMS in topten.c, but with + * the global variable consolidation into g in 3.7, it has to be + * defined here so that decl.h includes the field in g. + */ +#define UPDATE_RECORD_IN_PLACE + +/* data librarian defs */ #ifdef DLB #define DLBFILE "nh-data.dlb" /* diff --git a/src/files.c b/src/files.c index fd275c904..274934c47 100644 --- a/src/files.c +++ b/src/files.c @@ -1036,7 +1036,7 @@ boolean regularize_it; Sprintf(g.SAVEF, "[.save]%d%s", getuid(), g.plname); regoffset = 7; indicator_spot = 1; - postappend = ";1"); + postappend = ";1"; #endif #if defined(WIN32) if (regularize_it) { diff --git a/src/topten.c b/src/topten.c index 22347595d..34c43e536 100644 --- a/src/topten.c +++ b/src/topten.c @@ -11,11 +11,13 @@ #include "patchlevel.h" #endif -#ifdef VMS -/* We don't want to rewrite the whole file, because that entails - creating a new version which requires that the old one be deletable. */ -#define UPDATE_RECORD_IN_PLACE -#endif +/* If UPDATE_RECORD_IN_PLACE is defined, we don't want to rewrite the + * whole file, because that entails creating a new version which + * requires that the old one be deletable. UPDATE_RECORD_IN_PLACE + * had to be defined more centrally in 3.7 to ensure that the + * final_fpos field gets included in struct instance_globals aka 'g'. +*/ + /* * Updating in place can leave junk at the end of the file in some diff --git a/sys/vms/vmsbuild.com b/sys/vms/vmsbuild.com index 788838ba2..de04754bc 100755 --- a/sys/vms/vmsbuild.com +++ b/sys/vms/vmsbuild.com @@ -34,7 +34,7 @@ $ gnuc_ = "GCC" $ if f$type(gcc).eqs."STRING" then gnuc_ = gcc $ gnulib = "gnu_cc:[000000]gcclib/Library" !(not used w/ vaxc) $ ! common CC options (/obj=file doesn't work for GCC 1.36, use rename instead) -$ c_c_ = "/INCLUDE=[-.INCLUDE]" +$ c_c_ = "/INCLUDE=([-.INCLUDE],[-.-.LUA535.SRC])/DEFINE=(""LUA_USE_C89"", ""LUA_32BITS"")" $ veryold_vms = f$extract(1,1,f$getsyi("VERSION")).eqs."4" - .and. f$extract(3,3,f$getsyi("VERSION")).lts."6" $ if veryold_vms then c_c_ = c_c_ + "/DEFINE=(""VERYOLD_VMS"")" diff --git a/sys/vms/vmsmain.c b/sys/vms/vmsmain.c index f9df5d926..f4631557c 100644 --- a/sys/vms/vmsmain.c +++ b/sys/vms/vmsmain.c @@ -32,7 +32,7 @@ main(argc, argv) int argc; char *argv[]; { - register int fd; + NHFILE *nhfp; #ifdef CHDIR register char *dir; #endif @@ -49,7 +49,7 @@ char *argv[]; atexit(byebye); g.hname = argv[0]; g.hname = vms_basename(g.hname); /* name used in 'usage' type messages */ - hackpid = getpid(); + g.hackpid = getpid(); (void) umask(0); choose_windows(DEFAULT_WINDOW_SYS); @@ -67,8 +67,25 @@ char *argv[]; dir = nh_getenv("HACKDIR"); #endif if (argc > 1) { + if (argcheck(argc, argv, ARG_VERSION) == 2) + exit(EXIT_SUCCESS); + + if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) { #ifdef CHDIR - if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { + chdirx((char *) 0, 0); +#endif + iflags.initoptions_noterminate = TRUE; + initoptions(); + iflags.initoptions_noterminate = FALSE; + reveal_paths(); + exit(EXIT_SUCCESS); + } + if (argcheck(argc, argv, ARG_DEBUG) == 1) { + argc--; + argv++; + } +#ifdef CHDIR + if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { /* avoid matching "-dec" for DECgraphics; since the man page * says -d directory, hope nobody's using -desomething_else */ @@ -175,7 +192,7 @@ char *argv[]; * We'll return here if new game player_selection() renames the hero. */ attempt_restore: - if ((fd = restore_saved_game()) >= 0) { + if ((nhfp = restore_saved_game()) != 0) { const char *fq_save = fqname(g.SAVEF, SAVEPREFIX, 1); (void) chmod(fq_save, 0); /* disallow parallel restores */ @@ -188,7 +205,7 @@ attempt_restore: #endif pline("Restoring save file..."); mark_synch(); /* flush output */ - if (dorecover(fd)) { + if (dorecover(nhfp)) { resuming = TRUE; /* not starting new game */ wd_message(); if (discover || wizard) { diff --git a/sys/vms/vmsunix.c b/sys/vms/vmsunix.c index 81e71efeb..2eec83b01 100644 --- a/sys/vms/vmsunix.c +++ b/sys/vms/vmsunix.c @@ -110,7 +110,7 @@ getlock() 'a','b',&c below; override the default and use if we aren't restricting the number of simultaneous games */ if (!g.locknum) - Sprintf(g.lock, "_%u%s", (unsigned) getuid(), plname); + Sprintf(g.lock, "_%u%s", (unsigned) getuid(), g.plname); regularize(g.lock); set_levelfile_name(g.lock, 0);