Commit graph

26 commits

Author SHA1 Message Date
John "Elwin" Edwards
7d459d7d36 Fix an assortment of compiler warnings.
A few potential bugs were removed in the process.  Much code cleanup
remains to be done.
2019-11-22 21:18:27 -05:00
John "Elwin" Edwards
172c83f254 Fix some potential problems detected by clang.
Most of these are unnecessary comparisons and functions returning the
wrong types.
2017-09-23 09:47:00 -04:00
John "Elwin" Edwards
c661fd79d4 Use C stdio functions for score files and save files.
Switching from Unix file descriptor operations to C standard FILE*
functions will reduce portability problems.
2017-09-15 19:57:54 -04:00
John "Elwin" Edwards
62047972cc Use more portable random seed generation.
The new function md_random_seed() has replaced time() + getpid() and
similar methods.  Putting everything in mdport.c slightly reduces the
warnings and workarounds.
2017-01-28 15:49:41 -05:00
John "Elwin" Edwards
cfda1f88e8 Super-Rogue: begin fixing restore failures on Windows.
Start to solve the problem by calling md_init() to set _fmode.  Now
reading a savefile only triggers an error handler and causes an abort
instead of a crash.
2016-03-03 21:30:38 -05:00
John "Elwin" Edwards
59f448e92e Super-Rogue: convert to ANSI-style function declarations.
This fixes most of the build warnings.
2016-01-31 13:45:07 -05:00
John "Elwin" Edwards
268b30f851 srogue: provide type definitions if needed.
If not defined in headers, uid_t and gid_t will be defined as
unsigned ints, and pid_t as int.
2015-08-03 21:29:16 -04:00
John "Elwin" Edwards
e857a2cec6 srogue: make checking directories slightly more portable.
MSVC sys/stat.h doesn't define S_ISDIR().
2015-08-03 09:05:15 -04:00
John "Elwin" Edwards
de013693fd srogue: prevent overflowing the score file name.
If SCOREFILE is not defined, roguehome() is called to find a directory
for the score file.  It copies up to PATH_MAX-20 bytes from an
environment variable to a static buffer.  Later these are strcpy()'d to
scorefile, which is of size LINLEN.  Unfortunately LINLEN is 80 and
PATH_MAX is at least 256.  On Linux, it happens to be 4096.

I haven't yet managed to crash or exploit it, but there are surely no
beneficial consequences, so roguehome() has been modified to check the
length, and the string it returns is also checked in main().
2015-08-02 12:14:47 -04:00
John "Elwin" Edwards
2e4f161e40 srogue: improve privilege handling.
Setgid privileges are now dropped when not required.  restore() is now
less complex.
2015-08-01 16:23:24 -04:00
John "Elwin" Edwards
bc5b26fece srogue: open the score and log files when the program starts.
Super-Rogue can now use the same privilege-dropping scheme as the other
games.
2015-08-01 15:12:11 -04:00
John "Elwin" Edwards
120beada5a srogue: more compatibility improvements.
Randomness now uses mdport, and xcrypt.c has been replaced with the
rogue5 version.

Super-Rogue now builds on MinGW.
2014-05-03 10:31:30 -07:00
John "Elwin" Edwards
b9cc9cf3a7 srogue: add and use more md_* portable functions.
Privileges and memory usage checks are now more portable.
2014-05-02 15:06:23 -07:00
John "Elwin" Edwards
791df4324f srogue: use functions from mdport.c.
Shell escape, passwd entries, terminal settings, and most signal
handling is now done with the more portable md_* functions.
2014-04-30 14:46:30 -07:00
John "Elwin" Edwards
67ec840c3c Don't truncate player name in savefile name or log message.
The player name is stored in whoami[], which is length 80 in most games
(1024 in rogue5).  Only the first 10 chars were used to create
file_name, because that buffer is the same length.  Increasing the size
of file_name to 256 permits using all of whoami.

The name is also no longer truncated to 20 chars when writing the log.

All games should now be able to handle 79-character names without
collisions.  Anything more would break save compatibility.
2014-03-23 21:27:14 -07:00
John "Elwin" Edwards
720d587422 Rename daemon() to start_daemon().
daemon() conflicted with the standard library function, which is
included by default on OS X.
2013-09-07 08:08:00 -04:00
John "Elwin" Edwards
35a6ab583c srogue: begin porting to autoconf.
Super-Rogue can now be built with './configure && make', though
'make install' does not work yet, and there may be problems with
portability.
2013-09-01 20:50:52 -07:00
John "Elwin" Edwards
7d4d7dbbe8 srogue: allow wizard mode to be compiled out. 2013-08-31 14:24:31 -07:00
John "Elwin" Edwards
1f1ae55a26 Make sure file_name contains '/' between SAVEDIR and the file name.
Duplicated slashes are not a problem.  Missing slashes are.
2013-08-27 22:25:40 -07:00
John "Elwin" Edwards
4aa582dfb6 srogue: add arrow-key support.
This is a first attempt which may not be completely portable.
2013-08-10 17:43:58 -07:00
John "Elwin" Edwards
5114a73d41 srogue: include missing headers. 2012-01-27 17:29:30 +00:00
John "Elwin" Edwards
0195eba9bb srogue: move default locations to /var. 2012-01-24 18:30:17 +00:00
John "Elwin" Edwards
02c8fd2586 srogue: Fix CR/LF playback bug. 2010-12-06 19:43:32 +00:00
John "Elwin" Edwards
e3ef50b351 srogue: fix bug causing healing on invalid commands. 2010-11-27 16:49:44 +00:00
John "Elwin" Edwards
20d469d64f srogue: add support for SAVEDIR 2010-11-25 17:28:29 +00:00
John "Elwin" Edwards
ce4b930551 Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490) 2010-11-25 12:21:41 +00:00