summaryrefslogtreecommitdiff
path: root/games/level9/patches/patch-aa
blob: 04bfb6121f9c60b1f4b681b695cb49225d5db388 (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
$NetBSD: patch-aa,v 1.3 2013/10/13 10:19:22 wiz Exp $

--- unix-curses.c.orig	2011-05-29 07:39:50.000000000 +0000
+++ unix-curses.c
@@ -9,11 +9,6 @@
  *
  * A few notes on this port:
  *
- * I've modified level9.h to use the LITTLEENDIAN macro -- it assumes this if
- *  you're using DOS or Windows, otherwise it uses the byte sex macros. This
- *  shouldn't hurt a little-endian machine (Intel), but you must undefine
- *  LITTLEENDIAN if you've got a Motorola-type machine.
- *
  * If you don't specify a path, level9 Linux will look first in the directory
  *  $LEVEL9DIR, if defined, and then in the current directory.
  *
@@ -38,11 +33,6 @@
 #define FILE_DELIM   '/'
 
 /*
- * Set this if you are compiling on a little-endian machine (ARM, Intel)
- */
-#define LITTLEENDIAN 1
-
-/*
  * Define this as 1 to get the Emacs-type key bindings
  *  Ctrl-A (go to beginning of line)
  *  Ctrl-B (back one character)
@@ -88,7 +78,7 @@ extern FILE* scriptfile;
 /*
  * You might have to change this if not using ncurses
  */
-#include <ncurses/curses.h>
+#include <curses.h>
 
 
 #define CTRL_A '\x01'
@@ -773,25 +763,11 @@ int main (int argc, char *argv [])
   char gamename [256];
   char *envbuf;
   L9BOOL gotgame;
+  char bp[1024];
 
   /*
    * Check byte sex
    */
-# if LITTLEENDIAN
-  L9UINT32 test = 0x12345678;
-  char *tcp = (char *) &test;
-# else
-  L9UINT32 test = 0x78563412;
-  char *tcp = (char *) &test;
-# endif
-  if ((tcp [0] != 0x78) || (tcp [1] != 0x56) ||
-      (tcp [2] != 0x34) || (tcp [3] != 0x12))
-  {
-    fprintf (stderr, "%s: compiled with the wrong byte sex!\n"
-	             " Check the LITTLEENDIAN macro in os/unix-curses.c\n",
-	             argv [0]);
-    exit (1);
-  }
 
   if (argc != 2)
   {
@@ -820,8 +796,9 @@ int main (int argc, char *argv [])
   /*
    * Get the terminal characteristics for line width and More prompt
    */
+  tgetent(bp, getenv("TERM"));
   Line_width  = tgetnum ("co");
-  if (Line_width == ERR)
+  if ((Line_width == -1) || (Line_width == ERR))
   {
     fprintf (stderr, "Couldn't get terminal width---falling back on good old"
 	             " 80 columns\n\n");
@@ -829,7 +806,7 @@ int main (int argc, char *argv [])
   }
 
   More_lines = tgetnum ("li");
-  if (More_lines == ERR)
+  if ((More_lines == -1) || (More_lines == ERR))
   {
     fprintf (stderr, "Couldn't get terminal height---guessing\n\n");
     More_lines = 24;