(NF_UTF8, togg): New client flag.
(flash, wall): User text input filtering.
(parse, prmptrd): Normal text input filtering.
(uprmptrd, ugetstring): New, to get user text.
(getele, flash, wall): Use them.
(getele): No need to filter out funny characters; input filtering
takes care of them.
(sendmessage, ufindbreak): Work on user text.
(uprnf): New, to print user text.
(rea, gamedown, show_motd): Use it.
(prnf): Unused, remove.
(pr, upr_player): Normal text output filtering (with highlighting).
(pr_flash): User text output filtering.
unclear. Other programs only support -e. Remove -D.
(install_service): Remove argument datadir_set.
(main): New option -v.
(main): Exit successfully after -h.
(main): Don't print usage on unknown options, just point to -h.
(print_usage): Rewrite. Deprecate use of non-option arguments.
empth_request_shutdown,loc_BlockMainThread,empth_init,
service_ctrl_handler) [_WIN32]: Remove the Windows Build UI and
replace with Ctrl-c signal trap. The shutdown event that was used for
STOPPING the service is now used for both foreground and background
(service) modes of operation. Also move the shutdown event from service
code to empth_t library.
_vsnprintf from the WIN32 library for changes to logerror().
(main) [_WIN32]: Add typedef for pid_t to match WIN32 definition
for getpid(). This is required for the create_pidfile() changes.
an odd case where signals were not catched when debugging.
(main, empth_start): Using sa_handler with SA_SIGINFO is wrong.
Simply don't set SA_SIGINFO; the additional signal information is not
used anyway.
* 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
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.
(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.
(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.
(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).
(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.
(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.
(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.
(total_work): New parameter maxpop. Callers changed.
(newe, prod): Use total_work(). Old code failed to limit military
workers, thus didn't match the update.
(do_feed): Simplify.
(max_pop): Use it. Don't support null argument anymore.
(nati, gen_power): Use max_population() instead of max_pop() with null
argument.
(show_sect_stats): Use max_population() to simplify the code.
(prod, upd_buildeff): Use max_population() to get correct new maximum
population for limiting work when tearing down a big city.
Previously, this was broken in upd_buildeff(). In prod(), it was
broken when the new designation had odd maximum population, which
should not occur.
(dchrstr): New member d_maxpop.
(dchr): Initialize it.
(max_pop): Use it. Use dchr[SCT_MINE].d_maxpop when called with null
argument. RES_POP now affects mountains and plains as well.
Add Windows Service to the server.
This includes adding install service and remove service option.
Move the start code from main to separate function.
Make close_files() and loc_NT_Term() global.
Move disassoc() to be earlier in the startup sequence.