From 04f664a592137bccf67f39de12e655f950dea491 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2017 13:29:15 +0200
Subject: fix gcc2 parse errors


diff --git a/tests/test-quotearg-simple.c b/tests/test-quotearg-simple.c
index 516e890..971ccef 100644
--- a/tests/test-quotearg-simple.c
+++ b/tests/test-quotearg-simple.c
@@ -337,19 +337,23 @@ main (int argc _GL_UNUSED, char *argv[])
         /* Z points to the boundary between a readable/writable page
            and one that is neither readable nor writable.  Position
            our string so its NUL is at the end of the writable one.  */
-        char const *str = "____";
-        size_t s_len = strlen (str);
-        z -= s_len + 1;
-        memcpy (z, str, s_len + 1);
-
-        set_custom_quoting (NULL, q, q);
-        /* Whether this actually triggers a SEGV depends on the
-           implementation of memcmp: whether it compares only byte-at-
-           a-time, and from left to right (no SEGV) or some other way.  */
-        size_t n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL);
-        ASSERT (n == s_len + 2 * q_len);
-        ASSERT (memcmp (buf, q, sizeof buf) == 0);
-        free (q);
+        {
+        	char const *str = "____";
+        	size_t s_len = strlen (str);
+        	z -= s_len + 1;
+        	memcpy (z, str, s_len + 1);
+
+        	set_custom_quoting (NULL, q, q);
+        	/* Whether this actually triggers a SEGV depends on the
+        	implementation of memcmp: whether it compares only byte-at-
+            a-time, and from left to right (no SEGV) or some other way.  */
+        	{
+        		size_t n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL);
+        		ASSERT (n == s_len + 2 * q_len);
+        		ASSERT (memcmp (buf, q, sizeof buf) == 0);
+        		free (q);
+        	}
+        }
       }
   }
 
diff --git a/xargs/xargs.c b/xargs/xargs.c
index 1116cfe..5100633 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -1183,26 +1183,28 @@ prep_child_for_exec (void)
 
      We use 0 here in order to avoid generating a data structure that appears
      to indicate that we (the child) have a child. */
-  unsigned int slot = add_proc (0);
-  set_slot_var (slot);
+  {
+  	unsigned int slot = add_proc (0);
+  	set_slot_var (slot);
 
-  if (!keep_stdin)
-    {
-      const char inputfile[] = "/dev/null";
-      /* fprintf (stderr, "attaching stdin to /dev/null\n"); */
+  	if (!keep_stdin)
+    	{
+      	const char inputfile[] = "/dev/null";
+      	/* fprintf (stderr, "attaching stdin to /dev/null\n"); */
 
-      close (0);
-      if (open (inputfile, O_RDONLY) < 0)
-	{
-	  /* This is not entirely fatal, since
-	   * executing the child with a closed
-	   * stdin is almost as good as executing it
-	   * with its stdin attached to /dev/null.
-	   */
-	  error (0, errno, "%s",
-		 quotearg_n_style (0, locale_quoting_style, inputfile));
-	}
-    }
+      	close (0);
+      	if (open (inputfile, O_RDONLY) < 0)
+		{
+	  	/* This is not entirely fatal, since
+	   	* executing the child with a closed
+	   	* stdin is almost as good as executing it
+	   	* with its stdin attached to /dev/null.
+	   	*/
+	  	error (0, errno, "%s",
+		 	quotearg_n_style (0, locale_quoting_style, inputfile));
+		}
+    	}
+  }
 }
 
 
-- 
2.7.0


From f6bd0ec6d6c51cd2d45b9f531504cd2acb9a82ff Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2017 13:30:14 +0200
Subject: fix check needed for inet_pton


diff --git a/configure.ac b/configure.ac
index 876d981..ab1a600 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,8 @@ AC_HEADER_DIRENT
 AC_HEADER_STAT
 AC_HEADER_SYS_WAIT
 
+dnl Check for -lsocket -lnetwork inet
+AC_SEARCH_LIBS([socket],[socket inet network])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 
-- 
2.7.0


From 886cc62f8bc82305a675529bd0a5a423f6a64382 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 2 Sep 2017 14:01:27 +0200
Subject: fix ioctl conflict error


diff --git a/tests/sys_ioctl.in.h b/tests/sys_ioctl.in.h
index d3758ac..649acbf 100644
--- a/tests/sys_ioctl.in.h
+++ b/tests/sys_ioctl.in.h
@@ -56,7 +56,7 @@ _GL_CXXALIAS_RPL (ioctl, int,
 # else
 #  if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1
 _GL_FUNCDECL_SYS (ioctl, int,
-                  (int fd, int request, ... /* {void *,char *} arg */));
+                  (int fd, unsigned long request, ... /* {void *,char *} arg */));
 #  endif
 _GL_CXXALIAS_SYS (ioctl, int,
                   (int fd, int request, ... /* {void *,char *} arg */));
-- 
2.7.0

