Commit graph

1265 commits

Author SHA1 Message Date
Ron Koenderink
6fb90fb62c (newe): Remove wforce, not used anymore. 2005-03-10 22:25:58 +00:00
ed7adb7cf6 (loginit): Working directory is the data directory; simplify.
(loginit, logerror): Use plain char * instead of s_char *.
2005-03-10 19:33:12 +00:00
21088661d6 (emp_config): The previous rev. broke the documented feature that
missing default econfig means default configuration.  Fix.
2005-03-10 19:19:46 +00:00
7f000ce9cc Fix ugly line breaks. 2005-03-10 19:17:15 +00:00
a53c6e74c4 Update for recent pconfig changes. 2005-03-10 19:12:51 +00:00
5b57f4c222 Merge pre-4-2-20-invasive. Summary of changes:
* Acquire resources before daemonizing, fail in foreground
* Initialize threads and signals after daemonizing
* Make most file names relative to data directory
* emp_server and files make it their working directory
* emp_config() no longer screws up some file names
* Missing or incorrect econfig is now fatal
* Don't log to default log file when econfig changes it
2005-03-10 18:35:27 +00:00
Ron Koenderink
98f3d6efca (main,service_main) [_WIN32]: Change startup errors to stderr from
logerror() as log file is not open yet.
2005-03-10 18:00:40 +00:00
Ron Koenderink
f03de3f9a5 (service_main) [_WIN32]: Remove init_server() as it has already been done. 2005-03-10 16:15:30 +00:00
Ron Koenderink
b961414862 (main) [_WIN32]: Add extern file for chdir().
(main) [_WIN32]: Add #ifdef for tbuf as it is only used in LINUX and
EMPTH_POSIX.
2005-03-10 16:13:51 +00:00
d20fb6ba39 (init_server, start_server): Move signal and thread initialization
from init_server() to start_server(), and service startup next to its
Unix equivalent disassoc().  This way, threading is always initialized
after daemonizing, which is simpler and more portable.
2005-03-09 19:37:48 +00:00
ba7d26b2ba (disassoc): src/lib/player/accept.c rev. 1.18.2.1 broke the server
when it runs as daemon, because it relies on player_socket remaining
open across disassoc().  Change disassoc() to only close file
descriptors 0..2 instead of 0..9.  By the way, it should really
redirect 0..2 to /dev/null instead.
2005-03-09 19:25:20 +00:00
fcf064625d (main): Non-zero flags imply !daemonize. Make explicit. 2005-03-09 18:57:53 +00:00
29da4b6cf4 (empfile, teldir, motdfil, downfil, disablefil, telfil, annfil)
(banfil, authfil, timestampfil): Make file names relative to DATADIR.
(main): emp_server and files change to the data directory.  fairland
has to write newcap_script to the initial current directory, so it
keeps it and makes file names relative to DATADIR absolute.
(fixup_files): Nothing to do, remove.  This fixes the following bug:
fixup_files() formed file names by appending ep->name instead of the
base name of ep->file to datadir.  Thus, fixup_files() changed file
names even when datadir had the compiled-in value.  When emp_config()
couldn't open econfig, it failed to call fixup_files(), and different
file names got used.  Note that with this revision the file names
revert to the names used before fixup_files() was introduced.  Closes
#1146080.
(print_config): Printing file names as comments is not really useful,
remove.
(otherfiles, ofiles): Unused, remove.
(emp_config, main): Previously, pconfig had to call emp_config() even
when it didn't want to read econfig, just to run fixup_files().  This
is no longer necessary.  Simplify.
2005-03-09 18:44:50 +00:00
1583d0c6a2 (dflt_econfig): New.
(emp_config): Use it when argument is NULL.  This simplifies callers
except pconfig's main(), which now has to suppress reading the default
file.  Also fix callers to check the return value.  Previously, a typo
could easily start a grossly misconfigured program, with potentially
disastrous results.
2005-03-09 17:11:58 +00:00
12518b82dd Fix missing include. 2005-03-09 16:56:39 +00:00
6309973d07 Fix typos, update paths that changed since this was written. 2005-03-09 16:46:45 +00:00
84b8189c13 (daemon, daemonize): Rename to avoid name clash with BSD's daemon().
(daemonize): Supply missing declaration.
2005-03-09 14:45:41 +00:00
30f2b2c4ea (player_init, player_accept): Move socket bind and listen from
player_accept() to player_init().  Acquiring resources during
initialization allows to exit unsuccessfully on errors.  Previously,
the daemon detached itself (exiting successfully), then failed in the
background.
(player_socket): New.
2005-03-08 16:51:19 +00:00
Ron Koenderink
0b172c6553 (NS_ALL) [_WIN32]: Change NS_EVERYTHING back to NS_ALL, #undef NS_ALL to prevent conflict with winsock2.h 2005-03-08 00:04:43 +00:00
Ron Koenderink
ab2bea5810 (service_main) [_WIN32]: Remove the command line processing.
The secondary command line processing was adding significant
complexity for minimial gain.  Now all the command line arguments
can be prequalified during the installation of the service.

