1
0

incremental build

This commit is contained in:
dtb 2023-11-25 09:42:59 -07:00
parent b5c73d1fc4
commit 8a79df5a32
5 changed files with 32 additions and 66 deletions

View File

@ -1,11 +1,11 @@
# $NetBSD: Makefile,v 1.22 2023/06/03 09:09:09 lukem Exp $ OBJ = hit.o init.o inventory.o level.o machdep.o main.o message.o monster.o \
# @(#)Makefile 8.1 (Berkeley) 5/31/93 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 rogue: $(OBJ)
SRC = hit.c init.c inventory.c level.c machdep.c main.c message.c monster.c \ $(CC) $(CFLAGS) -lcurses -o $@ $(OBJ)
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: $(SRC) clean:
$(CC) $(CFLAGS) -o rogue $(SRC) rm -f $(OBJ) rogue
.PHONY: clean

View File

@ -93,7 +93,7 @@ init(int argc, char *argv[])
{ {
char *ps; char *ps;
struct passwd *p; struct passwd *p;
if((p = getpwuid(getuid())) != NULL if((p = getpwuid(getuid())) == NULL
|| strlen(p->pw_name) || strlen(p->pw_name)
>= (sizeof login_name) >= (sizeof login_name)
/ (sizeof *login_name)) / (sizeof *login_name))

View File

@ -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 <time.h> #include <time.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef UNIX
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <pwd.h> #include <pwd.h>
#ifdef UNIX_BSD4_2
#include <sys/time.h>
#endif
#ifdef UNIX_SYSV
#include <time.h>
#endif
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <termios.h> #include <termios.h>
@ -463,5 +413,3 @@ md_shell(const char *shell)
break; break;
} }
} }
#endif /* UNIX */

18
rogue/machdep.h Normal file
View File

@ -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);

View File

@ -158,23 +158,23 @@ play_level(void)
break; break;
} }
draw_magic_map(); break; draw_magic_map(); break;
case '\024': if(!wizard) case '\024': if(!wizard){
messagef(0, "%s", unknown_command); messagef(0, "%s", unknown_command);
break; break;
} }
show_traps(); break; show_traps(); break;
case '\017': if(!wizard) case '\017': if(!wizard){
messagef(0, "%s", unknown_command); messagef(0, "%s", unknown_command);
break; break;
} }
show_objects(); break; show_objects(); break;
case '\001': show_average_hp(); break; case '\001': show_average_hp(); break;
case '\003': if(!wizard) case '\003': if(!wizard){
messagef(0, "%s", unknown_command); messagef(0, "%s", unknown_command);
break; break;
} }
c_object_for_wizard(); break; c_object_for_wizard(); break;
case '\015': if(!wizard) case '\015': if(!wizard){
messagef(0, "%s", unknown_command); messagef(0, "%s", unknown_command);
break; break;
} }