-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.426 $ $NHDT-Date: 1610410779 2021/01/12 00:19:39 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.428 $ $NHDT-Date: 1610587460 2021/01/14 01:24:20 $
General Fixes and Modified Features
-----------------------------------
potion being dropped due to 'pickup_burden' if encumbrance was already
over threshold before dipping but within it after removal from invent
give barrow wights a cold touch
+for configuration using external compression on save files that applied a name
+ suffix, 'selectsaved' (restore via menu) couldn't handle any which had
+ been manually uncompressed, mangling file name trying to remove suffix
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
-/* NetHack 3.7 files.c $NHDT-Date: 1610153478 2021/01/09 00:51:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.322 $ */
+/* NetHack 3.7 files.c $NHDT-Date: 1610587460 2021/01/14 01:24:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.323 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
Strcpy(g.SAVEF, filename);
#ifdef COMPRESS_EXTENSION
- g.SAVEF[strlen(g.SAVEF) - strlen(COMPRESS_EXTENSION)] = '\0';
+ {
+ /* if COMPRESS_EXTENSION is present, strip it off */
+ int sln = (int) strlen(g.SAVEF),
+ xln = (int) strlen(COMPRESS_EXTENSION);
+
+ if (sln > xln && !strcmp(&g.SAVEF[sln - xln], COMPRESS_EXTENSION))
+ g.SAVEF[sln - xln] = '\0';
+ }
#endif
nh_uncompress(g.SAVEF);
if ((nhfp = open_savefile()) != 0) {
boolean uncomp;
{
if (freopen(filename, mode, stream) == (FILE *) 0) {
- (void) fprintf(stderr, "freopen of %s for %scompress failed\n",
- filename, uncomp ? "un" : "");
+ const char *details;
+
+#if defined(NHSTDC) && !defined(NOTSTDC)
+ if ((details = strerror(errno)) == 0)
+#endif
+ details = "";
+ (void) fprintf(stderr,
+ "freopen of %s for %scompress failed; (%d) %s\n",
+ filename, uncomp ? "un" : "", errno, details);
nh_terminate(EXIT_FAILURE);
}
}
const char *filename;
boolean uncomp;
{
- char cfn[80];
+ char cfn[SAVESIZE];
FILE *cf;
const char *args[10];
#ifdef COMPRESS_OPTIONS