Commit graph

174 commits

Author SHA1 Message Date
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
90ba9608cb Fix parse() not to filter out tab from quoted arguments
Broken in commit 2cc44bb1, v4.2.21.
2008-07-25 08:16:38 -04:00
f55860670a Move oops actions from log.c up to application
Change oops() to call the new oops_handler function pointer instead of
offering a fixed set of actions.  Change server's main() to install a
handler for the action requested by -E.
2008-04-25 22:06:13 +02:00
627e7d452d New server option -E to choose what to do on oops
Three options: abort, crash-dump, nothing.  crash-dump works by
aborting a fork.  It isn't implemented for Windows.

The oops action is no longer tied to daemon mode, but -d still implies
-E abort for convenience.
2008-04-21 21:52:27 +02:00
942eddf533 New emp_searchque() 2008-03-14 21:00:29 +01:00
0dd6702df1 Update known contributors comments 2008-03-14 20:25:44 +01:00
b76e5a5eed Make conftab.c independent of the current directory
read_builtin_tables() wanted to run in builtindir, and
read_custom_tables() wanted to run in configdir.  Bothersome.  Use new
fopenat() to relax those requirements.

The chdir() satisfying them are now superflous, remove them.
2008-02-07 08:01:54 +01:00
4bb23dd1a6 Make econfig keys data and info work for relative names
File names in econfig need to be interpreted relative to configdir.
This wasn't the case everywhere for keys data and info.

Fix this by changing variables gamedir and infodir to hold absolute
names.  Change builtindir likewise, for consistency.  Store the values
from econfig in gamedir_conf, infodir_conf and builtindir_conf.

Uses new fnameat() to derive absolute names from possibly relative
ones.
2008-02-07 08:01:54 +01:00
a38fad4229 Make utility programs abort on internal error
Until now, they tried to recover and continue (debug off).  That's
appropriate only for the server.  The server could be told to abort
instead (debug on, selected by option -d), but not the utility
programs.

Change debug to be on by default, and switch it off early in the
server's main().  No functional change for the server.
2008-02-07 08:01:53 +01:00
77e95bd788 Clean up library dependencies
Move stuff to untangle the ugly cyclic dependencies between the
archives built for selected subdirectories of src/lib/:

* Move common/io.c to empthread/ because it requires empthread stuff

* Move parts of subs/nstr.c to common/nstreval.c to satisfy
  common/ef_verify.o

* Move getstarg.c getstring.c onearg.c from gen/ to subs/ because they
  require stuff from there

* Move bridgefall.c check.c damage.c empobj.c journal.c maps.c
  sectdamage.c from common/ to subs/ because they require stuff from
  there

* Move cnumb.c from subs/ to common/ to satisfy common/type.o

* Move log.c fsize.c from common/ to gen/ because they really belong
  there

* Move emp_config.c mapdist.c from gen/ to common/ because they really
  belong there, and require stuff from libglobal.a

Also package as/ as libas.a to satisfy common/path.o.

Remaining dependencies:

    lib             needs
    --------------------------------------------
    libas.a         libglobal.a
    libcommon.a     libas.a libglobal.a libgen.a
    libgen.a
    libglobal.a
    liblwp.a        libgen.a
    libw32.a[*]     libgen.a

    [*] Except for service.o, which can only be linked into the server

Link order now: liblwp.a libcommon.a libas.a libgen.a libglobal.a
libw32.a.  The position of libw32.a is not quite right, but works
anyway.
2008-02-03 08:11:13 +01:00
1cbb37d4fb Get rid of src/lib/gen/copy.c
The function that gave its name to this file is long gone, the file's
description is bogus, and it contains just one definition.  Move that
to ../subs/border.c, and delete the file.
2008-02-03 07:44:20 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
90631d56ed Record raw arguments, to be used in the next changesets:
(player): New member comtail.
(parse): New parameter tail.  Reorder parameter list.
(command, execute): Pass player->comtail.
(player_login, emp_config, do_unit_move): Pass NULL.  No functional
change.
2007-11-25 13:55:52 +00:00
588a0f0898 Doc fix. 2007-11-17 16:52:07 +00:00
5017bb5daa (parse): Simplify. No functional change. 2007-11-17 16:48:01 +00:00
Ron Koenderink
afedb8c9e2 (posix_accept, posix_bind, posix_listen, posix_setsockopt,
posix_shutdown, posix_socket, socklen_t) [_WIN32]: Move socket
related externs to sys/socket.h.

