diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..667c67c --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,4 @@ +rogue: curses.c 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 + gcc -DLINUX -DUNIX -g $^ -lcurses -o $@ diff --git a/hit.c b/hit.c index 4a43706..8f74354 100644 --- a/hit.c +++ b/hit.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)hit.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include "rogue.h" object *fight_monster = 0; diff --git a/init.c b/init.c index 3b2da17..1725876 100644 --- a/init.c +++ b/init.c @@ -51,6 +51,7 @@ static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; */ #include +#include #include "rogue.h" char login_name[MAX_OPT_LEN]; diff --git a/inventory.c b/inventory.c index 1a7bb26..c407be2 100644 --- a/inventory.c +++ b/inventory.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include "rogue.h" boolean is_wood[WANDS]; @@ -412,14 +413,14 @@ int ch; mix_colors() { short i, j, k; - char *t; + char t[40]; for (i = 0; i <= 32; i++) { j = get_rand(0, (POTIONS - 1)); k = get_rand(0, (POTIONS - 1)); - t = id_potions[j].title; - id_potions[j].title = id_potions[k].title; - id_potions[k].title = t; + strcpy(t, id_potions[j].title); + strcpy(id_potions[j].title, id_potions[k].title); + strcpy(id_potions[k].title, t); } } diff --git a/machdep.c b/machdep.c index 26e378b..e5868f9 100644 --- a/machdep.c +++ b/machdep.c @@ -107,6 +107,13 @@ static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93"; #include #endif +#ifdef LINUX +#include +#include +#include +#include +#endif + #include #include "rogue.h" #include "pathnames.h" @@ -125,7 +132,9 @@ static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93"; md_slurp() { +#ifndef LINUX (void) fpurge(stdin); +#endif } /* md_control_keyboard(): @@ -464,11 +473,7 @@ char * md_malloc(n) int n; { - char *malloc(); - char *t; - - t = malloc(n); - return (t); + return malloc(n); } /* md_gseed() (Get Seed) @@ -558,7 +563,7 @@ char *shell; uid = getuid(); setuid(uid); - execl(shell, shell, 0); + execl(shell, shell, 0, NULL); } wait(w); } diff --git a/message.c b/message.c index 00f949f..7564537 100644 --- a/message.c +++ b/message.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include #include "rogue.h" diff --git a/move.c b/move.c index a80ef11..fe3ddd6 100644 --- a/move.c +++ b/move.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include "rogue.h" short m_moves = 0; diff --git a/pack.c b/pack.c index 7ed3dd9..d1c817f 100644 --- a/pack.c +++ b/pack.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include "rogue.h" char *curse_message = "you can't, it appears to be cursed"; diff --git a/rogue.h b/rogue.h index 3126f23..12a1bd9 100644 --- a/rogue.h +++ b/rogue.h @@ -192,8 +192,8 @@ struct id { short value; - char *title; - char *real; + char title[40]; + char real[40]; unsigned short id_status; }; diff --git a/room.c b/room.c index fbb40a0..100faf3 100644 --- a/room.c +++ b/room.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include "rogue.h" room rooms[MAXROOMS]; diff --git a/save.c b/save.c index ff609be..6bd9d93 100644 --- a/save.c +++ b/save.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include #include "rogue.h" diff --git a/score.c b/score.c index 9dc85a0..bdfe0e6 100644 --- a/score.c +++ b/score.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include #include "rogue.h" #include "pathnames.h" @@ -336,7 +337,7 @@ object *monster; } } } - sprintf(buf, "%2d %6d %s: ", rank + 1, rogue.gold, login_name); + sprintf(buf, "%2d %6ld %s: ", rank + 1, rogue.gold, login_name); if (other) { switch (other) { diff --git a/throw.c b/throw.c index bbf958b..c4ecd33 100644 --- a/throw.c +++ b/throw.c @@ -56,7 +56,9 @@ extern short cur_room; extern char *curse_message; extern char hit_message[]; -throw () +int rand_around(short i, short *r, short *c); + +void throw(void) { short wch, d; boolean first_miss = 1; @@ -261,10 +263,9 @@ short row, col; } } -rand_around(i, r, c) -short i, *r, *c; +int rand_around(short i, short *r, short *c) { - static char* pos = "\010\007\001\003\004\005\002\006\0"; + static char pos[] = "\010\007\001\003\004\005\002\006\0"; static short row, col; short j; diff --git a/zap.c b/zap.c index 8cfe048..eb8bf09 100644 --- a/zap.c +++ b/zap.c @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93"; * */ +#include #include "rogue.h" boolean wizard = 0;