# HG changeset patch # Parent 3c7b74d47ca39768baf9d91bba40141bf111bc21 # User Nico R. # Date 1321439581 -3600 Fix problems with GNU awk 4.0. Original patch taken from upstream CVS, and mechanism applied to all code parts where ‘gsub’ is used. diff --git a/binsrc/cached_resources/res_to_c.awk b/binsrc/cached_resources/res_to_c.awk --- a/binsrc/cached_resources/res_to_c.awk +++ b/binsrc/cached_resources/res_to_c.awk @@ -30,7 +30,14 @@ } { fun = $0 - gsub ( /\\/, "\\\\", fun) + + q = "\\\\" + if (PROCINFO["version"] ~ /^4/) + gsub ( q, q q, fun) + else + gsub ( q, q, fun) + #WAS: gsub ( /\\/, "\\\\", fun) + gsub ( /"/, "\\\"", fun) gsub ( /\$/, "\\044", fun) gsub ( /.*/, "\"&\\n\",", fun) diff --git a/binsrc/hosting/perl/pl_to_c.awk b/binsrc/hosting/perl/pl_to_c.awk --- a/binsrc/hosting/perl/pl_to_c.awk +++ b/binsrc/hosting/perl/pl_to_c.awk @@ -42,7 +42,14 @@ } x = $0 - gsub (/\\/, "\\\\", x) + + q = "\\\\" + if (PROCINFO["version"] ~ /^4/) + gsub ( q, q q, x) + else + gsub ( q, q, x) + #WAS: gsub (/\\/, "\\\\", x) + gsub (/\"/, "\\\"", x) print "\"" x "\\n\"" } diff --git a/binsrc/hosting/python/py_to_c.awk b/binsrc/hosting/python/py_to_c.awk --- a/binsrc/hosting/python/py_to_c.awk +++ b/binsrc/hosting/python/py_to_c.awk @@ -48,7 +48,14 @@ } x = $0 - gsub (/\\/, "\\\\", x) + + q = "\\\\" + if (PROCINFO["version"] ~ /^4/) + gsub ( q, q q, x) + else + gsub ( q, q, x) + #WAS: gsub (/\\/, "\\\\", x) + gsub (/\"/, "\\\"", x) print "\"" x "\\n\"" } diff --git a/binsrc/ws/wsrm/xsd2sql.awk b/binsrc/ws/wsrm/xsd2sql.awk --- a/binsrc/ws/wsrm/xsd2sql.awk +++ b/binsrc/ws/wsrm/xsd2sql.awk @@ -54,7 +54,14 @@ print " ses := string_output ();" } str = $0 - gsub ( /\\/, "\\\\", str) + + q = "\\\\" + if (PROCINFO["version"] ~ /^4/) + gsub ( q, q q, str) + else + gsub ( q, q, str) + #WAS: gsub ( /\\/, "\\\\", str) + gsub ( /'/, "\\'", str) # diff --git a/libsrc/Wi/sql_to_c.awk b/libsrc/Wi/sql_to_c.awk --- a/libsrc/Wi/sql_to_c.awk +++ b/libsrc/Wi/sql_to_c.awk @@ -340,9 +340,17 @@ if (length() < 2) next } + # does escape the symbols fun = $0 - gsub ( /\\/, "\\\\", fun) + q = "\\\\" + if (PROCINFO["version"] ~ /^4/) + gsub ( q, q q, fun) + else + gsub ( q, q, fun) + + #WAS: gsub ( /\\/, "\\\\", fun) + # remove whitespace except when there is just a semicolon if ((in_xsl_mode == 0) && (in_xsd_mode == 0)) {