Files
nethack/sys/mac/macunix.c
kmhugo 87843397c3 Macintosh port update
Several long-awaited updates for the Macintosh port, by Dean
Luick and myself.  This set affects Mac-only files.

* Update the support for MPW compilers.
* Use new system call names provided for in the latest Apple
  Universal Headers.
* Tune up some of the includes for CodeWarrior.
* Define YY_NEVER_INTERACTIVE for the dungeon and level compilers.
* Remove pointless debugging code.
* Clean up some unterminated comments.
2002-01-10 06:53:52 +00:00

52 lines
938 B
C

/* SCCS Id: @(#)macunix.c 3.1 94/11/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* This file collects some Unix dependencies */
#include "hack.h"
#if 0
int
uptodate(int fd)
#if defined(applec) || defined(__MWERKS__)
# pragma unused(fd)
#endif
return(1);
}
#endif
void
regularize(char *s)
{
register char *lp;
for (lp = s; *lp; lp++) {
if (*lp == '.' || *lp == ':')
*lp = '_';
}
}
void
getlock(void)
{
int fd;
int pid = getpid(); /* Process Serial Number ? */
set_levelfile_name (lock, 0);
if ((fd = open (lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {
raw_printf ("Could not lock the game %s.", lock);
panic ("Another game in progress?");
}
if (write (fd, (char *)&pid, sizeof (pid)) != sizeof (pid)) {
raw_printf ("Could not lock the game %s.", lock);
panic("Disk locked?");
}
close (fd);
}