summaryrefslogtreecommitdiff
path: root/games/ularn/patches/patch-bc
blob: 57bd7e3d4dfb8e3c368d34e0af865d7cb7a7ff9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
$NetBSD: patch-bc,v 1.2 2004/04/15 21:17:08 ben Exp $

--- tok.c.orig	1992-06-19 13:55:30.000000000 -0700
+++ tok.c
@@ -1,4 +1,7 @@
 /* tok.c */
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
 #include "header.h"
 #include "player.h"
 #include "monst.h"
@@ -12,12 +15,12 @@ static char lastok=0;
 int yrepcount=0;
 
 static char usermonster[MAXUM][MAXMNAME];
-static char usermpoint=0;			/* the user monster pointer */
+static int usermpoint=0;			/* the user monster pointer */
 
 /*
  *	lexical analyzer for Ularn
  */
-yylex ()
+int yylex (void)
 {
 	int cc, ic;
 	char *sh, *getenv();
@@ -61,21 +64,25 @@ yylex ()
 		/* shell escape */
 		if (cc == '!')	{
 			int pgrp;
-#ifdef USG
+#if defined(USG) || defined(__NetBSD__) || defined(__linux__)
 			pgrp = getpgrp();
 #else
 			pgrp = getpgrp(getpid());
 #endif /* USG */
 			
 			resetscroll();
-			clear();
+			ularn_clear();
 			cl_dn(0,0);
 			lflush();
 			if ((ic=fork())==0) {
 				settty();
 				setuid(geteuid());
 				setgid(getegid());
+#if defined(__linux__)
+				setpgrp();
+#else
 				setpgrp(getpid(), pgrp);
+#endif
 				if ((sh = getenv("SHELL")) != (char *)NULL) {
 					execl(sh, sh, (char *)0);	
 					if (!strcmp(sh, "/bin/sh")) {
@@ -116,7 +123,7 @@ yylex ()
 /*
  *	flushall()	Function to flush all type-ahead in the input buffer
  */
-flushall()
+void flushall(void)
 {
 #ifdef TCFLSH
         ioctl(0, TCFLSH, 0);		/* standard ioctl to flush buffer */
@@ -143,7 +150,7 @@ flushall()
 	function to set the desired hardness
 	enter with hard= -1 for default hardness, else any desired hardness
 */
-sethard (hard)
+void sethard (hard)
 int hard;
 {
 	int j,k,i;
@@ -157,7 +164,8 @@ int hard;
 			c[HARDGAME] = hard;
 	}
 
-	if (k=c[HARDGAME])
+	k=c[HARDGAME];
+	if (k)
 		for (j=0; j<=MAXMONST+8; j++) {
 			i = ((6+k)*monster[j].hitpoints+1)/6;
 			monster[j].hitpoints = (i > 32767) ? 32767 : i;
@@ -175,7 +183,7 @@ int hard;
 /*
  *	function to read and process the larn options file
  */
-readopts ()
+void readopts (void)
 {
 	char s1buf[80], *str, s2buf[80];
 	char *getword();