commands: Rename the command functions Command functions are traditionally named like the command shortened to four characters. When this name collides with a keyword or library function, we abbreviate more: brea(), rea(). A few are unabbreviated, e.g. execute(). A few have different names, e.g. explain(), not list(). Commit 23726b379 (v4.3.0) suppressed a GCC warning about carg() colliding with its built-in function. Ron Koenderink reported Microsoft Visual Studio 2019 fails to link: "_carg already defined in ucrtd.lib(ucrtbased.dll)". Time to clean this up: rename the functions to c_FOO(), where FOO is the unabbreviated name of the command. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@redhat.com>
Make: Support shallow git clones for testing Since commit 1ec9b94, we derive the version number from git tags with build-aux/git-version-gen. When a shallow clone doesn't include a suitable tag, this fails, and make refuses to build anything. Since Travis uses git-clone --depth=50, it'll break as soon as we've got more than 50 commits since the last release. Support arbitrarily shallow clones for limited purposes like testing by falling back from a proper V.N-H version number to UNKNOWN-H. To guard against use of such builds for other purposes, log a warning on server startup, and print one on player login. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Include "file.h" where it's needed Several headers define macros that use ef_ptr() without including "file.h". Fix that. Drop redundant inclusions elsewhere. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Change comment style to use @foo rather than FOO ... when referring to a function's parameter or a struct/union's member. The idea of using FOO comes from the GNU coding standards: The comment on a function is much clearer if you use the argument names to speak about the argument values. The variable name itself should be lower case, but write it in upper case when you are speaking about the value rather than the variable itself. Thus, "the inode number NODE_NUM" rather than "an inode". Upcasing names is problematic for a case-sensitive language like C, because it can create ambiguity. Moreover, it's too much shouting for my taste. GTK-Doc's convention to prefix the identifier with @ makes references to variables stand out nicely. The rest of the GTK-Doc conventions make no sense for us, however. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
player: Drop long-disabled code to resolve IP addresses Disabled since commit 32fac04 (v4.2.13) because it could at the time use more stack space than we provided. Additional issues: code still uses obsolete gethostbyaddr() rather than getnameinfo(), and we provide only 512 bytes for host names instead of the customary NI_MAXHOST (1025) bytes. All three issues would be easy enough to fix. What's not so easy is to avoid blocking on the synchronous DNS lookup. Without that, connecting repeatedly from a range of addresses with slow reverse lookup could conceivably be employed as a denial of service attack. We've been living without reverse lookup for close to ten years. Bury the corpse, and move on. Bonus: sizeof(struct natstr) is cut in half. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
econfig: New key running_test_suite, for use by tests For now, it just logs "Configured for testing" on startup, and prints a scary warning on player login. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Update copyright notice Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Move declarations for chance.c to new chance.h
Update copyright notice
Update copyright notice
Journal login before changing the player thread's name The journal logs a thread name for each event. The player thread name changes on entry to the playing phase. Connecting old and new name isn't as easy as it should be: Sun Apr 29 12:13:39 2012 Conn29 input coun POGO Sun Apr 29 12:13:39 2012 Conn29 input pass peter Sun Apr 29 12:13:39 2012 Conn29 input play Sun Apr 29 12:13:39 2012 Play#0 login 0 127.0.0.1 armbru Sun Apr 29 12:15:39 2012 Play#0 logout 0 To connect Conn29 with Play#0, you have to know that country#0 is named POGO. Fix that by logging login before the thread name change: Sun Apr 29 12:17:41 2012 Conn29 input coun POGO Sun Apr 29 12:17:41 2012 Conn29 input pass peter Sun Apr 29 12:17:41 2012 Conn29 input play Sun Apr 29 12:17:41 2012 Conn29 login 0 127.0.0.1 armbru Sun Apr 29 12:19:41 2012 Play#0 logout 0 Now "Conn29 login 0" makes the connection obvious. This involves moving journal_login() from player_main() before empth_set_name() in its caller play_cmd(). Move journal_logout() as well, for symmetry. If player_main() fails, we now log login/logout instead of nothing in the journal. That's okay. Note that before commit c9f21c0e (v4.3.8), we logged just login then.
Clean up superfluous includes
Document execute()'s subtle use of player->aborted
Fix execute's printing of the executed commands If execute's argument was read interactively, it prints the argument instead of the command. Else, it prints uninitialized garbage. The latter can theoretically crash the server, or leak information. Broken in commit 3de1e8be, v4.3.28