Skip to content

Commit

Permalink
Fix linux build and obvious execution problems
Browse files Browse the repository at this point in the history
  • Loading branch information
dlowe-net committed Aug 30, 2014
1 parent 62fa9f0 commit e7b770d
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 17 deletions.
4 changes: 4 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -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 $@
1 change: 1 addition & 0 deletions hit.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)hit.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include "rogue.h"

object *fight_monster = 0;
Expand Down
1 change: 1 addition & 0 deletions init.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
*/

#include <stdio.h>
#include <string.h>
#include "rogue.h"

char login_name[MAX_OPT_LEN];
Expand Down
9 changes: 5 additions & 4 deletions inventory.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include "rogue.h"

boolean is_wood[WANDS];
Expand Down Expand Up @@ -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);
}
}

Expand Down
17 changes: 11 additions & 6 deletions machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93";
#include <termio.h>
#endif

#ifdef LINUX
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <termio.h>
#endif

#include <signal.h>
#include "rogue.h"
#include "pathnames.h"
Expand All @@ -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():
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -558,7 +563,7 @@ char *shell;

uid = getuid();
setuid(uid);
execl(shell, shell, 0);
execl(shell, shell, 0, NULL);
}
wait(w);
}
Expand Down
1 change: 1 addition & 0 deletions message.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include <stdio.h>
#include "rogue.h"

Expand Down
1 change: 1 addition & 0 deletions move.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include "rogue.h"

short m_moves = 0;
Expand Down
1 change: 1 addition & 0 deletions pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include "rogue.h"

char *curse_message = "you can't, it appears to be cursed";
Expand Down
4 changes: 2 additions & 2 deletions rogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@

struct id {
short value;
char *title;
char *real;
char title[40];
char real[40];
unsigned short id_status;
};

Expand Down
1 change: 1 addition & 0 deletions room.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include "rogue.h"

room rooms[MAXROOMS];
Expand Down
1 change: 1 addition & 0 deletions save.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include <stdio.h>
#include "rogue.h"

Expand Down
3 changes: 2 additions & 1 deletion score.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include <stdio.h>
#include "rogue.h"
#include "pathnames.h"
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions throw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions zap.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93";
*
*/

#include <string.h>
#include "rogue.h"

boolean wizard = 0;
Expand Down

0 comments on commit e7b770d

Please sign in to comment.