win32tty: add subkeyvalue option to alter key values; Finnish keyboard fix
win32tty: distinguish between black/gray/white (by Quietust)
win32gui: prevent male Valkyrie and other incorrect startup settings
+win32: some code in files.c was incorrectly assuming that a file
+ descriptor return value of 0 from open() was invalid but it
+ could be valid on win32gui where stdin, stdout, stderr aren't open;
+ now it correctly checks for return value < 0 from open()
tiles: high priest tile had a couple bad pixels
tiles: bad pixels in Croesus and Yeenoghu tiles
FreeBSD: incorrect srandom declaration
#ifdef HOLD_LOCKFILE_OPEN
struct level_ftrack {
+int init;
int fd; /* file descriptor for level file */
int oflag; /* open flags */
boolean nethack_thinks_it_is_open; /* Does NetHack think it's open? */
int lev, oflag;
{
int reslt, fd;
- if (lftrack.fd) {
+ if (!lftrack.init) {
+ lftrack.init = 1;
+ lftrack.fd = -1;
+ }
+ if (lftrack.fd >= 0) {
/* check for compatible access */
if (lftrack.oflag == oflag) {
fd = lftrack.fd;
fd = sopen(name, oflag,SH_DENYRW, FCMASK);
lftrack.fd = fd;
lftrack.oflag = oflag;
- if (fd)
+ if (fd >= 0)
lftrack.nethack_thinks_it_is_open = TRUE;
}
return fd;
{
int fd = lftrack.fd;
lftrack.nethack_thinks_it_is_open = FALSE;
- lftrack.fd = 0;
+ lftrack.fd = -1;
lftrack.oflag = 0;
(void)_close(fd);
return;
}
+int
close(fd)
int fd;
{
#endif /* UNIX || VMS */
#if defined(AMIGA) || defined(WIN32) || defined(MSDOS)
+# ifdef AMIGA
+#define OPENFAILURE(fd) (!fd)
+# else
+#define OPENFAILURE(fd) (fd < 0)
+# endif
lockptr = 0;
- while (retryct-- && !lockptr) {
+ while (retryct-- && OPENFAILURE(lockptr)) {
# ifdef AMIGA
(void)DeleteFile(lockname); /* in case dead process was here first */
lockptr = Open(lockname,MODE_NEWFILE);
# else
lockptr = open(lockname, O_RDWR|O_CREAT|O_EXCL, S_IWRITE);
# endif
- if (!lockptr) {
+ if (OPENFAILURE(lockptr)) {
raw_printf("Waiting for access to %s. (%d retries left).",
filename, retryct);
Delay(50);