From 0cb62e1010d9361fd57384fb5ff4254f517d4f66 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 9 Sep 2014 20:00:54 +0000
Subject: haiku patch


diff --git a/gettext-tools/src/x-lua.c b/gettext-tools/src/x-lua.c
index 78ac24f..4e3335f 100644
--- a/gettext-tools/src/x-lua.c
+++ b/gettext-tools/src/x-lua.c
@@ -281,9 +281,9 @@ phase2_getc ()
 
           if (c == '[')
             {
-              c = phase1_getc ();
 
               int esigns = 0;
+              c = phase1_getc ();
               while (c == '=')
                 {
                   esigns++;
@@ -709,11 +709,11 @@ phase3_get (token_ty *tp)
             }
           break;
 
-        case '[':
+        case '[': {
+          int esigns = 0;
           c = phase1_getc ();
 
           /* Count the number of equal signs.  */
-          int esigns = 0;
           while (c == '=')
             {
               esigns++;
@@ -745,10 +745,10 @@ phase3_get (token_ty *tp)
 
               if (c == ']')
                 {
+                  int esigns2 = 0;
                   c = phase1_getc ();
 
                   /* Count the number of equal signs.  */
-                  int esigns2 = 0;
                   while (c == '=')
                     {
                       esigns2++;
@@ -798,7 +798,7 @@ phase3_get (token_ty *tp)
                 }
             }
           break;
-
+        }
         case ']':
           tp->type = token_type_rbracket;
           return;
-- 
2.14.2


From aaac3efe7744efe434fc9314d54167f4bfae0c69 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 16 Oct 2014 08:51:57 +0200
Subject: Fix C99ism in tests.


diff --git a/gettext-tools/gnulib-lib/uniname/uniname.c b/gettext-tools/gnulib-lib/uniname/uniname.c
index 5da6ced..19ad886 100644
--- a/gettext-tools/gnulib-lib/uniname/uniname.c
+++ b/gettext-tools/gnulib-lib/uniname/uniname.c
@@ -375,6 +375,8 @@ unicode_name_character (const char *name)
       if (false)
       filled_buf:
         {
+          uint16_t words[UNICODE_CHARNAME_MAX_WORDS];
+          uint16_t *wordptr = words;
           {
             /* Special case for variation selector aliases. Keeps the
                tables small.  */
@@ -407,8 +409,6 @@ unicode_name_character (const char *name)
               }
           }
           /* Convert the constituents to uint16_t words.  */
-          uint16_t words[UNICODE_CHARNAME_MAX_WORDS];
-          uint16_t *wordptr = words;
           {
             const char *p1 = buf;
             for (;;)
diff --git a/gettext-tools/gnulib-tests/test-quotearg-simple.c b/gettext-tools/gnulib-tests/test-quotearg-simple.c
index 6bb4b35..8b07c5d 100644
--- a/gettext-tools/gnulib-tests/test-quotearg-simple.c
+++ b/gettext-tools/gnulib-tests/test-quotearg-simple.c
@@ -331,14 +331,16 @@ main (int argc _GL_UNUSED, char *argv[])
         size_t q_len = 1024;
         char *q = malloc (q_len + 1);
         char buf[10];
-        memset (q, 'Q', q_len);
-        q[q_len] = 0;
 
         /* 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);
+		size_t n;
+
+        memset (q, 'Q', q_len);
+        q[q_len] = 0;
         z -= s_len + 1;
         memcpy (z, str, s_len + 1);
 
@@ -346,7 +348,7 @@ main (int argc _GL_UNUSED, char *argv[])
         /* 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);
+        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);
-- 
2.14.2


From d4a16c8eb3c7dde8323460d316a5b378b78f1158 Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Fri, 24 Nov 2017 21:43:10 +0100
Subject: Fix texi2html errors with newer perl versions.


diff --git a/gettext-runtime/libasprintf/texi2html b/gettext-runtime/libasprintf/texi2html
index 7c94d5b..69c9e84 100755
--- a/gettext-runtime/libasprintf/texi2html
+++ b/gettext-runtime/libasprintf/texi2html
@@ -879,7 +879,7 @@ while ($_ = &next_line) {
     s/\@refill\s+//g;
     # other substitutions
     &simple_substitutions;
-    s/\@value{($VARRE)}/$value{$1}/eg;
+    s/\@value\{($VARRE)}/$value{$1}/eg;
     s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
     #
     # analyze the tag again
@@ -1204,7 +1204,7 @@ while (@lines) {
     #
     # xref
     #
-    while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) {
+    while (/\@(x|px|info|)ref\{($XREFRE)(}?)/o) {
 	# note: Texinfo may accept other characters
 	($type, $nodes, $full) = ($1, $2, $3);
 	($before, $after) = ($`, $');
@@ -1810,7 +1810,7 @@ sub substitute_style {
     while ($changed) {
 	$changed = 0;
 	$done = '';
-	while (/\@(\w+|"|\~|,|\^){([^\{\}]+)}/) {
+	while (/\@(\w+|"|\~|,|\^)\{([^\{\}]+)}/) {
 	    $text = &apply_style($1, $2);
 	    if ($text) {
 		$_ = "$`$text$'";
diff --git a/gettext-tools/doc/texi2html b/gettext-tools/doc/texi2html
index 7c94d5b..69c9e84 100755
--- a/gettext-tools/doc/texi2html
+++ b/gettext-tools/doc/texi2html
@@ -879,7 +879,7 @@ while ($_ = &next_line) {
     s/\@refill\s+//g;
     # other substitutions
     &simple_substitutions;
-    s/\@value{($VARRE)}/$value{$1}/eg;
+    s/\@value\{($VARRE)}/$value{$1}/eg;
     s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
     #
     # analyze the tag again
@@ -1204,7 +1204,7 @@ while (@lines) {
     #
     # xref
     #
-    while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) {
+    while (/\@(x|px|info|)ref\{($XREFRE)(}?)/o) {
 	# note: Texinfo may accept other characters
 	($type, $nodes, $full) = ($1, $2, $3);
 	($before, $after) = ($`, $');
@@ -1810,7 +1810,7 @@ sub substitute_style {
     while ($changed) {
 	$changed = 0;
 	$done = '';
-	while (/\@(\w+|"|\~|,|\^){([^\{\}]+)}/) {
+	while (/\@(\w+|"|\~|,|\^)\{([^\{\}]+)}/) {
 	    $text = &apply_style($1, $2);
 	    if ($text) {
 		$_ = "$`$text$'";
-- 
2.14.2

