misc: header includes cleanup

An attempt to build with -std=c99 or -std=c11 revealed few problems with
system header includes.

- strcasecmp() and strncasecmp() need <strings.h>
- ioctl() needs <linux/ioctl.h>
- struct ifreq needs <linux/if.h> (unless _USE_MISC is defined)
- fileno() needs _POSIX_C_SOURCE
- strdup() needs _POSIX_C_SOURCE >= _200809L
- inet_aton() would require _DEFAULT_SOURCE

Add missing includes and define _POSIX_C_SOURCE=200809L. Replace
inet_aton() with inet_pton(); the latter has slightly different
semantics (it does not support addresses like "1.2.3" or "1.2") but the
function is only called in code which is not actually used.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
4 files changed