(inet_ntop) [_WIN32]: Move extern to inet.h.

(tcp_listen): Remove the !WIN32 includes and use the revised
sys/socket.h, netinet/in.h, arpa/inet.h and netdb.h.
2007-08-28 21:06:22 +00:00
404095d2fa Trim system includes. 2007-08-18 17:03:14 +00:00
Ron Koenderink
01625ead8c (tcp_listen, posix_setsockopt) [_WIN32]: Move the special
SO_REUSEADDR code for _WIN32 from tcp_listen() to
posix_setsockopt().

[_WIN32] (posix_open): Switch to _sopen() for _sopen_s() as MinGW
does not support _sopen_s() yet.

[_WIN32] (posix_fd2socket): Fix typo.
2007-08-17 03:11:45 +00:00
Ron Koenderink
af64cfd491 [_WIN32] (readv, writev, iovec): New. POSIX equivalents.
(ioq_makeiov, ioqtoiov): Compile unconditionally.
(io_output): Use POSIX code unconditionally.
[_WIN32] (ioq_makebuf): Remove.
2007-08-16 21:43:20 +00:00
a9c872f006 Back out the previous revision and remove the include of sys/types.h
instead.
2007-08-16 10:41:30 +00:00
Ron Koenderink
f835548ee7 Include sys/uio.h unconditionally. 2007-08-15 02:46:08 +00:00
Ron Koenderink
6181fd10bf [_WIN32] Provide POSIX-style sys/socket.h. Use it rather than
winsock2.h.
2007-08-15 02:40:53 +00:00
Ron Koenderink
4bbc3f4286 Simple POSIX I/O emulation layer to work around Windows's defective
Unix I/O:
[_WIN32] (socklen_t, accept, posix_accept, bind. posix_bind, listen)
(posix_listen, setsockopt, posix_setsockopt, shutdown, posix_shutdown)
(socket, posix_socket, close, posix_close, creat, fstat, posix_fstat)
(lseek, posix_lseek, open, posix_open, read, posix_read, write)
(posix_write, fileno, posix_fileno, fcntl, O_NONBLOCK, F_RDLCK)
(F_WRLCK, F_GETFL, F_SETFL, F_SETLK, EWOULDBLOCK, ENOTSOCK)
(flock, fsync, posix_fsync):
New.
(ef_open, io_close, io_input, io_output, io_shutdown, io_noblocking)
(player_accept): Use them to simplify.
[_WIN32] (posix_fd2socket): New.
(empth_select): Use it.
(gen_power): Use it.
2007-08-14 03:33:28 +00:00
6498d66263 New home for stuff specific to Windows: src/lib/w32/
Move getopt.c getopt.h service.c from src/lib/gen/ there.
(lib/libw32.a): New.
(libs): Add it under Windows.
2007-08-04 05:23:39 +00:00
23aa13b2c7 Doc fix. 2007-07-31 04:57:07 +00:00
Ron Koenderink
bca365c485 (set_paths) [_WIN32]: Add a comment to explain the use of _fullpath(). 2007-07-21 00:50:32 +00:00
a9afd1efef (update_lock, play_lock, update_pending, play_wrlock_wanted): Move to
main.c and rename to better reflect their purpose.  Fix misleading
comments.
2007-07-20 19:09:34 +00:00
71320ed67f New update scheduler:
(schedulefil): New.
(set_dirs, set_paths): Rename.  Initialize schedulfil.
(read_schedule): New.  Can read several updates, which will be used in
later changesets.
(update_time): Change to array.  Will be used in later changesets.
(update_schedule_anchor): New.
(update_init): Initialize it.
(update_get_schedule): New.
(update_init): Call it to initialize update_time[].
(update_sched): Rewrite.
(update_forced, update_wanted): Replace.
(update_reschedule): New.
(main): Call it on SIGHUP to reload the schedule.
(update_trigger, update_force, force, player_coms): Drop force's
capability to schedule updates in the future, because it's not worth
the trouble to implement again.  Deities can simply edit the schedule
file to schedule updates.  Remove update_force() and
update_trigger()'s parameter.
(upda): Update for new scheduler.  Take care to keep output the same
as far as possible, even though it's ugly, to avoid breaking clients.
(update_policy, adj_update, update_times, hourslop, blitz_time):
econfig keys removed.
(update_demand, UPD_DEMAND_NONE, UPD_DEMAND_SCHED, UPD_DEMAND_ASYNC)
(update_demandpolicy, UDP_NORMAL, UDP_TIMES, UDP_NORMAL, UDP_BLITZ)
(UDP_MAX, UDP_DEFAULT, UDDEM_TMCHECK, UDDEM_COMSET, UDDEM_DISABLE)
(UDDEM_MAX, UDDEM_DEFAULT): econfig key and values replaced.  Users
changed.  wantupd.h is now empty, remove.
(demand_check): External linkage.
(update_policy_check): Now pointless, remove.
(is_daytime_near, min_to_next_daytime, regular_update_time)
(scheduled_update_time, next_scheduled_time, updatetime)
(next_update_time, next_update_check_time): Unused, Remove.

