I couldn't get it to compile on my NeXT running NS3.3... It requires curses and will use ncurses if available. It's probably something simple to fix to get it to compile. I LOVE playing this game with friends. and having it on my NeXT would be awesome ;)
You can get it here. the file is like 35kb for the sourc.e
http://www.netris.org/
gcc -g -O -c curses.c
curses.c:55: `STDIN_FILENO' undeclared here (not in a function)
curses.c:55: initializer element for `keyGen.fd' is not constant
curses.c: In function `GetTermcapInfo':
curses.c:129: warning: assignment makes pointer from integer without a cast
curses.c:136: warning: assignment makes pointer from integer without a cast
curses.c:152: warning: assignment makes pointer from integer without a cast
make: *** [curses.o] Error 1
Hmmmm... something tricky with the curses/ncurses libs. I'll poke around at it again later.
-Mike
Added: Moving up from gcc 2.72 to the last gcc 2.95
gcc version 2.95.3 20010315 (release)
Fixes a lot of things and with a few hacks it compiles but it will not link.
gcc -o netris game.o curses.o shapes.o board.o util.o inet.o robot.o version.o -lncurses -ltermcap
/bin/ld: Undefined symbols:
_CS
__echoit
__rawmode
__tty
__tty_ch
_touchwin
_waddstr
_wstandend
_wstandout
collect2: ld returned 1 exit status
So close.... I'll play with it again sometime.
-Mike
Missing symbols... hmm, maybe one of the libraries is out of date? (a newer version could have those strings). Use "strings" to find out if those missing symbols are part of the libraries or not. Or perhaps you're forgetting to link against another library?
Looks like the problem was with the Ncurses library I had installed. It doesn't the right symbols. So I edited the Configure file to not try and lookup -lncurses and it was able to build and it works.
Netris version 0.52 (C) 1994-1996,1999 Mark H. Weaver <mhw@netris.org>
Usage: netris <options>
-h Print usage information
-w Wait for connection
-c <host> Initiate connection
-p <port> Set port number (default is 9284)
-k <keys> Remap keys. The argument is a prefix of the string
containing the keys in order: left, rotate, right, drop,
down-faster, toggle-spying, pause, faster, redraw.
"^" prefixes controls. (default is "jkl mspf^l")
-i <sec> Set the step-down interval, in seconds
-r <robot> Execute <robot> (a command) as a robot controlling
the game instead of the keyboard
-F Use fair robot interface
-s <seed> Start with given random seed
-D Drops go into drop mode
This means that sliding off a cliff after a drop causes
another drop automatically
-S Disable inverse/bold/color for slow terminals
-C Disable color
-H Show distribution and warranty information
-R Show rules
Here is what I did to build it.
1) Edit Configure line 80 remove -lncurses as an option so it looks like
for lib in -lcurses; do
2) Edit curses.c line 55 change STDIN_FILENO to 0 [zero]
root@betelgeuse /Users/mgt/Downloads [54] diff netris-0.52/curses.c netris-0.52-good/curses.c
55c55
< { NULL, 0, FT_read, STDIN_FILENO, KeyGenFunc, EM_key };
---
> { NULL, 0, FT_read, 0, KeyGenFunc, EM_key };
3) Edit robot.c
root@betelgeuse /Users/mgt/Downloads [52] diff netris-0.52/robot.c netris-0.52-good/robot.c
60,61c60,61
< dup2(to[0], STDIN_FILENO);
< dup2(from[1], STDOUT_FILENO);
---
> dup2(to[0], 0);
> dup2(from[1], 0);
77c77
< status |= O_NONBLOCK;
---
> status |= 0;
Then just "bash Configure" and "make" seems to work fine.
-Mike
[PS no idea why STDIN_FILENO and STDOUT_FILENO are not defined. But I can live without knowing. :)]
wow, thank you so much mgtremaine!
Now to hook my NeXT back up and test it out! :)
I made a quick package of this compiled against ncurses so it'd have color if you're ssh'ed/telneted in to your NeXT system. Just set TERM to xterm-color & it'll show up in color. It's compiled quad-fat & in the normal package location on my server.
Here's the proper fixes btw
Add this to the config.h
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define O_NONBLOCK 00004
And add this to the Makefile
On the COPT line
-I/usr/local/include -I/usr/local/include/ncurses
Once you do that, it compiles clean against my ncurses package. 8)
Hope you like the package. I tested it on my x86 box. I put the docs in /usr/local/share/doc/netris in the package. Take care.
Quote from: "kb7sqi"
Here's the proper fixes btw
Add this to the config.h
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define O_NONBLOCK 00004
Hehe much cleaner then my hackery... Thanks!
-Mike
Hey, your hackery got it to work! :D I figured I'd do a proper port so others could mess with it they wanted to. I figured since there was over 500 views on the thread, there must be some interest. :wink: Take care.
ah, cool. thanks :)
mgtremaine (i always read that as "megatrain"... :P) I couldnt get the binary you posted to ever run and i forgot to tell you.. lol, sorry :) I'll have to try this one out soon.