[rec.games.hack] nethack for os9/68k, 2 of 2

blarson@skat.usc.edu (Bob Larson) (02/01/88)

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:    Shell Archiver
#	Run the following text with /bin/sh to create:
#	bones.c.diff
#	decl.c.diff
#	do.c.diff
#	end.c.diff
#	engrave.c.diff
#	lev.c.diff
#	makedefs.c.diff
#	pager.c.diff
#	save.c.diff
#	search.c.diff
#	termcap.c.diff
#	unixmain.c.diff
#	vault.c.diff
#	version.c.diff
#	write.c.diff
# By:	Jim Omura ()
cat << \SHAR_EOF > bones.c.diff
*** bones.c.orig
--- bones.c
**************
*** 93,99
  			otmp->cursed = 1;    /* flag as gotten from a ghost */
  		}
  	}
! #ifdef DGK
  	fd = open(bones, O_WRONLY | O_BINARY | O_CREAT, FMASK);
  #else
  	fd = creat(bones, FMASK);
--- 93,99 -----
  			otmp->cursed = 1;    /* flag as gotten from a ghost */
  		}
  	}
! #if defined(DGK) && !defined(OSK)
  	fd = open(bones, O_WRONLY | O_BINARY | O_CREAT, FMASK);
  #else
  	fd = creat(bones, FMASK);