(demand_check, demandupdatecheck): Move call of demand_update_time()
from demand_check(), which controls all demand updates, to
demandupdatecheck(), which controls only unscheduled ones.  Fixes
update command not to lie about the next scheduled demand update.

(demandupdatecheck): Check updates_disabled() so that zdone no longer
claims to trigger an update when it can't.
2007-07-11 22:27:29 +00:00
Ron Koenderink
856dcb7c5c (journal_entry): Add unsigned char cast to isprint() call.
(parse): Add unsigned char cast to isspace() call.
Portability bug fix for WIN32.
2007-03-10 18:12:29 +00:00
Ron Koenderink
0978c0c4fc (accept.c, io.c, nthread.c, tcp_listen.c) [_WIN32,WIN32]:
Remove the define WIN32.
Not required for VC8.
2007-02-23 22:51:30 +00:00
c5719fb3be (can_listen): Never returns; change return type to void. 2007-01-17 19:22:49 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
Ron Koenderink
4c9293f9ea Remove optlist.h, not required.
Add empthread.h, needed for empth_request_shutdown() and
empth_wait_for_signal().
2006-07-11 22:08:10 +00:00
c54cb0e8e8 Change system header inclusion order to make crufty old systems happy. 2006-07-11 19:11:55 +00:00
acad2240e0 Fix the previous revision (system header inclusion cleanup), it
doesn't compile on crufty old systems.
2006-07-11 18:42:08 +00:00
f4e018b6ee Back out the previous revision (system header inclusion cleanup), it
doesn't compile on crufty old systems.
2006-07-11 18:11:03 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
Ron Koenderink
0e4eb6bf0a (install_service, info, apro) [_WIN32]: Convert to standard snprintf()
from _snprintf().

[_WIN32]: Add #define snprintf to convert to _snprintf for WIN32
Visual Studio.
2006-06-23 00:13:21 +00:00
b9017dbde9 (chance, roundavg): Simplify. No functional change. 2006-06-17 12:40:25 +00:00
3f23320a7e (tcp_listen): Don't print null host. 2006-06-15 18:34:46 +00:00
Ron Koenderink
4a5700e572 (service_main) [_WIN32]: Added the missing empth_wait_for_signal() and
shutdown() for when the server is running at WIN32 service.  This fix
incorporates the changes that where done to the main thread.
2006-06-10 04:11:16 +00:00
0c6d9e108c (cant_listen): Supply missing newline. 2006-06-08 20:55:17 +00:00
f3e85c2f70 Coding style, comments, spelling... 2006-05-26 18:46:50 +00:00
0d842c47f7 Purge the register keyword. 2006-05-21 13:18:57 +00:00
cd73a47dfa Remove superflous casts and parenthesis. 2006-05-21 12:24:30 +00:00
cee8e126a2 Remove declaration that should have been removed in rev. 1.9. Doc
fix.  register purge.
2006-04-30 13:20:48 +00:00
8f998de170 Remove dead code. 2006-04-30 08:43:28 +00:00
0c8c169f88 (s_char): Remove. Use signed char for small integers, plain char for
characters.
2006-04-29 16:25:17 +00:00
a988b907fc s_char purge directed by compiler warnings. 2006-04-29 06:41:45 +00:00
6fee3f4535 (CANT_REACH): New. Use it instead of CANT_HAPPEN() where possible.
(oops): Cope with NULL argument passed by CANT_REACH().
2006-04-17 17:36:07 +00:00