rogue

Ken Arnold's Rogue
git clone https://git.woozle.org/neale/rogue.git

commit
3b36a6a
parent
11cf2fc
author
Neale Pickett
date
2013-07-18 12:40:47 -0600 MDT
Updated to compile and run
7 files changed,  +16, -162
M find.c
M rmap.c
M Makefile
+8, -105
  1@@ -1,113 +1,16 @@
  2-#
  3-# Makefile for network
  4-# @(#)Makefile	4.21 (Berkeley) 02/04/99
  5-#
  6-HDRS=	netprot.h network.h netwait.h
  7-DOBJS=	terminal.o rmove.o network.o netprot.o rwrite.o rread.o \
  8+OBJS =	terminal.o rmove.o network.o netprot.o rwrite.o rread.o \
  9 	sendit.o continue.o rinit.o control.o error.o rmap.o edit.o \
 10 	rexec.o master.o handle.o pipes.o packet.o socket.o ether.o \
 11 	netmap.o startup.o solve.o data.o signal.o rcopy.o \
 12-	system.o ctlmod.o
 13-OBJS=	$(DOBJS) find.o inter.o
 14-CFILES=	terminal.c rmove.c network.c netprot.c rwrite.c rread.c \
 15-	sendit.c continue.c rinit.c control.c error.c rmap.c edit.c \
 16-	rexec.c master.c handle.c pipes.c packet.c socket.c ether.c \
 17-	netmap.c inter.c startup.c solve.c data.c signal.c rcopy.c \
 18-	system.c ctlmod.c find.c
 19-MISC_C=	ropen.c netwait.c netmisc.c
 20-MISC=	Makefile $(MISC_C)
 21+	system.o ctlmod.o \
 22+	find.o inter.o
 23 
 24-DEFS=		-DMASTER -DDUMP -DALLSCORES -DUSE_OLD_TTY
 25-CFLAGS=		-g $(DEFS)
 26-#CFLAGS=		-Bcpp/ -tp -O $(DEFS)
 27-PROFLAGS=	-pg -O
 28-#LDFLAGS=	-i	# For PDP-11's
 29-LDFLAGS=	-g	# For VAXen
 30-CRLIB=		-lncurses
 31-#CRLIB=		-lcurses
 32-#CRLIB=		libcurses.a
 33+LDFLAGS = -lncurses -lcrypt
 34 
 35-#SCOREFILE=	/usr/public/n_rogue_roll
 36-SCOREFILE=	/usr/games/rogue.scores
 37-#SCOREFILE=	./net_hist
 38-SF=		-DSCOREFILE='"$(SCOREFILE)"'
 39-NAMELIST=	/vmunix
 40-NL=		-DNAMELIST='"$(NAMELIST)"'
 41-#MACHDEP=	-DMAXLOAD=40 -DLOADAV -DCHECKTIME=4
 42+default: rogue
 43 
 44-LD=	ld
 45-VGRIND=	/usr/ucb/vgrind
 46-# for sites without sccs front end, GET= get
 47-GET=	sccs get
 48-
 49-# Use ansi flag to gcc
 50-#CC = gcc -ansi
 51-CC = cc
 52-
 53-.DEFAULT:
 54-	$(GET) $@
 55-
 56-a.out: $(HDRS) $(OBJS)
 57-	-rm -f a.out
 58-	@rm -f x.c
 59-	-$(CC) $(LDFLAGS) $(OBJS) $(CRLIB)
 60-#	-$(CC) $(LDFLAGS) $(OBJS) $(CRLIB) -ltermlib
 61-#	-$(CC) $(LDFLAGS) $(OBJS) $(CRLIB) -lcrypt
 62-	size a.out
 63-#	@echo -n 'You still have to remove '		# 11/70's
 64-#	@size a.out | sed 's/+.*/ 1024 63 * - p/' | dc	# 11/70's
 65-
 66-terminal.o:
 67-	$(CC) -c $(CFLAGS) terminal.c
 68-
 69-find.o: find.c
 70-	$(CC) -c $(CFLAGS) $(SF) $(NL) $(MACHDEP) find.c
 71-
 72-inter.o: inter.c
 73-	$(CC) -c $(CFLAGS) $(SF) $(NL) $(MACHDEP) inter.c
 74-
 75-network: newvers a.out
 76-	cp a.out network
 77-	strip network
 78-
 79-ropen: ropen.c
 80-	$(CC) -s -o ropen ropen.c
 81-
 82-netwait: netwait.o netmisc.o terminal.o
 83-	$(CC) -s -o netwait terminal.o netwait.o netmisc.o -lcurses
 84-
 85-netmisc.o netwait.o:
 86-	$(CC) -O -c $(SF) $*.c
 87-
 88-newvers:
 89-	$(GET) -e terminal.c
 90-	sccs delta -y terminal.c
 91-
 92-flist: $(HDRS) $(CFILES) $(MISC_C)
 93-	-mv flist tags
 94-	ctags -u $?
 95-	ed - tags < :rofix
 96-	sort tags -o flist
 97-	rm -f tags
 98-
 99-lint:
