Collect more platform-specific code to sysinfo.h
Move a few existing functions of this type to sysinfo.* from
basenetwork.* and cstringutil.*. Mostly this is just code movement, but
there are two changes:
* getuid() usage is now controlled by HAVE_UNISTD_H instead of
HAVE_PWD_H, and excluded for MinGW (the latter is just a guess, but
many other similar calls are excluded for MinGW).
* Getting the current username uses getlogin_r() instead of getpwuid(),
following the implementation in tngio.cpp instead of the original
implementation in cstringutil.c. If this is OK, then we can get rid
of HAVE_PWD_H completely. Alternative would be to make the code use
getpwuid_r() if the old functionality is more desirable, but that is
a bit more effort, and requires some testing for platform support, as
that has not been used before in the code.
This allows removing platform-specific #ifdefs and #includes from
multiple files completely, making these aspects better encapsulated.
While checking the presence of #ifdefs, removed one useless #ifndef
GMX_FAHCORE from tngio.cpp; make_backup() already handles FAHCORE
internally.
Change-Id: I46876635fb254eb9558cce80b34ebe3078425375
13 files changed: