From: Gary V. Vaughan Date: Fri, 21 Sep 2012 14:02:39 +0000 (+0700) Subject: maint: script to fix prohibit_test_const_follows_var syntax-check. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc9e7b55fcb1f25d68aca4691c9eaca2a7438a51;p=thirdparty%2Flibtool.git maint: script to fix prohibit_test_const_follows_var syntax-check. Manually fixing these with 962aa91 caused several regressions, so write a program to redo it. * build-aux/fix_prohibit_test_const_follows_var: New (throwaway) awk script to programatically find and correct violations flagged by the prohibit_test_const_follows_var syntax-check. Signed-off-by: Gary V. Vaughan --- diff --git a/build-aux/fix_prohibit_test_const_follows_var b/build-aux/fix_prohibit_test_const_follows_var new file mode 100755 index 000000000..9d7ad0557 --- /dev/null +++ b/build-aux/fix_prohibit_test_const_follows_var @@ -0,0 +1,126 @@ +#!/usr/bin/env gawk -f + +BEGIN { + tail = "(\\)|]|&&|\\|\\||;|\\\\?$)"; + + # ( \1 ) ( \2 ) + lhsx = "(\\ "x$foo" + line = gensub ("\\<([.xX])\"([^$\"]*\\${?\\w[^\"]*)\"", + "\"\\1\\2\"", "g", line) + + + + ## SIMPLIFY ## + + # test "$foo" = '' -> test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -z "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\ test -n "$foo" + line = gensub ("\\