(service_main) [_WIN32]: Move the initialization (init_server())
so logerror() will go to the file instead of stderr.
2005-03-06 20:58:48 +00:00
Ron Koenderink
46a11d0d93 (main) [_WIN32]: Move install_service() so the config_file
can be verified before installing.
2005-03-06 20:54:30 +00:00
Ron Koenderink
0ba025cb4b (main,service_main) [_WIN32]: Remove printf for errors
during startup, as logerror will print to stderr or to log file.
Remove logerror for successful installation and removal.
2005-03-06 20:08:52 +00:00
Ron Koenderink
d1d7028fc7 (main,service_main) [_WIN32]: Fix config_file for WIN32.
(main,service_main,empth_exit) [_WIN32]: Add daemon flag.
Separate the debug_flag into two separate flags, one for
debugging (debug) and controlling the daemon processing
(daemon).
2005-03-06 19:53:14 +00:00
830c171dd2 (start_server, main, service_main): Call emp_config() earlier.
(main): Call loginit() later, after emp_config().  Previously, the
program logged to the default datadir until emp_config().
(init_server, start_sever): Split start_server() into initialization
and actual startup.  Move initialization before disassoc().
(main, init_server): Log server startup only after initialization is
complete.
2005-03-05 20:38:01 +00:00
e215af5ac5 (init_files): Exit unsuccessfully when a file can't be opened. 2005-03-03 19:54:25 +00:00
Ron Koenderink
85150431ed (delete_old_news,init_nreport): Add void for extern prototypes. 2005-03-03 00:23:49 +00:00
Ron Koenderink
3d3d6755aa (nreport, filereport, ncache, addfree, findfree, delete_old_news)
(init_nreport, update_main, start_server): Switch news to be sorted
list with all new news items added at the end of the list.  The
removal of expired news items is done at update time.  Closes #766755.
2005-03-02 23:53:10 +00:00
Ron Koenderink
55e6aca9e0 (wrmakesrc,wripglob,wrgamesdef,info,apro,mobupdate,rea,turn
upda,ef_open,logerror,emp_config,match_user,show_motd,gamedown,
typed_wu,delete_old_announcements,mobility_check,mobility_init,
allocate_memory,write_newcap_script,main,files,fairland,doconfig,)
[_WIN32]: Switchback to default mode of text.
"t" (text) is not included the ISO/ANSI C standard but "b" (binary)
is included.
2005-03-02 12:47:15 +00:00
d4af51c9e2 Fix the previous rev. 2005-03-01 18:49:12 +00:00
Ron Koenderink
826c14ef79 (write_file,allocate_memory): Convert to stdio. 2005-03-01 13:50:56 +00:00
Ron Koenderink
df7dc203c4 (turn): Change to stdio.
(turn): Always close the file after attempting to write.
Fixes bug where the file is not close when there is writing
error.
2005-02-28 23:21:05 +00:00
0aaf0084aa (as_extend, as_costcomp, gen_power, powcmp): Fix non-portable function
cast.
(qsort_func_t): Unused, remove.
2005-02-24 18:47:26 +00:00
b360d076d3 (ship_bomb): Clarify. Also gets rid of compiler warning. 2005-02-24 17:55:28 +00:00
8bb79caa87 global.h does nothing but include prototypes.h, remove. 2005-02-24 17:54:14 +00:00
2f4a825348 Doc fix. 2005-02-24 17:52:10 +00:00
58512e4813 First step towards generalizing NSC_TYPEID to arbitrary dictionaries.
(nsc_cat) New category NSC_ID.
(nstr_comp): Resolve identifiers instead of relying on nstr_comp_val()
and nstr_coerce_val().
(valstr, nstr_coerce_val): Remove valstr member val_as_type.
(nstr_parse_val, nstr_match_ca, nstr_match_val, nstr_resolve_id)
(nstr_resolve_sel, nstr_mkselval): New.
(nstr_comp_val): Rewrite using the above.
2005-02-24 16:14:53 +00:00
Ron Koenderink
446d4ed394 (gamedown,show_motd): Change to stdio for reading motd and
down message.

