chiark / gitweb /
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.