config/patch-6.gawk
Jacob Bachmeyer d70c4fa934 config.guess: replace POSIX $( ) with classic throughout
The previous replacement of backticks with POSIX command substitutions
was ill-considered and illogical: this script recognizes many archaic
machine types that probably never had POSIX shells, therefore it needs
to be able to run successfully under pre-POSIX shells.

This patch was generated using the included GNU Awk program.

* config.guess: Revert POSIX command substitutions to classic form.
* patch-6.gawk: Store the tool that produced the automated patch.
2021-05-26 04:47:05 +00:00

22 lines
560 B
Awk
Executable File

#!/usr/bin/gawk -f
# -*- Awk -*-
# Automate reversion of $( ) substitutions to classic `` form.
# GPLv3+
BEGIN {
if (ARGC < 2) ARGV[ARGC++] = "config.guess"
}
# fix a special case of forgotten quotes
/\$\(\$dummy\)/ { sub(/\$\(\$dummy\)/, "$(\"$dummy\")") }
/\$\( \(/ { $0 = gensub(/\$\( (\([^()]+\)[^()]*)\)/, "`\\1`", "g") }
/\$\(/ { $0 = gensub(/\$\(([^()]+)\)/, "`\\1`", "g") }
/\$\( \(.*'/ { $0 = gensub(/\$\( (\([^()]+'[^']+'[^()]*\)[^()]*)\)/, "`\\1`", "g") }
/\$\(.*'/ { $0 = gensub(/\$\(([^()]+'[^']+'[^()]*)\)/, "`\\1`", "g") }
{ print }