**************
*** 148,153
  	bones[6] = '0' + dlevel/10;
  	bones[7] = '0' + dlevel%10;
  #endif
  	if((fd = open(bones, 0)) < 0) return(0);
  	if((ok = uptodate(fd)) != 0){
  #ifdef WIZARD
--- 148,156 -----
  	bones[6] = '0' + dlevel/10;
  	bones[7] = '0' + dlevel%10;
  #endif
+ #ifdef OSK
+ 	if((fd = open(bones, S_IREAD)) < 0) return 0;
+ #else
  	if((fd = open(bones, 0)) < 0) return(0);
  #endif
  	if((ok = uptodate(fd)) != 0){
**************
*** 149,154
  	bones[7] = '0' + dlevel%10;
  #endif
  	if((fd = open(bones, 0)) < 0) return(0);
  	if((ok = uptodate(fd)) != 0){
  #ifdef WIZARD
  		if(wizard)  {
--- 152,158 -----
  	if((fd = open(bones, S_IREAD)) < 0) return 0;
  #else
  	if((fd = open(bones, 0)) < 0) return(0);
+ #endif
  	if((ok = uptodate(fd)) != 0){
  #ifdef WIZARD
  		if(wizard)  {
SHAR_EOF
cat << \SHAR_EOF > decl.c.diff
*** decl.c.orig
--- decl.c
**************
*** 55,61
  #ifdef SPELLS
  struct spell spl_book[MAXSPELL + 1];
  #endif
- struct rm levl[COLNO][ROWNO];	/* level map */
  struct monst youmonst;	/* dummy; used as return value for boomhit */
  
  xchar dlevel = 1;
--- 55,60 -----
  #ifdef SPELLS
  struct spell spl_book[MAXSPELL + 1];
  #endif
  struct monst youmonst;	/* dummy; used as return value for boomhit */
  
  xchar dlevel = 1;
SHAR_EOF
cat << \SHAR_EOF > do.c.diff
*** do.c.orig
--- do.c
**************
*** 163,169
  	if(newlevel == dlevel) return;	      /* this can happen */
  
  	glo(dlevel);
! #ifdef DGK
  	/* Use O_TRUNC to force the file to be shortened if it already
  	 * exists and is currently longer.
  	 */
--- 163,169 -----
  	if(newlevel == dlevel) return;	      /* this can happen */
  
  	glo(dlevel);
! #if defined(DGK) && !defined(OSK)
  	/* Use O_TRUNC to force the file to be shortened if it already
  	 * exists and is currently longer.
  	 */
**************
*** 179,185
  		 * Another possibility is that the directory was not
  		 * writable.
  		 */
! #ifdef DGK
  		pline("Cannot create level file '%s'.", lock);
  #else
  		pline("A mysterious force prevents you from going %s.",
--- 179,185 -----
  		 * Another possibility is that the directory was not
  		 * writable.
  		 */
! #if defined(DGK) || defined(OSK)
  		pline("Cannot create level file '%s'.", lock);
  #else
  		pline("A mysterious force prevents you from going %s.",
**************
*** 229,234
  		mklev();
  	else {
  		extern int hackpid;
  #ifdef DGK
  		/* If not currently accessible, swap it in.
  		 */
--- 229,237 -----
  		mklev();
  	else {
  		extern int hackpid;
+ #ifdef OSK
+ 		if((fd = open(lock, S_IREAD)) < 0) {
+ #else
  #ifdef DGK
  		/* If not currently accessible, swap it in.
  		 */
**************
*** 238,243
  		if((fd = open(lock, O_RDONLY | O_BINARY)) < 0) {
  #else
  		if((fd = open(lock,0)) < 0) {
  #endif
  			pline("Cannot open %s .", lock);
  			pline("Probably someone removed it.");
--- 241,247 -----
  		if((fd = open(lock, O_RDONLY | O_BINARY)) < 0) {
  #else
  		if((fd = open(lock,0)) < 0) {
+ #endif
  #endif
  			pline("Cannot open %s .", lock);
  			pline("Probably someone removed it.");
SHAR_EOF
cat << \SHAR_EOF > end.c.diff
*** end.c.orig
--- end.c
**************
*** 14,19
  
  done1()
  {
  	(void) signal(SIGINT,SIG_IGN);
  #if defined(WIZARD) && defined(UNIX) && !defined(KJSMODS)
  	if(wizard) {
--- 14,20 -----
  
  done1()
  {
+ #ifndef OSK
  	(void) signal(SIGINT,SIG_IGN);
  #if defined(WIZARD) && defined(UNIX) && !defined(KJSMODS)
  	if(wizard) {
**************
*** 24,29
  	    }
  	}
  #endif
  	pline("Really quit?");
  	if(readchar() != 'y') {
  		(void) signal(SIGINT,done1);
--- 25,31 -----
  	    }
  	}
  #endif
+ #endif
  	pline("Really quit?");
  	if(readchar() != 'y') {
  #ifndef OSK
**************
*** 26,31
  #endif
  	pline("Really quit?");
  	if(readchar() != 'y') {
  		(void) signal(SIGINT,done1);
  		clrlin();
  		(void) fflush(stdout);
--- 28,34 -----
  #endif
  	pline("Really quit?");
  	if(readchar() != 'y') {
+ #ifndef OSK
  		(void) signal(SIGINT,done1);
  #endif
  		clrlin();
**************
*** 27,32
  	pline("Really quit?");
  	if(readchar() != 'y') {
  		(void) signal(SIGINT,done1);
  		clrlin();
  		(void) fflush(stdout);
  		if(multi > 0) nomul(0);
--- 30,36 -----
  	if(readchar() != 'y') {
  #ifndef OSK
  		(void) signal(SIGINT,done1);
+ #endif
  		clrlin();
  		(void) fflush(stdout);
  		if(multi > 0) nomul(0);
**************
*** 38,43
  
  done_intr(){
  	done_stopprint++;
  	(void) signal(SIGINT, SIG_IGN);
  #ifdef UNIX
  	(void) signal(SIGQUIT, SIG_IGN);
--- 42,48 -----
  
  done_intr(){
  	done_stopprint++;
+ #ifndef OSK
  	(void) signal(SIGINT, SIG_IGN);
  #ifdef UNIX
  	(void) signal(SIGQUIT, SIG_IGN);
**************
*** 42,47
  #ifdef UNIX
  	(void) signal(SIGQUIT, SIG_IGN);
  #endif
  }
  
  #ifdef UNIX
--- 47,53 -----
  #ifdef UNIX
  	(void) signal(SIGQUIT, SIG_IGN);
  #endif
+ #endif
  }
  
  #ifdef UNIX
**************
*** 47,52
  #ifdef UNIX
  done_hangup(){
  	done_hup++;
  	(void) signal(SIGHUP, SIG_IGN);
  	done_intr();
  }
--- 53,59 -----
  #ifdef UNIX
  done_hangup(){
  	done_hup++;
+ #ifndef OSK
  	(void) signal(SIGHUP, SIG_IGN);
  #endif
  	done_intr();
**************
*** 48,53
  done_hangup(){
  	done_hup++;
  	(void) signal(SIGHUP, SIG_IGN);
  	done_intr();
  }
  #endif
--- 55,61 -----
  	done_hup++;
  #ifndef OSK
  	(void) signal(SIGHUP, SIG_IGN);
+ #endif
  	done_intr();
  }
  #endif
**************
*** 148,153
  	}
  #endif /* WIZARD /**/
  die:
  	(void) signal(SIGINT, done_intr);
  #ifdef UNIX
  	(void) signal(SIGQUIT, done_intr);
--- 156,162 -----
  	}
  #endif /* WIZARD /**/
  die:
+ #ifndef OSK
  	(void) signal(SIGINT, done_intr);
  #ifdef UNIX
  	(void) signal(SIGQUIT, done_intr);
**************
*** 153,158
  	(void) signal(SIGQUIT, done_intr);
  	(void) signal(SIGHUP, done_hangup);
  #endif
  	if(*st1 == 'q' && u.uhp < 1){
  		st1 = "died";
  		killer = "quit while already on Charon's boat";
--- 162,168 -----
  	(void) signal(SIGQUIT, done_intr);
  	(void) signal(SIGHUP, done_hangup);
  #endif
+ #endif
  	if(*st1 == 'q' && u.uhp < 1){
  		st1 = "died";
  		killer = "quit while already on Charon's boat";
**************
*** 326,332
  	if (ramdisk)
  		eraseall(permbones, alllevels);
  #else
! # ifdef UNIX
  register x;
  	(void) signal(SIGHUP,SIG_IGN);
  	for(x = maxdlevel; x >= 0; x--) {
--- 336,342 -----
  	if (ramdisk)
  		eraseall(permbones, alllevels);
  #else
! # if defined(UNIX) || defined(OSK)
  register x;
  #ifndef OSK
  	(void) signal(SIGHUP,SIG_IGN);
**************
*** 328,333
  #else
  # ifdef UNIX
  register x;
  	(void) signal(SIGHUP,SIG_IGN);
  	for(x = maxdlevel; x >= 0; x--) {
  		glo(x);
--- 338,344 -----
  #else
  # if defined(UNIX) || defined(OSK)
  register x;
+ #ifndef OSK
  	(void) signal(SIGHUP,SIG_IGN);
  #endif
  	for(x = maxdlevel; x >= 0; x--) {
**************
*** 329,334
  # ifdef UNIX
  register x;
  	(void) signal(SIGHUP,SIG_IGN);
  	for(x = maxdlevel; x >= 0; x--) {
  		glo(x);
  		(void) unlink(lock);	/* not all levels need be present */
--- 340,346 -----
  register x;
  #ifndef OSK
  	(void) signal(SIGHUP,SIG_IGN);
+ #endif
  	for(x = maxdlevel; x >= 0; x--) {
  		glo(x);
  		(void) unlink(lock);	/* not all levels need be present */
**************
*** 340,345
  #ifdef NOSAVEONHANGUP
  hangup()
  {
  	(void) signal(SIGINT, SIG_IGN);
  	clearlocks();
  	exit(1);
--- 352,358 -----
  #ifdef NOSAVEONHANGUP
  hangup()
  {
+ #ifndef OSK
  	(void) signal(SIGINT, SIG_IGN);
  #endif
  	clearlocks();
**************
*** 341,346
  hangup()
  {
  	(void) signal(SIGINT, SIG_IGN);
  	clearlocks();
  	exit(1);
  }
--- 354,360 -----
  {
  #ifndef OSK
  	(void) signal(SIGINT, SIG_IGN);
+ #endif
  	clearlocks();
  	exit(1);
  }
SHAR_EOF
cat << \SHAR_EOF > engrave.c.diff
*** engrave.c.orig
--- engrave.c
**************
*** 202,209
  	otmp = getobj("#-()/", "write with");
  	if(!otmp) return(0);
  
! #ifdef FREEHAND /* There's no reason you should be able to write with a wand
! 		 * while both your hands are tied up.  Also, it's necessary to
  		 * prevent engraving with "worn" objects other than weapons.
  		 */
  	if (!freehand() && otmp != uwep) {
--- 202,209 -----
  	otmp = getobj("#-()/", "write with");
  	if(!otmp) return(0);
  
! #ifdef FREEHAND /* There's no reason you should be able to write with a wand */
! 		/* while both your hands are tied up.  Also, it's necessary to
  		 * prevent engraving with "worn" objects other than weapons.
  		 */
  	if (!freehand() && otmp != uwep) {
SHAR_EOF
cat << \SHAR_EOF > lev.c.diff
*** lev.c.orig
--- lev.c
**************
*** 576,581
  	char buf[BUFSIZ];
  	int nfrom, nto, fdfrom, fdto;
  
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy from %s !?", from);
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
--- 576,584 -----
  	char buf[BUFSIZ];
  	int nfrom, nto, fdfrom, fdto;
  
+ #ifdef OSK
+ 	if ((fdfrom = open(from, S_IREAD)) < 0)
+ #else
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  #endif
  		panic("Can't copy from %s !?", from);
**************
*** 577,582
  	int nfrom, nto, fdfrom, fdto;
  
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy from %s !?", from);
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy to %s", to);
--- 580,586 -----
  	if ((fdfrom = open(from, S_IREAD)) < 0)
  #else
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
+ #endif
  		panic("Can't copy from %s !?", from);
  #ifdef OSK
  	if ((fdto = creat(to, FMASK)) < 0)
**************
*** 578,583
  
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy from %s !?", from);
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy to %s", to);
  	do {
--- 582,590 -----
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  #endif
  		panic("Can't copy from %s !?", from);
+ #ifdef OSK
+ 	if ((fdto = creat(to, FMASK)) < 0)
+ #else
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  #endif
  		panic("Can't copy to %s", to);
**************
*** 579,584
  	if ((fdfrom = open(from, O_RDONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy from %s !?", from);
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy to %s", to);
  	do {
  		nfrom = read(fdfrom, buf, BUFSIZ);
--- 586,592 -----
  	if ((fdto = creat(to, FMASK)) < 0)
  #else
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
+ #endif
  		panic("Can't copy to %s", to);
  	do {
  /* RAL: don't try to write -1 bytes if file is a multiple of BUFSIZ bytes */
**************
*** 581,587
  	if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT, FMASK)) < 0)
  		panic("Can't copy to %s", to);
  	do {
! 		nfrom = read(fdfrom, buf, BUFSIZ);
  		nto = write(fdto, buf, nfrom);
  		if (nto != nfrom)
  			panic("Copyfile failed!");
--- 589,596 -----
  #endif
  		panic("Can't copy to %s", to);
  	do {
! /* RAL: don't try to write -1 bytes if file is a multiple of BUFSIZ bytes */
! 		if((nfrom = read(fdfrom, buf, BUFSIZ)) > 0) {
  			nto = write(fdto, buf, nfrom);
  			if (nto != nfrom)
  				panic("Copyfile failed!");
**************
*** 585,590
  		nto = write(fdto, buf, nfrom);
  		if (nto != nfrom)
  			panic("Copyfile failed!");
  	} while (nfrom == BUFSIZ);
  	close(fdfrom);
  	close(fdto);
--- 594,600 -----
  			nto = write(fdto, buf, nfrom);
  			if (nto != nfrom)
  				panic("Copyfile failed!");
+ 		}
  	} while (nfrom == BUFSIZ);
  	close(fdfrom);
  	close(fdto);
SHAR_EOF
cat << \SHAR_EOF > makedefs.c.diff
*** makedefs.c.orig
--- makedefs.c
**************
*** 163,169
  do_date(){
  int	getpid();
  long	clock, time();
! char	tmpfile[30], cbuf[30], *c, *ctime();
  FILE	*freopen();
  
  	sprintf(tmpfile, "makedefs.%d", getpid());
--- 163,172 -----
  do_date(){
  int	getpid();
  long	clock, time();
! char	tmpfile[30], cbuf[30], *c;
! #ifndef OSK
! char *ctime();	/* ctime is a macro */
! #endif
  FILE	*freopen();
  
  	sprintf(tmpfile, "makedefs.%d", getpid());
**************
*** 301,306
  char	*limit();
  int skip;
  
  	fd = open(OBJ_FILE, 0);
  	if(fd < 0) {
  		perror(OBJ_FILE);
--- 304,312 -----
  char	*limit();
  int skip;
  
+ #ifdef OSK
+ 	fd = open(OBJ_FILE, S_IREAD);
+ #else
  	fd = open(OBJ_FILE, 0);
  #endif
  	if(fd < 0) {
**************
*** 302,307
  int skip;
  
  	fd = open(OBJ_FILE, 0);
  	if(fd < 0) {
  		perror(OBJ_FILE);
  		exit(1);
--- 308,314 -----
  	fd = open(OBJ_FILE, S_IREAD);
  #else
  	fd = open(OBJ_FILE, 0);
+ #endif
  	if(fd < 0) {
  		perror(OBJ_FILE);
  		exit(1);
SHAR_EOF
cat << \SHAR_EOF > pager.c.diff
*** pager.c.orig
--- pager.c
**************
*** 156,161
  		}
  		*bufrp = '\0';
  #else
  	int (*prevsig)() = signal(SIGINT, intruph);
  
  	set_pager(0);
--- 156,162 -----
  		}
  		*bufrp = '\0';
  #else
+ #ifndef OSK
  	int (*prevsig)() = signal(SIGINT, intruph);
  #endif
  
**************
*** 157,162
  		*bufrp = '\0';
  #else
  	int (*prevsig)() = signal(SIGINT, intruph);
  
  	set_pager(0);
  	bufr = (char *) alloc((unsigned) CO);
--- 158,164 -----
  #else
  #ifndef OSK
  	int (*prevsig)() = signal(SIGINT, intruph);
+ #endif
  
  	set_pager(0);
  	bufr = (char *) alloc((unsigned) CO);
**************
*** 176,181
  	free(bufr);
  	(void) fclose(fp);
  #ifndef DGK
  	(void) signal(SIGINT, prevsig);
  	got_intrup = 0;
  #endif
--- 178,184 -----
  	free(bufr);
  	(void) fclose(fp);
  #ifndef DGK
+ #ifndef OSK
  	(void) signal(SIGINT, prevsig);
  #endif
  	got_intrup = 0;
**************
*** 177,183
  	(void) fclose(fp);
  #ifndef DGK
  	(void) signal(SIGINT, prevsig);
- 	got_intrup = 0;
  #endif
  }
  
--- 180,185 -----
  #ifndef DGK
  #ifndef OSK
  	(void) signal(SIGINT, prevsig);
  #endif
  	got_intrup = 0;
  #endif
**************
*** 179,184
  	(void) signal(SIGINT, prevsig);
  	got_intrup = 0;
  #endif
  }
  
  static boolean whole_screen = TRUE;
--- 181,188 -----
  #ifndef OSK
  	(void) signal(SIGINT, prevsig);
  #endif
+ 	got_intrup = 0;
+ #endif
  }
  
  static boolean whole_screen = TRUE;
**************
*** 457,462
  		return(0);
  	}
  	/* fork succeeded; wait for child to exit */
  	(void) signal(SIGINT,SIG_IGN);
  	(void) signal(SIGQUIT,SIG_IGN);
  	(void) wait((int *) 0);
--- 461,467 -----
  		return(0);
  	}
  	/* fork succeeded; wait for child to exit */
+ #ifndef OSK
  	(void) signal(SIGINT,SIG_IGN);
  	(void) signal(SIGQUIT,SIG_IGN);
  #endif
**************
*** 459,464
  	/* fork succeeded; wait for child to exit */
  	(void) signal(SIGINT,SIG_IGN);
  	(void) signal(SIGQUIT,SIG_IGN);
  	(void) wait((int *) 0);
  	gettty();
  	setftty();
--- 464,470 -----
  #ifndef OSK
  	(void) signal(SIGINT,SIG_IGN);
  	(void) signal(SIGQUIT,SIG_IGN);
+ #endif
  	(void) wait((int *) 0);
  	gettty();
  	setftty();
**************
*** 462,467
  	(void) wait((int *) 0);
  	gettty();
  	setftty();
  	(void) signal(SIGINT,done1);
  #ifdef WIZARD
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
--- 468,474 -----
  	(void) wait((int *) 0);
  	gettty();
  	setftty();
+ #ifndef OSK
  	(void) signal(SIGINT,done1);
  #endif
  #ifdef WIZARD
**************
*** 463,468
  	gettty();
  	setftty();
  	(void) signal(SIGINT,done1);
  #ifdef WIZARD
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
  #endif
--- 470,476 -----
  	setftty();
  #ifndef OSK
  	(void) signal(SIGINT,done1);
+ #endif
  #ifdef WIZARD
  #ifndef OSK
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
**************
*** 464,469
  	setftty();
  	(void) signal(SIGINT,done1);
  #ifdef WIZARD
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
  #endif
  	if(wt) getret();
--- 472,478 -----
  	(void) signal(SIGINT,done1);
  #endif
  #ifdef WIZARD
+ #ifndef OSK
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
  #endif
  #endif
**************
*** 465,470
  	(void) signal(SIGINT,done1);
  #ifdef WIZARD
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
  #endif
  	if(wt) getret();
  	docrt();
--- 474,480 -----
  #ifdef WIZARD
  #ifndef OSK
  	if(wizard) (void) signal(SIGQUIT,SIG_DFL);
+ #endif
  #endif
  	if(wt) getret();
  	docrt();
SHAR_EOF
cat << \SHAR_EOF > save.c.diff
*** save.c.orig
--- save.c
**************
*** 45,50
  #ifdef UNIX
  	(void) signal(SIGHUP, SIG_IGN);
  #endif
  #ifndef __TURBOC__
  	(void) signal(SIGINT, SIG_IGN);
  #endif
--- 45,51 -----
  #ifdef UNIX
  	(void) signal(SIGHUP, SIG_IGN);
  #endif
+ #ifndef OSK
  #ifndef __TURBOC__
  	(void) signal(SIGINT, SIG_IGN);
  #endif
**************
*** 48,54
  #ifndef __TURBOC__
  	(void) signal(SIGINT, SIG_IGN);
  #endif
! #ifdef DGK
  	if (!saveDiskPrompt(0))
  		return 0;
  	fd = open(SAVEF, O_WRONLY | O_BINARY | O_CREAT, FMASK);
--- 49,56 -----
  #ifndef __TURBOC__
  	(void) signal(SIGINT, SIG_IGN);
  #endif
! #endif
! #if defiend(DGK) && !defined(OSK)
  	if (!saveDiskPrompt(0))
  		return 0;
  	fd = open(SAVEF, O_WRONLY | O_BINARY | O_CREAT, FMASK);
**************
*** 133,138
  #ifdef DGK
  		msmsg(".");
  #endif
  		if((ofd = open(lock, 0)) < 0) {
  		    if(!hu) pline("Error while saving: cannot read %s.", lock);
  		    (void) close(fd);
--- 135,143 -----
  #ifdef DGK
  		msmsg(".");
  #endif
+ #ifdef OSK
+ 		if((ofd = open(lock, S_IREAD)) < 0) {
+ #else
  		if((ofd = open(lock, 0)) < 0) {
  #endif
  		    if(!hu) pline("Error while saving: cannot read %s.", lock);
**************
*** 134,139
  		msmsg(".");
  #endif
  		if((ofd = open(lock, 0)) < 0) {
  		    if(!hu) pline("Error while saving: cannot read %s.", lock);
  		    (void) close(fd);
  		    (void) unlink(SAVEF);
--- 139,145 -----
  		if((ofd = open(lock, S_IREAD)) < 0) {
  #else
  		if((ofd = open(lock, 0)) < 0) {
+ #endif
  		    if(!hu) pline("Error while saving: cannot read %s.", lock);
  		    (void) close(fd);
  		    (void) unlink(SAVEF);
**************
*** 227,233
  			break;
  		getlev(fd, 0, tmp);
  		glo(tmp);
! #ifdef DGK
  		msmsg(".");
  		nfd = open(lock, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FMASK);
  #else
--- 233,239 -----
  			break;
  		getlev(fd, 0, tmp);
  		glo(tmp);
! #if defined(DGK) && !defined(OSK)
  		msmsg(".");
  		nfd = open(lock, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FMASK);
  #else
SHAR_EOF
cat << \SHAR_EOF > search.c.diff
*** search.c.orig
--- search.c
**************
*** 54,62
  	register xchar x,y;
  	register struct trap *trap;
  	register struct monst *mtmp;
! #ifdef BVH	/* if weapon is Excalibur give the user the sword's
! 		 * magic bonus (+ or -) to search for hidden objects.
! 		 */
  	int fund = (uwep && !strcmp(ONAME(uwep),"Excalibur")) ?
  			((uwep->spe > 5) ? 5 : uwep->spe) : 0;
  #endif
--- 54,61 -----
  	register xchar x,y;
  	register struct trap *trap;
  	register struct monst *mtmp;
! #ifdef BVH	/* if weapon is Excalibur give the user the sword's	*/
! 		/* magic bonus (+ or -) to search for hidden objects.	*/
  	int fund = (uwep && !strcmp(ONAME(uwep),"Excalibur")) ?
  			((uwep->spe > 5) ? 5 : uwep->spe) : 0;
  #endif
SHAR_EOF
cat << \SHAR_EOF > termcap.c.diff
*** termcap.c.orig
--- termcap.c
**************
*** 7,12
  #ifdef GENIX
  #define	void	int	/* jhn - mod to prevent compiler from bombing */
  #endif
  
  extern char *tgetstr(), *tgoto(), *getenv();
  extern long *alloc();
--- 7,15 -----
  #ifdef GENIX
  #define	void	int	/* jhn - mod to prevent compiler from bombing */
  #endif
+ #ifdef OSK
+ #define	PC	PC_
+ #endif
  
  extern char *tgetstr(), *tgoto(), *getenv();
  extern long *alloc();
**************
*** 13,18
  
  #ifndef TERMINFO
  # ifndef LINT
  extern			/* it is defined in libtermlib (libtermcap) */
  # endif
  	short ospeed;		/* terminal baudrate; used by tputs */
--- 16,22 -----
  
  #ifndef TERMINFO
  # ifndef LINT
+ #ifndef OSK
  extern			/* it is defined in libtermlib (libtermcap) */
  #endif
  # endif
**************
*** 14,19
  #ifndef TERMINFO
  # ifndef LINT
  extern			/* it is defined in libtermlib (libtermcap) */
  # endif
  	short ospeed;		/* terminal baudrate; used by tputs */
  #endif
--- 18,24 -----
  # ifndef LINT
  #ifndef OSK
  extern			/* it is defined in libtermlib (libtermcap) */
+ #endif
  # endif
  	short ospeed;		/* terminal baudrate; used by tputs */
  #endif
**************
*** 18,24
  	short ospeed;		/* terminal baudrate; used by tputs */
  #endif
  static char tbuf[512];
! static char *HO, *CL, *CE, *UP, *CM, *ND, *XD, *BC, *SO, *SE, *TI, *TE;
  static char *VS, *VE, *US, *UE;
  static int SG;
  static char PC = '\0';
--- 23,29 -----
  	short ospeed;		/* terminal baudrate; used by tputs */
  #endif
  static char tbuf[512];
! static char *HO, *CL, *CE, *CM, *ND, *XD, *SO, *SE, *TI, *TE;
  static char *VS, *VE, *US, *UE;
  char *BC, *UP;
  static int SG;
**************
*** 20,25
  static char tbuf[512];
  static char *HO, *CL, *CE, *UP, *CM, *ND, *XD, *BC, *SO, *SE, *TI, *TE;
  static char *VS, *VE, *US, *UE;
  static int SG;
  static char PC = '\0';
  char *CD;		/* tested in pri.c: docorner() */
--- 25,31 -----
  static char tbuf[512];
  static char *HO, *CL, *CE, *CM, *ND, *XD, *SO, *SE, *TI, *TE;
  static char *VS, *VE, *US, *UE;
+ char *BC, *UP;
  static int SG;
  char PC = '\0';
  char *CD;		/* tested in pri.c: docorner() */
**************
*** 21,27
  static char *HO, *CL, *CE, *UP, *CM, *ND, *XD, *BC, *SO, *SE, *TI, *TE;
  static char *VS, *VE, *US, *UE;
  static int SG;
! static char PC = '\0';
  char *CD;		/* tested in pri.c: docorner() */
  int CO, LI;		/* used in pri.c and whatis.c */
  
--- 27,33 -----
  static char *VS, *VE, *US, *UE;
  char *BC, *UP;
  static int SG;
! char PC = '\0';
  char *CD;		/* tested in pri.c: docorner() */
  int CO, LI;		/* used in pri.c and whatis.c */
  
SHAR_EOF
cat << \SHAR_EOF > unixmain.c.diff
*** unixmain.c.orig
--- unixmain.c
**************
*** 12,18
  #define	gamename	"NetHack"
  #endif
  
! extern char *getlogin(), *getenv();
  extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
  
  int (*afternmv)();
--- 12,21 -----
  #define	gamename	"NetHack"
  #endif
  
! #ifndef OSK
! extern char *getlogin();
! #endif
! extern char *getenv();
  extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
  
  int (*afternmv)();
**************
*** 101,106
  	cls();
  	u.uhp = 1;	/* prevent RIP on early quits */
  	u.ux = FAR;	/* prevent nscr() */
  	(void) signal(SIGHUP, hangup);
  
  	/*
--- 104,110 -----
  	cls();
  	u.uhp = 1;	/* prevent RIP on early quits */
  	u.ux = FAR;	/* prevent nscr() */
+ #ifndef OSK
  	(void) signal(SIGHUP, hangup);
  #endif
  
**************
*** 102,107
  	u.uhp = 1;	/* prevent RIP on early quits */
  	u.ux = FAR;	/* prevent nscr() */
  	(void) signal(SIGHUP, hangup);
  
  	/*
  	 * Find the creation date of this game,
--- 106,112 -----
  	u.ux = FAR;	/* prevent nscr() */
  #ifndef OSK
  	(void) signal(SIGHUP, hangup);
+ #endif
  
  	/*
  	 * Find the creation date of this game,
**************
*** 125,130
  		switch(argv[0][1]){
  #ifdef WIZARD
  		case 'D':
  			if(!strcmp(getlogin(), WIZARD))
  				wizard = TRUE;
  			else {
--- 130,138 -----
  		switch(argv[0][1]){
  #ifdef WIZARD
  		case 'D':
+ #ifdef OSK
+ 			if(!strcmp(getenv("USER"), WIZARD))
+ #else
  			if(!strcmp(getlogin(), WIZARD))
  #endif
  				wizard = TRUE;
**************
*** 126,131
  #ifdef WIZARD
  		case 'D':
  			if(!strcmp(getlogin(), WIZARD))
  				wizard = TRUE;
  			else {
  				settty("Sorry, you can't operate in debug mode.\n");
--- 134,140 -----
  			if(!strcmp(getenv("USER"), WIZARD))
  #else
  			if(!strcmp(getlogin(), WIZARD))
+ #endif
  				wizard = TRUE;
  			else {
  				settty("Sorry, you can't operate in debug mode.\n");
**************
*** 187,192
  		 * check for multiple games under the same name
  		 * (if !locknum) or check max nr of players (otherwise)
  		 */
  		(void) signal(SIGQUIT,SIG_IGN);
  		(void) signal(SIGINT,SIG_IGN);
  		if(!locknum)
--- 196,202 -----
  		 * check for multiple games under the same name
  		 * (if !locknum) or check max nr of players (otherwise)
  		 */
+ #ifndef OSK
  		(void) signal(SIGQUIT,SIG_IGN);
  		(void) signal(SIGINT,SIG_IGN);
  #endif
**************
*** 189,194
  		 */
  		(void) signal(SIGQUIT,SIG_IGN);
  		(void) signal(SIGINT,SIG_IGN);
  		if(!locknum)
  			(void) strcpy(lock,plname);
  		getlock();	/* sets lock if locknum != 0 */
--- 199,205 -----
  #ifndef OSK
  		(void) signal(SIGQUIT,SIG_IGN);
  		(void) signal(SIGINT,SIG_IGN);
+ #endif
  		if(!locknum)
  			(void) strcpy(lock,plname);
  		getlock();	/* sets lock if locknum != 0 */
**************
*** 225,230
  	setftty();
  	(void) sprintf(SAVEF, "save/%d%s", getuid(), plname);
  	regularize(SAVEF+5);		/* avoid . or / in name */
  	if((fd = open(SAVEF,0)) >= 0 &&
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
  		(void) signal(SIGINT,done1);
--- 236,244 -----
  	setftty();
  	(void) sprintf(SAVEF, "save/%d%s", getuid(), plname);
  	regularize(SAVEF+5);		/* avoid . or / in name */
+ #ifdef OSK
+ 	if((fd = open(SAVEF, S_IREAD)) >= 0 &&
+ #else
  	if((fd = open(SAVEF,0)) >= 0 &&
  #endif
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
**************
*** 226,231
  	(void) sprintf(SAVEF, "save/%d%s", getuid(), plname);
  	regularize(SAVEF+5);		/* avoid . or / in name */
  	if((fd = open(SAVEF,0)) >= 0 &&
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
  		(void) signal(SIGINT,done1);
  		pline("Restoring old save file...");
--- 240,246 -----
  	if((fd = open(SAVEF, S_IREAD)) >= 0 &&
  #else
  	if((fd = open(SAVEF,0)) >= 0 &&
+ #endif
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
  #ifndef OSK
  		(void) signal(SIGINT,done1);
**************
*** 227,232
  	regularize(SAVEF+5);		/* avoid . or / in name */
  	if((fd = open(SAVEF,0)) >= 0 &&
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
  		(void) signal(SIGINT,done1);
  		pline("Restoring old save file...");
  		(void) fflush(stdout);
--- 242,248 -----
  	if((fd = open(SAVEF,0)) >= 0 &&
  #endif
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
+ #ifndef OSK
  		(void) signal(SIGINT,done1);
  #endif
  		pline("Restoring old save file...");
**************
*** 228,233
  	if((fd = open(SAVEF,0)) >= 0 &&
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
  		(void) signal(SIGINT,done1);
  		pline("Restoring old save file...");
  		(void) fflush(stdout);
  		if(!dorecover(fd))
--- 244,250 -----
  	   (uptodate(fd) || unlink(SAVEF) == 666)) {
  #ifndef OSK
  		(void) signal(SIGINT,done1);
+ #endif
  		pline("Restoring old save file...");
  		(void) fflush(stdout);
  		if(!dorecover(fd))
**************
*** 501,506
  
  	    if(dir == NULL)
  		dir = ".";
  	    if((fd = open(RECORD, 2)) < 0) {
  		printf("Warning: cannot write %s/%s", dir, RECORD);
  		getret();
--- 518,526 -----
  
  	    if(dir == NULL)
  		dir = ".";
+ #ifdef OSK
+ 	    if((fd = open(RECORD, S_IWRITE)) < 0) {
+ #else
  	    if((fd = open(RECORD, 2)) < 0) {
  #endif
  		printf("Warning: cannot write %s/%s", dir, RECORD);
**************
*** 502,507
  	    if(dir == NULL)
  		dir = ".";
  	    if((fd = open(RECORD, 2)) < 0) {
  		printf("Warning: cannot write %s/%s", dir, RECORD);
  		getret();
  	    } else
--- 522,528 -----
  	    if((fd = open(RECORD, S_IWRITE)) < 0) {
  #else
  	    if((fd = open(RECORD, 2)) < 0) {
+ #endif
  		printf("Warning: cannot write %s/%s", dir, RECORD);
  		getret();
  	    } else
**************
*** 543,548
  		(void) strncpy(plname, s, sizeof(plname)-1);
  	if(!*plname && (s = getenv("LOGNAME")))
  		(void) strncpy(plname, s, sizeof(plname)-1);
  	if(!*plname && (s = getlogin()))
  		(void) strncpy(plname, s, sizeof(plname)-1);
  }
--- 564,570 -----
  		(void) strncpy(plname, s, sizeof(plname)-1);
  	if(!*plname && (s = getenv("LOGNAME")))
  		(void) strncpy(plname, s, sizeof(plname)-1);
+ #ifndef OSK
  	if(!*plname && (s = getlogin()))
  		(void) strncpy(plname, s, sizeof(plname)-1);
  #endif
**************
*** 545,550
  		(void) strncpy(plname, s, sizeof(plname)-1);
  	if(!*plname && (s = getlogin()))
  		(void) strncpy(plname, s, sizeof(plname)-1);
  }
  
  newgame() {
--- 567,573 -----
  #ifndef OSK
  	if(!*plname && (s = getlogin()))
  		(void) strncpy(plname, s, sizeof(plname)-1);
+ #endif
  }
  
  newgame() {
**************
*** 556,561
  	init_objects();
  	u_init();
  
  	(void) signal(SIGINT,done1);
  	mklev();
  	u.ux = xupstair;
--- 579,585 -----
  	init_objects();
  	u_init();
  
+ #ifndef OSK
  	(void) signal(SIGINT,done1);
  #endif
  	mklev();
**************
*** 557,562
  	u_init();
  
  	(void) signal(SIGINT,done1);
  	mklev();
  	u.ux = xupstair;
  	u.uy = yupstair;
--- 581,587 -----
  
  #ifndef OSK
  	(void) signal(SIGINT,done1);
+ #endif
  	mklev();
  	u.ux = xupstair;
  	u.uy = yupstair;
SHAR_EOF
cat << \SHAR_EOF > vault.c.diff
*** vault.c.orig
--- vault.c
**************
*** 22,28
  struct egd {
  	int fcbeg, fcend;	/* fcend: first unused pos */
  	xchar gdx, gdy;		/* goal of guard's walk */
! 	unsigned gddone:1;
  	struct fakecorridor fakecorr[FCSIZ];
  };
  
--- 22,28 -----
  struct egd {
  	int fcbeg, fcend;	/* fcend: first unused pos */
  	xchar gdx, gdy;		/* goal of guard's walk */
! 	Bitfield(gddone,1);
  	struct fakecorridor fakecorr[FCSIZ];
  };
  
SHAR_EOF
cat << \SHAR_EOF > version.c.diff
*** version.c.orig
--- version.c
**************
*** 17,22
  #ifdef MSDOS
  		"PC"
  #endif
  #ifdef QUEST
  		, "Quest"
  #else
--- 17,25 -----
  #ifdef MSDOS
  		"PC"
  #endif
+ #ifdef OSK
+ 		"OSK"
+ #endif
  #ifdef QUEST
  		, "Quest"
  #else
**************
*** 41,46
  #endif
  #ifdef MSDOS
  		"PC"
  #endif
  #ifdef QUEST
  		, "Quest");
--- 44,52 -----
  #endif
  #ifdef MSDOS
  		"PC"
+ #endif
+ #ifdef	OSK
+ 		"OSK"
  #endif
  #ifdef QUEST
  		, "Quest");
SHAR_EOF
cat << \SHAR_EOF > write.c.diff
*** write.c.orig
--- write.c
**************
*** 140,147
  		return(1);
  	}
  	pen->spe -= actualcost;
! # ifdef KAA /* Since the KAA modification allows writing on unknown blank
! 		paper, identify blank paper. */
  	objects[SCR_BLANK_PAPER].oc_name_known=1;
  # endif
  	
--- 140,147 -----
  		return(1);
  	}
  	pen->spe -= actualcost;
! # ifdef KAA /* Since the KAA modification allows writing on unknown blank */
! 	    /*	paper, identify blank paper. */
  	objects[SCR_BLANK_PAPER].oc_name_known=1;
  # endif
  	
SHAR_EOF
#	End of shell archive
exit 0
Bob Larson	Arpa: Blarson@Ecla.Usc.Edu	blarson@skat.usc.edu
Uucp: {sdcrdcf,cit-vax}!oberon!skat!blarson
Prime mailing list:	info-prime-request%fns1@ecla.usc.edu
			oberon!fns1!info-prime-request