Updated to compile and run

This commit is contained in:
Neale Pickett 2013-07-18 12:40:47 -06:00
parent 11cf2fc4fa
commit 3b36a6aac2
7 changed files with 16 additions and 162 deletions

113
Makefile
View File

@ -1,113 +1,16 @@
#
# Makefile for network
# @(#)Makefile 4.21 (Berkeley) 02/04/99
#
HDRS= netprot.h network.h netwait.h
DOBJS= terminal.o rmove.o network.o netprot.o rwrite.o rread.o \
OBJS = terminal.o rmove.o network.o netprot.o rwrite.o rread.o \
sendit.o continue.o rinit.o control.o error.o rmap.o edit.o \
rexec.o master.o handle.o pipes.o packet.o socket.o ether.o \
netmap.o startup.o solve.o data.o signal.o rcopy.o \
system.o ctlmod.o
OBJS= $(DOBJS) find.o inter.o
CFILES= terminal.c rmove.c network.c netprot.c rwrite.c rread.c \
sendit.c continue.c rinit.c control.c error.c rmap.c edit.c \
rexec.c master.c handle.c pipes.c packet.c socket.c ether.c \
netmap.c inter.c startup.c solve.c data.c signal.c rcopy.c \
system.c ctlmod.c find.c
MISC_C= ropen.c netwait.c netmisc.c
MISC= Makefile $(MISC_C)
system.o ctlmod.o \
find.o inter.o
DEFS= -DMASTER -DDUMP -DALLSCORES -DUSE_OLD_TTY
CFLAGS= -g $(DEFS)
#CFLAGS= -Bcpp/ -tp -O $(DEFS)
PROFLAGS= -pg -O
#LDFLAGS= -i # For PDP-11's
LDFLAGS= -g # For VAXen
CRLIB= -lncurses
#CRLIB= -lcurses
#CRLIB= libcurses.a
LDFLAGS = -lncurses -lcrypt
#SCOREFILE= /usr/public/n_rogue_roll
SCOREFILE= /usr/games/rogue.scores
#SCOREFILE= ./net_hist
SF= -DSCOREFILE='"$(SCOREFILE)"'
NAMELIST= /vmunix
NL= -DNAMELIST='"$(NAMELIST)"'
#MACHDEP= -DMAXLOAD=40 -DLOADAV -DCHECKTIME=4
default: rogue
LD= ld
VGRIND= /usr/ucb/vgrind
# for sites without sccs front end, GET= get
GET= sccs get
# Use ansi flag to gcc
#CC = gcc -ansi
CC = cc
.DEFAULT:
$(GET) $@
a.out: $(HDRS) $(OBJS)
-rm -f a.out
@rm -f x.c
-$(CC) $(LDFLAGS) $(OBJS) $(CRLIB)
# -$(CC) $(LDFLAGS) $(OBJS) $(CRLIB) -ltermlib
# -$(CC) $(LDFLAGS) $(OBJS) $(CRLIB) -lcrypt
size a.out
# @echo -n 'You still have to remove ' # 11/70's
# @size a.out | sed 's/+.*/ 1024 63 * - p/' | dc # 11/70's
terminal.o:
$(CC) -c $(CFLAGS) terminal.c
find.o: find.c
$(CC) -c $(CFLAGS) $(SF) $(NL) $(MACHDEP) find.c
inter.o: inter.c
$(CC) -c $(CFLAGS) $(SF) $(NL) $(MACHDEP) inter.c
network: newvers a.out
cp a.out network
strip network
ropen: ropen.c
$(CC) -s -o ropen ropen.c
netwait: netwait.o netmisc.o terminal.o
$(CC) -s -o netwait terminal.o netwait.o netmisc.o -lcurses
netmisc.o netwait.o:
$(CC) -O -c $(SF) $*.c
newvers:
$(GET) -e terminal.c
sccs delta -y terminal.c
flist: $(HDRS) $(CFILES) $(MISC_C)
-mv flist tags
ctags -u $?
ed - tags < :rofix
sort tags -o flist
rm -f tags
lint:
/bin/csh -c "lint -hxbc $(DEFS) $(MACHDEP) $(SF) $(NL) $(CFILES) -lcurses > linterrs"
rogue: $(OBJS)
$(CC) -o $@ $(LDFLAGS) $^
clean:
rm -f $(OBJS) core a.out p.out network strings ? network.tar vgrind.* x.c x.o xs.c linterrs ropen
xtar: $(HDRS) $(CFILES) $(MISC)
rm -f network.tar
tar cf network.tar $? :rofix
touch xtar
vgrind:
@csh $(VGRIND) -t -h "Rogue Version 3.7" $(HDRS) *.c > vgrind.out
@ctags -v $(HDRS) *.c > index
@csh $(VGRIND) -t -x index > vgrind.out.tbl
wc:
@echo " bytes words lines pages file"
@wc -cwlp $(HDRS) $(CFILES)
cfiles: $(CFILES)
rm -f $(OBJS) rogue

1
find.c
View File

@ -119,7 +119,6 @@ setup(void)
signal(SIGILL, auto_save);
signal(SIGTRAP, auto_save);
signal(SIGIOT, auto_save);
signal(SIGEMT, auto_save);
signal(SIGFPE, auto_save);
signal(SIGBUS, auto_save);
signal(SIGSEGV, auto_save);

View File

@ -51,6 +51,9 @@ static char *Rip[] = {
void
score(int amount, int flags, char monst)
{
#ifndef SCOREFILE
return;
#else
SCORE *scp;
int i;
SCORE *sc2;
@ -124,6 +127,7 @@ score(int amount, int flags, char monst)
close(Fd);
Fd = open(SCOREFILE, O_RDWR);
outf = fdopen(Fd, "w");
/*
* Insert her in list if need be
*/
@ -238,6 +242,7 @@ score(int amount, int flags, char monst)
}
}
fclose(outf);
#endif SCOREFILE
}
/*

View File

@ -35,7 +35,7 @@ extern int Fd;
#ifdef TIOCGLTC
extern struct ltchars Ltc;
#endif TIOCGLTC
#endif /* TIOCGLTC */
/*
* Function types

54
rmap.c
View File

@ -30,7 +30,6 @@ main(int argc, char **argv, char **envp)
signal(SIGILL, exit);
signal(SIGTRAP, exit);
signal(SIGIOT, exit);
signal(SIGEMT, exit);
signal(SIGFPE, exit);
signal(SIGBUS, exit);
signal(SIGSEGV, exit);
@ -352,59 +351,6 @@ leave(int sig)
my_exit(0);
}
/*
* shell:
* Let them escape for a while
*/
void
shell(void)
{
int pid;
char *sh;
int ret_status;
/*
* Set the terminal back to original mode
*/
move(LINES-1, 0);
refresh();
endwin();
resetltchars();
putchar('\n');
In_shell = TRUE;
After = FALSE;
sh = getenv("SHELL");
fflush(stdout);
/*
* Fork and do a shell
*/
while ((pid = fork()) < 0)
sleep(1);
if (pid == 0)
{
execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0);
perror("No shelly");
exit(-1);
}
else
{
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
while (wait(&ret_status) != pid)
continue;
signal(SIGINT, quit);
signal(SIGQUIT, endit);
printf("\n[Press return to continue]");
fflush(stdout);
noecho();
crmode();
playltchars();
In_shell = FALSE;
wait_for('\n');
clearok(stdscr, TRUE);
}
}
/*
* my_exit:
* Leave the process properly

View File

@ -164,7 +164,6 @@ over:
msg("not standing on any object");
}
}
when '!': shell();
when 'h': do_move(0, -1);
when 'j': do_move(1, 0);
when 'k': do_move(-1, 0);

View File

@ -358,6 +358,7 @@ encread(char *start, unsigned int size, int inf)
}
}
#ifdef SCOREFILE
/*
* read_scrore
* Read in the score file
@ -375,3 +376,4 @@ wr_score(SCORE *top_ten, FILE *outf)
{
encwrite((char *) top_ten, numscores * sizeof (SCORE), outf);
}
#endif