implement non-default plural rules for ngettext translations

the new code in dcngettext was written by me, and the expression
evaluator by Szabolcs Nagy (nsz).
harden mo file processing for locale/translations

rather than just checking that the start of the string lies within the
mapping, also check that the nominal length remains within the
mapping, and that the null terminator is present at the nominal
length. this ensures that the caller, using the result as a C string,
will not read past the end of the mapping.

the nominal length is never exposed to the caller, but it's useful
internally to find where the null terminator should be without having
to restort to linear search via strnlen/memchr.
harden dcngettext plural processing

while the __mo_lookup backend can verify that the translated message
ends with a null terminator, is has no way to know nplurals and thus
no way to verify that sufficiently many null terminators are present
in the string to satisfy all plural forms. the code in dcngettext was
already attempting to avoid reading past the end of the mo file
mapping, but failed to do so because the strlen call itself could
over-read. using strnlen instead allows us to avoid the problem.
tweaks to plural rules evaluator

const parsing, depth accounting and failure handling was changed
a bit so the generated code is slightly smaller.
fix terminal control ioctl constants for sh

this commit changes the names to match the kernel names, exposing
under the normal names the "old" versions which work with a smaller
termios structure compatible with the userspace structure, and
renaming the "new" versions with "2" on the end like the kernel has.

this fixes spurious warnings "Unsupported ioctl: cmd=0x802c542a" from
qemu-sh4 and should be more correct anyway, since our userspace
termios structure does not have meaningful information in the part
which the kernel would be interpreting as speeds with the new ioctl.
reimplement if_nameindex and getifaddrs using netlink

the previous implementations had several deficiencies, the most severe
of which was the inability to report unconfigured interfaces or
interfaces without ipv4 addresses. among the options discussed for
fixing this, using netlink turned out to be the one with the least
cost and most additional advantages. other improvements include:

if_nameindex now avoids duplicates in the list it produces, but still
includes legacy-style interface aliases if any are in use.

getifaddrs now reports hardware addresses and includes the scope_id
for link-local ipv6 addresses in the resulting address.