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>
diff --git a/Makefile.am b/Makefile.am
index fcc912e..663f40a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = -Wall -Wextra
+AM_CFLAGS = -Wall -Wextra -D_POSIX_C_SOURCE=200809L
 AM_CPPFLAGS = -I$(top_srcdir)/uapi
 LDADD = -lm
 
diff --git a/ethtool.c b/ethtool.c
index 3207e49..526be4c 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -31,6 +31,7 @@
 
 #include "internal.h"
 #include <string.h>
+#include <strings.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <stdio.h>
@@ -46,6 +47,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include <linux/ioctl.h>
 #include <linux/sockios.h>
 #include <linux/netlink.h>
 
@@ -301,7 +303,7 @@
 				case CMDL_IP4: {
 					u32 *p = info[idx].wanted_val;
 					struct in_addr in;
-					if (!inet_aton(argp[i], &in))
+					if (!inet_pton(AF_INET, argp[i], &in))
 						exit_bad_args();
 					*p = in.s_addr;
 					break;
diff --git a/internal.h b/internal.h
index dd7d6ac..b80f77a 100644
--- a/internal.h
+++ b/internal.h
@@ -21,7 +21,7 @@
 #include <unistd.h>
 #include <endian.h>
 #include <sys/ioctl.h>
-#include <net/if.h>
+#include <linux/if.h>
 
 #include "json_writer.h"
 #include "json_print.h"
diff --git a/netlink/fec.c b/netlink/fec.c
index 695724e..6027dc0 100644
--- a/netlink/fec.c
+++ b/netlink/fec.c
@@ -9,6 +9,7 @@
 #include <ctype.h>
 #include <inttypes.h>
 #include <string.h>
+#include <strings.h>
 #include <stdio.h>
 
 #include "../internal.h"