1 /* NetHack 3.6 macunix.c $NHDT-Date: 1432512797 2015/05/25 00:13:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* This file collects some Unix dependencies */
14 for (lp = s; *lp; lp++) {
15 if (*lp == '.' || *lp == ':')
24 int pid = getpid(); /* Process ID */
26 Sprintf(lock, "%d%s", getuid(), plname);
27 set_levelfile_name(lock, 0);
29 if ((fd = open(lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {
30 raw_printf("Could not lock the game %s.", lock);
31 panic("Another game in progress?");
34 if (write(fd, (char *) &pid, sizeof(pid)) != sizeof(pid)) {
35 raw_printf("Could not lock the game %s.", lock);
36 panic("Disk locked?");