These tools have served their purposes and need not be kept outside of the repository history any longer. This patch as a diff also collects the contents of the various tools in one convenient place. --- patch-1.gawk | 114 --------------------------------------------------- patch-3.gawk | 99 -------------------------------------------- patch-6.gawk | 21 ---------- 3 files changed, 234 deletions(-) delete mode 100755 patch-1.gawk delete mode 100755 patch-3.gawk delete mode 100755 patch-6.gawk
diff --git a/patch-1.gawk b/patch-1.gawk deleted file mode 100755 index af82707..0000000 --- a/patch-1.gawk +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/gawk -f -# -*- Awk -*- - -# Automate (most of) the refactoring of config.guess to use an intermediate variable -# for uname-based results. - -# GPLv3+ - -BEGIN { - if (ARGC < 2) ARGV[ARGC++] = "config.guess" - - Indent = "" - - In_main_case = 0 - - In_here_doc = 0 - Here_doc_end = "" - - If_depth = 0 - If_rewritten = 0 -} - -# Skip here documents -In_here_doc && $0 ~ /^[[:space:]]*EOF/ { In_here_doc = 0 } -In_here_doc { print; next } -/<</ { In_here_doc = 1 } -# Conveniently, all here documents in config.guess end with "EOF". - -# Track indentation -/^[[:space:]]*/ { - Indent_prev = Indent - match($0, /^[[:space:]]*/) - Indent = substr($0, RSTART, RLENGTH) -} - -# Insert initialization for GUESS variable -/^# CC_FOR_BUILD/ { - print "# just in case it came from the environment" - print "GUESS=" - print "" -} - -/^case \$UNAME_MACHINE:\$UNAME_SYSTEM/ { In_main_case = 1 } - -function rewrite_echo_line( i) { - $2 = "GUESS="$2 - for (i=2; i<=NF; i++) { - $(i-1)=$i - if ($i == "#") { - $(i-2) = $(i-2)" " - } - } - NF-- - $0 = Indent $0 -} - -# Track "if" depth within main case block -In_main_case && /^[[:space:]]+if / { If_depth++ } -In_main_case && /^[[:space:]]+fi/ { If_depth-- } - -In_main_case && If_depth > 0 && /^[[:space:]]+echo/ { - If_rewritten = 1 - rewrite_echo_line() -} - -In_main_case && /^[[:space:]]+exit ;;$/ && If_rewritten { - If_rewritten = 0 - print Indent";;" - next -} - -In_main_case && /^[[:space:]]+echo/ { - getline next_line - if (next_line !~ /^[[:space:]]+exit ;;/) { - # not the output-and-exit we seek here... - print - print next_line - next - } - - if (/-cray-/ && $3 == "|") { - # several Cray Unicos entries apply sed to the entire output in - # order to edit the UNAME_RELEASE field; fix these up - sub(/"\$UNAME_RELEASE"/, "\"$(echo &", $2) - $NF = $NF")\"" - } - - rewrite_echo_line() - if (next_line ~ /^[[:space:]]+exit ;;.+/) - sub(/^[[:space:]]+exit ;;/, ";; ", next_line) - else - sub(/^[[:space:]]+exit ;;/, ";;", next_line) - print $0 - print Indent next_line - next -} - -In_main_case && /^esac/ { - In_main_case = 0 - - print # "esac" - print "" - print "# Do we have a guess based on uname results?" - print "if test \"x$GUESS\" != x; then" - print " echo \"$GUESS\"" - print " exit" - print "fi" - - # Copy the rest of the input file - while (getline) print - nextfile -} - -{ print } diff --git a/patch-3.gawk b/patch-3.gawk deleted file mode 100755 index 7d4540d..0000000 --- a/patch-3.gawk +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/gawk -f -# -*- Awk -*- - -# Automate removing unneeded quotes in variable assignments and factoring -# out some command substitutions in config.guess. - -# GPLv3+ - -BEGIN { - if (ARGC < 2) ARGV[ARGC++] = "config.guess" - - Indent = "" - In_here_doc = 0 - Factor = "BOGUS!REL" -} - -# Skip here documents -In_here_doc && $0 ~ /^[[:space:]]*EOF/ { In_here_doc = 0 } -In_here_doc { print; next } -/<</ { In_here_doc = 1 } -# Conveniently, all here documents in config.guess end with "EOF". - -# Track indentation -/^[[:space:]]*/ { - Indent_prev = Indent - match($0, /^[[:space:]]*/) - Indent = substr($0, RSTART, RLENGTH) -} - -/^[[:space:]]+GUESS=/ { - $0 = gensub(/GUESS="([^"[[:space:]]+)"$/, "GUESS=\\1", 1) - $0 = gensub(/"(\$[[:alnum:]{}_]+)"([^[:alnum:]_]|$)/, "\\1\\2", "g") - $0 = gensub(/"\$([[:alnum:]_]+)"([[:alnum:]_]|$)/, "${\\1}\\2", "g") - if (/[[:space:]]#/) { - $0 = gensub(/[[:space:]]#/, repeat(" ", gsub(/\$/, "&"))"&", 1) - } - -} - -/\$\(echo \$[[:alnum:]_]+/ { - # requote variables inside command substitutions - $0 = gensub(/(\$\(echo )\$([[:alnum:]_]+)/, "\\1\"$\\2\"", "g") -} - -# Factor out $(echo "$UNAME_RELEASE" | sed ...) into variables... -# ... first, track what name to use: -/alpha:OSF1:/ { Factor = "OSF" } -/:SunOS:/ { Factor = "SUN" } -/:IRIX\*:/ { Factor = "IRIX" } -/CRAY[[:alnum:]*:-]+\)/ { Factor = "CRAY" } -/86:skyos:/ { Factor = "SKYOS" } -/:FreeBSD:/ { Factor = "FREEBSD" } -/:DragonFly:/ { Factor = "DRAGONFLY" } -# The GNU system is a very special case and is handled manually. -/:GNU(\/\*)?:/ { Factor = "GNU" } - -# ... second, split the GUESS= lines -/GUESS=/ && /\$\(echo[^|]+|.*sed/ && Factor != "GNU" { - base = index($0, "\"$(") - item = substr($0, base) - tail = "" - - # special handling to clean up some FreeBSD cases - if (Factor == "FREEBSD" && match($0, /-gnueabi/)) { - - # transfer the "-gnueabi" marker - tail = substr($0, RSTART) - $0 = substr($0, 1, RSTART-1); item = substr($0, base) - - # quote variable in inner substitution - sub(/echo \${UNAME_RELEASE}/, "echo \"$UNAME_RELEASE\"", item) - # remove unneeded braces - if (sub(/\${UNAME_PROCESSOR}/, "$UNAME_PROCESSOR")) - base -= 2 - } - - # standardize spacing around pipe - sub(/"\|sed/, "\" | sed", item) - - # remove quotes from command substitution - sub(/^"/, "", item); sub(/"$/, "", item) - - print Indent Factor"_REL="item - $0 = substr($0, 1, base-1)"$"Factor"_REL"tail -} - -# Copy the rest of the file after the edits are done -/^[[:space:]]+echo "\$GUESS"/ { - print - while (getline) print - nextfile -} - -{ print } - -function repeat(text, count, ret) { - for (ret = ""; count > 0; count--) ret = ret text - return ret -} diff --git a/patch-6.gawk b/patch-6.gawk deleted file mode 100755 index 19919d9..0000000 --- a/patch-6.gawk +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 } -- 2.17.1