(gamedown): Change buf's size to be MAXTELSIZE instead
of abitrary number.  Make consistent with show_motd().
2005-02-24 02:00:14 +00:00
Ron Koenderink
7afaedbfc1 (gamedown,show_motd): Change the %d to %ld for printing
tgm.tel_length as it is long.
2005-02-24 01:28:44 +00:00
Ron Koenderink
3af430ebc5 (gamedown, show_motd): Move length check to before 'buf' is written to
to prevent stack overflow on 'buf' variable.
2005-02-23 19:00:56 +00:00
9be3aa7739 Tell indent about i_packing and i_type, belatedly. 2005-02-23 15:55:58 +00:00
7e402f062c Fix bad line break / whitespace. No functional changes. 2005-02-23 15:41:22 +00:00
16407594d6 (conditions): Fix spelling mistake. 2005-02-23 15:28:24 +00:00
929b3ba412 (retr): Use RET_GROUP instead of literal 1. No functional changes. 2005-02-23 15:27:19 +00:00
4113cdab5c Fix bad line break. No functional changes. 2005-02-23 15:26:36 +00:00
39a2710482 (reco): Fix check for empty flight path. Aborting the command at the
flight path prompt now works.

(reco): Pass P_ESC to pln_arm() for consistency with call of pln_sel()
and similar code elsewhere.  Believed not to make a difference.
2005-02-23 15:17:27 +00:00
Ron Koenderink
bca00f35f5 (powe): Do not round totals for deity countries. 2005-02-22 01:28:43 +00:00
Ron Koenderink
aebdf80864 (powe): Fix the deity check to use player->god instead of
player->cnum == 0.  Partial Fix for #863419.
2005-02-21 20:35:37 +00:00
552467dc08 (nullify_objects): Simply use all of bigcity_dchr. Using only parts
is confusing.
(bigcity_dchr): Fix initializer for d_maxpop.

(dchr): The previous revision accidentally changed maximum population
of sanctuaries, plains, sea and wasteland.  Revert the former two.
The latter are not used, but the new max population of zero makes more
sense, so keep it.
2005-02-21 19:52:25 +00:00
Ron Koenderink
6e9a69241e (main): Move loginit() to after the getopt(), so the -D option will
take affect for the log file.  Otherwise the server.log will be in
default data directory compiled into the server.
2005-02-21 18:17:11 +00:00
Marc Olzheim
d0295935a4 Update patch for include/prototypes.h:1.66
src/lib/commands/mfir.c:1.21 src/lib/commands/sabo.c:1.10
 src/lib/update/human.c:1.15  No functional changes.
2005-02-21 17:17:16 +00:00