lib/configuration.c, lib/home.c: Introduce environment variables. The places where DisOrder looks for configuration can now be overridden using environment variables. * `$DISORDER_CONFIG' is the master configuration file -- defaults to `PKGCONFDIR/config', where `PKGCONFDIR' is set at compile time (e.g., `/etc/disorder'. * `$DISORDER_PRIVCONFIG' is the private configuration file -- defaults to `$DISORDER_CONFIG.private'. * `$DISORDER_HOME' is the user's `profile directory' for DisOrder things -- defaults to `$HOME/.disorder' on Unix, or `%APPDATA%/DisOrder' (i.e., in the roaming profile directory) on Windows. * `$DISORDER_USERCONFIG' is the user's configuration file -- defaults to `$DISORDER_HOME/passwd'. * `$DISORDER_USERCONFIG_SYS' is the per-user system configuration file -- defaults to `$DISORDER_CONFIG.USERNAME'. The primary motivation for all of this is to make it easier to run clients -- particularly Disobedience and its `disorder-playrtp' inferiors -- against multiple servers simultaneously. Setting configuration on the command line works rather badly for clients, since that overrides the /system/ configuration, which the user can't edit anyway -- the client programs still read `$HOME/passwd' unconditionally. This is clearly a bug, but changing the behaviour now is a bad idea; besides, changing `-c' (or introducing a new option) to override the `passwd' file, doesn't actually help much unless Disobedience in turn passes the necessary option on to `disorder-playrtp'. Environment variables solve all of these problems much more simply.
lib/home.c: Introduce functions for building pathmames in home directories. Split the home-directory logic of `config_userconf' into its own file. Arrange to only calculate the home directory once. Most invasively, use this new functionality in place of looking up `$HOME' and building pathnames by hand. This change doesn't add much functionality, but it does add a little. Most notably, $ unset HOME; disobedience doesn't segfault any more. More subtly, the logic for finding one's home directory is now consistent. On Windows, we still use `%APPDATA%'; on Unix, we now /always/ use `$HOME' first, and then fall back to `getpwuid(getuid)->pw_dir' if that's unset. Previously, the configuration reader would ignore `$HOME' and use the password database, while Disobedience used `$HOME' exclusively and crashed if it was unset. This is all obviously silly.
lib/configuration.c, etc.: Remove arguments from `config_userconf'. Nobody ever did anything with the HOME argument at all. Passing in PW might have been slightly valuable, but configuration is only retrieved infrequently. Besides, this is the start of a sequence of changes to how configuration files are found.
lib/configuration.c, lib/uaudio-rtp.c: Allow tweaking MTU-discovery. Apparently under some circumstances, Linux tries to do path MTU discovery with RTP transmissions, so it (a) sets DF on outgoing packets and then (b) ignores the `fragmentation-needed' errors coming back! This option attempts to work around this foolishness. Configuration is accepted on all platforms for portability's sake, but is only effective on Linux.
clients/playrtp.c, lib/configuration.[ch]: Static config for `playrtp'. The `disorder-playrtp' program already reads the client configuration. This change sets defaults for a number of parameters which could previously only be changed from the command line, which is a problem because `disorder-playrtp' is commonly invoked by Disobedience which doesn't allow one to set a command-line. These various tweaks are experimental, and may change, or even be removed, in some later version. The `rtp_request_address' and `rtp_always_request' options, in particular, might be replaced by some more complicated policy mechanism.
Concentrate knowledge about the `pcre' API in one place. Introduce a new `regexp' API in the library which knows about `pcre' and actually invokes `pcre_...' functions. Remove this knowledge from everywhere else. The new API is, of course, suspiciously similar to `pcre' in many ways, but there are some differences. * Sizes, lengths, and offsets, are all `size_t' now. In particular, this means that the `ovector' type has changed. * Errors are reported differently: rather than returning a pointer to a static string, `regexp_compile' writes the error string into a caller-provided buffer. Observant readers might notice that these changes make the interface more similar to the `pcre2' API. They'd be right, and this is not a coincidence. But for now, there's no functional change.