1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

texi2txt: add workaround for a known bug in "mawk"

As reported by Douglas Torrance, the script that generates the plain text
documentation from the texinfo source would crash due to the cross-
references when the version of awk used is "mawk".

This is actually a known bug in mawk:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=172774

It looks like the bug have been fixed in mawk, but Debian is still
providing a broken version. To avoid problems, this patch is introducing a
workaround in the matching pattern that causes the issue every time it is
being used.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-04-18 23:56:19 +02:00
committed by Carlos R. Mafra
parent 842e145e0a
commit 2086eefb7e

View File

@@ -212,12 +212,12 @@ function end_conditional(name, local_i) {
# with @value; they can also be defined from command-line (-D) # with @value; they can also be defined from command-line (-D)
# they are stored in the global array "variable[name]" # they are stored in the global array "variable[name]"
function set_variable(line, local_idx, local_name, local_value) { function set_variable(line, local_idx, local_name, local_value) {
gsub(/^[ \t]*/, "", line); gsub(/^[ \t]+/, "", line);
local_idx = match(line, /[ \t]/); local_idx = match(line, /[ \t]/);
if (local_idx > 0) { if (local_idx > 0) {
local_name = substr(line, 1, local_idx - 1); local_name = substr(line, 1, local_idx - 1);
local_value = substr(line, local_idx + 1); local_value = substr(line, local_idx + 1);
gsub(/^[ \t]*/, "", local_value); gsub(/^[ \t]+/, "", local_value);
} else { } else {
local_name = line; local_name = line;
local_value = ""; local_value = "";
@@ -473,7 +473,7 @@ function new_node(args, local_nb, local_arr, local_i) {
if ((local_nb < 1) || (local_nb > 4)) { if ((local_nb < 1) || (local_nb > 4)) {
report_error("bad number of argument " local_nb " for @node at line " NR); report_error("bad number of argument " local_nb " for @node at line " NR);
} }
gsub(/^[ \t]*/, "", local_arr[1]); gsub(/^[ \t]+/, "", local_arr[1]);
gsub(/[ \t]*$/, "", local_arr[1]); gsub(/[ \t]*$/, "", local_arr[1]);
if (local_arr[1] == "") { if (local_arr[1] == "") {
report_error("missing node name for @node at line " NR); report_error("missing node name for @node at line " NR);
@@ -572,7 +572,7 @@ function generate_cross_reference(args, cmd, local_nb, local_arr, local
local_arr[1] = execute_commands(local_arr[1]); local_arr[1] = execute_commands(local_arr[1]);
for (local_i = 1; local_i <= local_nb; local_i++) { for (local_i = 1; local_i <= local_nb; local_i++) {
gsub(/^[ \t]*/, "", local_arr[local_i]); gsub(/^[ \t]+/, "", local_arr[local_i]);
gsub(/[ \t]*$/, "", local_arr[local_i]); gsub(/[ \t]*$/, "", local_arr[local_i]);
} }