shadow: Move spent parsing to internal function
shadow: Implement sgetspent
getopt_long: Support abbreviated option matching

From the getopt_long manpage:

    Long option names may be abbreviated if the abbreviation is unique
    or is an exact match for some defined option
strcmp: Remove unnecessary check for *r

If *l == *r && *l, then by transitivity, *r.
putgrent: Stop writing output on first failure

This way, if an fprintf fails, we get an incomplete group entry rather
than a corrupted one.
putgrent: Add missing newline
shadow: Implement putspent
Add logwtmp stub
Add TIMESPEC_TO_TIMEVAL and TIMEVAL_TO_TIMESPEC conversion macros

These macros seem to be a common source of compilation failure and seem
fairly convenient.

At least libusbx, elfutils, and util-linux-2.24 use one of these macros.
shadow: Implement fgetspent