diff --git a/rogue/Makefile b/rogue/Makefile index 380c626..8f26101 100644 --- a/rogue/Makefile +++ b/rogue/Makefile @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.22 2023/06/03 09:09:09 lukem Exp $ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# +OBJ = hit.o init.o inventory.o level.o machdep.o main.o message.o monster.o \ + move.o object.o pack.o play.o random.o ring.o room.o save.o score.o \ + spec_hit.o throw.o trap.o use.o zap.o -CFLAGS += -DUNIX -lcurses -SRC = hit.c init.c inventory.c level.c machdep.c main.c message.c monster.c \ - move.c object.c pack.c play.c random.c ring.c room.c save.c score.c \ - spec_hit.c throw.c trap.c use.c zap.c +rogue: $(OBJ) + $(CC) $(CFLAGS) -lcurses -o $@ $(OBJ) -rogue: $(SRC) - $(CC) $(CFLAGS) -o rogue $(SRC) +clean: + rm -f $(OBJ) rogue + +.PHONY: clean diff --git a/rogue/init.c b/rogue/init.c index c95cc68..01653e2 100644 --- a/rogue/init.c +++ b/rogue/init.c @@ -93,7 +93,7 @@ init(int argc, char *argv[]) { char *ps; struct passwd *p; - if((p = getpwuid(getuid())) != NULL + if((p = getpwuid(getuid())) == NULL || strlen(p->pw_name) >= (sizeof login_name) / (sizeof *login_name)) diff --git a/rogue/machdep.c b/rogue/machdep.c index 2f07ed7..1790095 100644 --- a/rogue/machdep.c +++ b/rogue/machdep.c @@ -44,64 +44,14 @@ * */ -/* Included in this file are all system dependent routines. Extensive use - * of #ifdef's will be used to compile the appropriate code on each system: - * - * UNIX: all UNIX systems. - * UNIX_BSD4_2: UNIX BSD 4.2 and later, UTEK, (4.1 BSD too?) - * UNIX_SYSV: UNIX system V - * UNIX_V7: UNIX version 7 - * - * All UNIX code should be included between the single "#ifdef UNIX" at the - * top of this file, and the "#endif" at the bottom. - * - * To change a routine to include a new UNIX system, simply #ifdef the - * existing routine, as in the following example: - * - * To make a routine compatible with UNIX system 5, change the first - * function to the second: - * - * md_function() - * { - * code; - * } - * - * md_function() - * { - * #ifdef UNIX_SYSV - * sys5code; - * #else - * code; - * #endif - * } - * - * Appropriate variations of this are of course acceptable. - * The use of "#elseif" is discouraged because of non-portability. - * If the correct #define doesn't exist, "UNIX_SYSV" in this case, make it up - * and insert it in the list at the top of the file. Alter the CFLAGS - * in you Makefile appropriately. - * - */ - #include #include -#ifdef UNIX - #include #include #include #include #include - -#ifdef UNIX_BSD4_2 -#include -#endif - -#ifdef UNIX_SYSV -#include -#endif - #include #include #include @@ -463,5 +413,3 @@ md_shell(const char *shell) break; } } - -#endif /* UNIX */ diff --git a/rogue/machdep.h b/rogue/machdep.h new file mode 100644 index 0000000..e65aa8f --- /dev/null +++ b/rogue/machdep.h @@ -0,0 +1,18 @@ +#include "rogue.h" +#include "pathnames.h" + +void md_slurp(void); +void md_heed_signals(void); +void md_ignore_signals(void); +int md_get_file_id(const char *fname); +int md_link_count(const char *fname); +void md_gct(struct rogue_time *rt_buf); +void md_gfmt(const char *fname, struct rogue_time *rt_buf); +boolean md_df(const char *fname); +void md_sleep(int nsecs); +char *md_getenv(const char *name); +void *md_malloc(size_t n); +int md_gseed(void); +void md_exit(int status); +void md_lock(boolean l); +void md_shell(const char *shell); diff --git a/rogue/play.c b/rogue/play.c index 65481b1..f987946 100644 --- a/rogue/play.c +++ b/rogue/play.c @@ -158,23 +158,23 @@ play_level(void) break; } draw_magic_map(); break; - case '\024': if(!wizard) + case '\024': if(!wizard){ messagef(0, "%s", unknown_command); break; } show_traps(); break; - case '\017': if(!wizard) + case '\017': if(!wizard){ messagef(0, "%s", unknown_command); break; } show_objects(); break; case '\001': show_average_hp(); break; - case '\003': if(!wizard) + case '\003': if(!wizard){ messagef(0, "%s", unknown_command); break; } c_object_for_wizard(); break; - case '\015': if(!wizard) + case '\015': if(!wizard){ messagef(0, "%s", unknown_command); break; }