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
Fix dn_expand pointer following
add multicast structures from RFC 3678 to netinet/in.h

and use _GNU_SOURCE || _BSD_SOURCE guards for all of the RFC 3678
namespace polluting things like glibc/uclibc does.
add linux tcp state enums
add TCP_NOTSENT_LOWAT tcp socket option, new in linux v3.12
add O_TMPFILE flag, new in linux 3.11

definition in linux:
 #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
where __O_TMPFILE and O_DIRECTORY are arch specific
use 0 instead of NULL in headers where NULL is not defined

some macros in sys/mtio.h and syslog.h used NULL without defining it
math: clean up __rem_pio2

- remove the HAVE_EFFICIENT_IRINT case: fn is an exact integer, so
  it can be converted to int32_t a bit more efficiently than with a
  cast (the rounding mode change can be avoided), but musl does not
  support this case on any arch.
- __rem_pio2: use double_t where possible
- __rem_pio2f: use less assignments to avoid stores on i386
- use unsigned int bit manipulation (and union instead of macros)
- use hexfloat literals instead of named constants
shadow: Implement putspent
Fix dn_comp prototype and add stub

This function is used by ping6 from iputils.
shadow: Move spent parsing to internal function
shadow: Implement fgetspent
restore type of NULL to void * except when used in C++ programs

unfortunately this eliminates the ability of the compiler to diagnose
some dangerous/incorrect usage, but POSIX requires (as an extension to
the C language, i.e. CX shaded) that NULL have type void *. plain C
allows it to be defined as any null pointer constant.

the definition 0L is preserved for C++ rather than reverting to plain
0 to avoid dangerous behavior in non-conforming programs which use
NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++
since C++ lacks the proper implicit pointer conversions, and other
popular alternatives like the GCC __null extension seem non-conforming
to the standard's requirements.)
remove duplicate includes from dynlink.c, strfmon.c and getaddrinfo.c
fix off-by-one length failure in strftime/wcsftime and improve error behavior

these functions were spuriously failing in the case where the buffer
size was exactly the number of bytes/characters to be written,
including null termination. since these functions do not have defined
error conditions other than buffer size, a reasonable application may
fail to check the return value when the format string and buffer size
are known to be valid; such an application could then attempt to use a
non-terminated buffer.

in addition to fixing the bug, I have changed the error handling
behavior so that these functions always null-terminate the output
except in the case where the buffer size is zero, and so that they
always write as many characters as possible before failing, rather
than dropping whole fields that do not fit. this actually simplifies
the logic somewhat anyway.
adjust fallback INFINITY definition for FLT_EVAL_METHOD==2 case

on archs with excess precision, the floating point constant 1e40f may
be evaluated such that it does not actually produce an infinity.
1e5000f is sufficiently large to produce an infinity for all supported
floating point formats. note that this definition of INFINITY is only
used for old or non-GNUC compilers anyway; despite being a portable,
conforming definition, it leads to erroneous warnings on many
compilers and thus using the builtin is preferred.
reject invalid address families in getaddrinfo

subsequent code assumes the address family requested is either
unspecified or one of IPv4/IPv6, and could malfunction if this
constraint is not met, so other address families should be explicitly
rejected.
increase TTY_NAME_MAX limit to 32

the old value of 20 was reported by Laurent Bercot as being
insufficient for a reasonable real-world usage case. actual problem
was the internal buffer used by ttyname(), but the implementation of
ttyname uses TTY_NAME_MAX, and for consistency it's best to increase
both. the new value is aligned with glibc.