Closed sshipway closed 8 years ago
@sshipway including stdlib.h
in m.c
seems to solve the problem, I didn't get segfault anymore.
But a exit status 1, HISCOREPATH
seems to be a fixed location, yup, the installation is fixed at /usr/local
.
See this, it looks like those warnings in -Wall
are better to be fixed.
The code is over 25 years old (really!) and was written for Solaris rather than Linux/gcc -- it was also the first C program I ever wrote! So, I'd expect a lot of errors. The HISCOREPATH
is defined in wand_head.h
along with the screen path and other settings; back then, this was the standard way to do it (a separate .h with the options in it) rather than using a configure tool.
Really, the whole program needs to be properly ported to Linux and GCC, and even to get a proper configuration tool. Pull requests welcomed!
Fixed by commit 236c0a3
@sshipway I can help with resolving those warnings, perhaps with -std=c99
, if that's okay with you.
Fine by me. This is code from the early 90s, so whatever needs to be done to make it compile properly is OK.
It would be good if the DOS compatibility could be retained, though I'm not sure which compiler was used. Xenix compatibilty we can probably lose without complaint!
@sshipway I am not sure I can guarantee that, I was only hoping by add headers would've fixed many warnings. Now, with DOS, and since I don't know any way to cross compile (and I don't want to use Windows), I can't be certain if any of the changes would break the compatibility.
@sshipway Now come to think about it, I could just start with those since they most likely wouldn't affect the compatibility. And for the rest of the warnings, we can deal with later.
Under 64bit Linux, gcc 4.4.7, the getenv() call seems to return an out of bounds value. This means that the name var is set but unreachable, as are other variables. As a result, you get a segfault when the game ends and it tries to write to the scorefile or to say "name died from ...".
Using gdb shows that the get_name() fn gets name and it is set wrongly. This seems to be some sort of 64/32bit conversion error but it is part of the library.
See here for the only other mention of it I could find: http://comments.gmane.org/gmane.comp.gdb.devel/16705