100-	/bin/csh -c "lint -hxbc $(DEFS) $(MACHDEP) $(SF) $(NL) $(CFILES) -lcurses > linterrs"
101+rogue: $(OBJS)
102+	$(CC) -o $@ $(LDFLAGS) $^
103 
104 clean:
105-	rm -f $(OBJS) core a.out p.out network strings ? network.tar vgrind.* x.c x.o xs.c linterrs ropen
106-
107-xtar: $(HDRS) $(CFILES) $(MISC)
108-	rm -f network.tar
109-	tar cf network.tar $? :rofix
110-	touch xtar
111-
112-vgrind:
113-	@csh $(VGRIND) -t -h "Rogue Version 3.7" $(HDRS) *.c > vgrind.out
114-	@ctags -v $(HDRS) *.c > index
115-	@csh $(VGRIND) -t -x index > vgrind.out.tbl
116-
117-wc:
118-	@echo "  bytes  words  lines  pages file"
119-	@wc -cwlp $(HDRS) $(CFILES)
120-
121-cfiles: $(CFILES)
122+	rm -f $(OBJS) rogue
M find.c
+0, -1
1@@ -119,7 +119,6 @@ setup(void)
2     signal(SIGILL, auto_save);
3     signal(SIGTRAP, auto_save);
4     signal(SIGIOT, auto_save);
5-    signal(SIGEMT, auto_save);
6     signal(SIGFPE, auto_save);
7     signal(SIGBUS, auto_save);
8     signal(SIGSEGV, auto_save);
M inter.c
+5, -0
 1@@ -51,6 +51,9 @@ static char *Rip[] = {
 2 void
 3 score(int amount, int flags, char monst)
 4 {
 5+#ifndef SCOREFILE
 6+  return;
 7+#else
 8     SCORE *scp;
 9     int i;
10     SCORE *sc2;
11@@ -124,6 +127,7 @@ score(int amount, int flags, char monst)
12     close(Fd);
13     Fd = open(SCOREFILE, O_RDWR);
14     outf = fdopen(Fd, "w");
15+
16     /*
17      * Insert her in list if need be
18      */
19@@ -238,6 +242,7 @@ score(int amount, int flags, char monst)
20 	}
21     }
22     fclose(outf);
23+#endif SCOREFILE
24 }
25 
26 /*
M network.h
+1, -1
1@@ -35,7 +35,7 @@ extern int	Fd;
2 
3 #ifdef TIOCGLTC
4 extern struct ltchars	Ltc;
5-#endif TIOCGLTC
6+#endif /* TIOCGLTC */
7 
8 /*
9  * Function types
M rmap.c
+0, -54
 1@@ -30,7 +30,6 @@ main(int argc, char **argv, char **envp)
 2     signal(SIGILL, exit);
 3     signal(SIGTRAP, exit);
 4     signal(SIGIOT, exit);
 5-    signal(SIGEMT, exit);
 6     signal(SIGFPE, exit);
 7     signal(SIGBUS, exit);
 8     signal(SIGSEGV, exit);
 9@@ -352,59 +351,6 @@ leave(int sig)
10     my_exit(0);
11 }
12 
13-/*
14- * shell:
15- *	Let them escape for a while
16- */
17-void
18-shell(void)
19-{
20-    int pid;
21-    char *sh;
22-    int ret_status;
23-
24-    /*
25-     * Set the terminal back to original mode
26-     */
27-    move(LINES-1, 0);
28-    refresh();
29-    endwin();
30-    resetltchars();
31-    putchar('\n');
32-    In_shell = TRUE;
33-    After = FALSE;
34-    sh = getenv("SHELL");
35-    fflush(stdout);
36-    /*
37-     * Fork and do a shell
38-     */
39-    while ((pid = fork()) < 0)
40-	sleep(1);
41-    if (pid == 0)
42-    {
43-	execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0);
44-	perror("No shelly");
45-	exit(-1);
46-    }
47-    else
48-    {
49-	signal(SIGINT, SIG_IGN);
50-	signal(SIGQUIT, SIG_IGN);
51-	while (wait(&ret_status) != pid)
52-	    continue;
53-	signal(SIGINT, quit);
54-	signal(SIGQUIT, endit);
55-	printf("\n[Press return to continue]");
56-	fflush(stdout);
57-	noecho();
58-	crmode();
59-	playltchars();
60-	In_shell = FALSE;
61-	wait_for('\n');
62-	clearok(stdscr, TRUE);
63-    }
64-}
65-
66 /*
67  * my_exit:
68  *	Leave the process properly
M rwrite.c
+0, -1
1@@ -164,7 +164,6 @@ over:
2 			msg("not standing on any object");
3 		    }
4 		}
5-		when '!': shell();
6 		when 'h': do_move(0, -1);
7 		when 'j': do_move(1, 0);
8 		when 'k': do_move(-1, 0);
M solve.c
+2, -0
 1@@ -358,6 +358,7 @@ encread(char *start, unsigned int size, int inf)
 2     }
 3 }
 4 
 5+#ifdef SCOREFILE
 6 /*
 7  * read_scrore
 8  *	Read in the score file
 9@@ -375,3 +376,4 @@ wr_score(SCORE *top_ten, FILE *outf)
10 {
11     encwrite((char *) top_ten, numscores * sizeof (SCORE), outf);
12 }
13+#endif