[_DECTHREADS_] Drop support for DECthreads d4, a.k.a. DCE threads,
which are obsolete since at least 1997.
(empth_terminate, empth_wakeup) [__ppc__]: Ancient versions of OS X
lacked pthread_kill(). As a work-around, its use was disabled here
for all versions of OS X. The work-around could lead to hangs.
Remove it and drop support for ancient versions of OS X.
(empth_create) [__linux__]: Linux has supported thread attribute
stacksize for ages. Remove the special case.
Ron Koenderink [Sat, 23 Jul 2005 13:58:11 +0000 (13:58 +0000)]
Fix lrangeedit to lrange. Fix rangeedit to range. Fix attack to Attacking.
Add html links for info references. Remove inconsistent periods.
Add missing closing brackets. Change info to information to improve
readability. Improve the readability for range/lrange sentence.
Ron Koenderink [Sat, 23 Jul 2005 13:43:35 +0000 (13:43 +0000)]
(player_init) [_WIN32,__linux__ && __alpha__]: Remove the
SO_REUSEADDR socket option as it is not required for WIN32.
In WIN32, there is no waiting time when a port is closed before
it can be reused so SO_REUSEADDR is not required for WIN32.
Leave the option has a undesirable effect of allowing a second
server instance to start without an error and leaving both
instances running. ALPHA and LINUX do support SO_REUSEADDR.
Ron Koenderink [Sat, 23 Jul 2005 13:37:36 +0000 (13:37 +0000)]
(player_main): Add empth_yield() in the command processing loop to ensure
after every command, other players gets a chance to execute a command.
This prevents denial of service attack that monopolizing the active server
thread by continuing feeding data to the server from a client.
Ron Koenderink [Thu, 7 Jul 2005 21:57:15 +0000 (21:57 +0000)]
(show_sect_capab, mission_pln_equip, pln_equip): Change i_type
references to use I_NONE instead of zero. Zero has been invalid since
item.h rev. 1.12, and was questionable style before.
Ron Koenderink [Mon, 4 Jul 2005 14:07:31 +0000 (14:07 +0000)]
(pr_player, upr_player): Blocking I/O on another player's struct iop *
is unsafe! By the time the blocked thread wakes up, that player may
be gone, along with its struct iop *, and io_write() follows a
dangling pointer. Moreover, at most one thread may use empth_select()
on the same file descriptor. Violations of that restriction cause
threads to hang under Windows since ntthread.c rev. 1.15. Make all
output to another player non-blocking for now. Historically, player
threads sent output only to their socket, though their own iop. This
was broken by flash and asynchronous telegram notification a long time
ago.
Ron Koenderink [Thu, 30 Jun 2005 16:10:42 +0000 (16:10 +0000)]
(main) [_WIN32]: Windows putchar() screws up when printing multibyte
strings bytewise unless the stream is buffered. Switch stdout to
line-buffered mode.
(login): Explicitly flush stdout, because Windows doesn't implement
line-buffering faithfully.
Ron Koenderink [Sun, 26 Jun 2005 18:31:14 +0000 (18:31 +0000)]
(loc_Sem_t, empth_sem_t) [_WIN32]: empthread.h defines empth_sem_t as
incomplete type struct loc_Sem_t. Instead of completing it here, the
code defined an unrelated type loc_Sem_t as (complete) type struct
empth_sem_t. The resulting type errors were swept under the carpet
with casts. Obvious fix.
Based on a page Doug Wescott created for his Petting Zoo. I restored
the ASCII art to the original, gave credit to its creator, quoted from
WordNet (free) instead of American Heritage Dictionary, omitted parts
that might be illegal to distribute in certain countries, and improved
see also.
(att_move_in_off): When boarding from a sector, mil entering the ship
less one were not removed from the sector. The problem is putsect()
overwriting data from prior put_combat() with old data. Broken in
rev. 1.17. Change lunchbox code to match that of 1.16. Closes
#1219918, reported by Doug Wescott.
(copy_ascii_no_funny, copy_utf8_no_funny)
(copy_utf8_to_ascii_no_funny): New.
(flash, wall, prmptrd, uprmptrd, getcommand): Use them to filter
input.
(uprnf, pr_flash): Use them to filter output.
(prtoascii): No longer used, remove.
(player_login, player_main): Move the C_INIT that terminates the login
phase to player_login(). No functional change.
(showvers): Trivial, used just once. Inline, remove.
(parse): Support 127 arguments instead of 100, to match
player->argp[]. Assign complete argument vector. This should make
buffer overruns blatantly obvious.
(parse): Don't bother checking SPACE argument, just crash. It is
extremely unlikely that such a programming error wouldn't be
discovered by even them most superficial testing.
[_WIN32] (loc_StripDels): Remove. Different behavior depending on the
platform is evil, and line editing is none of the server's business
anyway. If your client can't deal with the delete key, well, here's a
nickel, kid, get yourself a better computer.
(ioq_gets): Support telnet line termination "\r\n". Previously,
string input other than through parse() or getele() failed to strip
'\r', which could end up in ship names and such.
(getele): Code dealing with '\r' is now redundant, remove. It ceased
to work in rev. 1.6 because input filtering replaces '\r' by '?'.
(sendmessage): Skip players not in state PS_PLAYING. Flashes to them
get ignored, hence telling the player that the flash was sent is
wrong. Skipping fixes that.
(getsose): Port from obsolete termcap to terminfo. The old code
manually stripped off padding, which is evil. The new code does
nothing when the stdout is not connected to a terminal.
(SO, smso, SE, rmso): Rename, static linkage.
(putso, putse): New.
(screen): Use it.
(program_name, help): New.
(main): New option -h. Terminate unsuccessfully on invalid option.
(usage, parse_args): Factored usage() out of parse_args().
(parse_args): More useful diagnostics.
(flee, army, wing): Print how many new members were added.
Previously, it printed how many were selected, which can include old
members of the group.
(flee, army): The rather obscure feature to assign the fleet's /
army's retreat orders to members was broken. It ignored ownership,
and thus could copy some other player's retreat orders. Abusable.
Copying the first member's retreat orders is less than useful, in
particular for group ~. The code now chooses the first one in the
same sector with RET_GROUP set. RET_GROUP is never set for group ~.