*/
if (!strncmp(argv[1], "-s", 2)) {
#if !defined(MSWIN_GRAPHICS)
-# ifdef CHDIR
+# if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(hackdir,0);
# endif
prscore(argc, argv);
/* chdir shouldn't be called before this point to keep the
* code parallel to other ports.
*/
-#ifdef CHDIR
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(hackdir,1);
#endif
# endif
suspend_nhwindows((char *)0);
# endif /* TOS */
+# ifndef NOCWD_ASSUMPTIONS
chdirx(orgdir, 0);
+# endif
# ifdef __GO32__
if (system(comspec) < 0) { /* wsu@eecs.umich.edu */
# else
if (iflags.BIOS)
(void)Cursconf(1, -1);
# endif
+# ifndef NOCWD_ASSUMPTIONS
chdirx(hackdir, 0);
+# endif
get_scr_size(); /* maybe the screen mode changed (TH) */
# if defined(MSDOS) && defined(NO_TERMS)
if (grmode) gr_init();
#ifdef MFLOPPY
if (ramdisk) copybones(TOPERM);
#endif
-#ifdef CHDIR
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdir(orgdir); /* chdir, not chdirx */
chdrive(orgdir);
#endif
/* we ignore QUIT and INT at this point */
if (!lock_file(HLOCK, LOCKPREFIX, 10)) {
wait_synch();
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
error("Quitting.");
}
fq_lock = fqname(lock, LEVELPREFIX, 1);
if((fd = open(fq_lock,0)) == -1) {
if(errno == ENOENT) goto gotlock; /* no such file */
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
#if defined(WIN32)
error("Bad directory or name: %s\n%s\n",
fq_lock, strerror(errno));
goto gotlock;
} else {
unlock_file(HLOCK);
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
error("Couldn't destroy old game.");
}
else {
unlock_file(HLOCK);
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
error("%s", "");
}
if (fd == -1) ern = errno;
unlock_file(HLOCK);
if(fd == -1) {
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
#if defined(WIN32)
error("cannot creat file (%s.)\n%s\n%s\"%s\" exists?\n",
fq_lock, strerror(ern), " Are you sure that the directory",
} else {
if(write(fd, (char *) &hackpid, sizeof(hackpid))
!= sizeof(hackpid)){
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
error("cannot write lock (%s)", fq_lock);
}
if(close(fd) == -1) {
+#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(orgdir, 0);
+#endif
error("cannot close lock (%s)", fq_lock);
}
}