diff options
author | Eric Blake <ebb9@byu.net> | 2009-03-12 19:25:01 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-03-13 19:31:21 -0600 |
commit | 59344a14f7d2c95b185c8a7f9a79e63968e7879c (patch) | |
tree | 032ba88a66135b9ff1dc480c1bab1201a5213326 | |
parent | 2eb2fe897ad172856543e09aee26db4f52090904 (diff) | |
download | m4-59344a14f7d2c95b185c8a7f9a79e63968e7879c.tar.gz |
Fix awk script portability.
* checks/get-them: In gsub, properly escape {.
Reported by Gary V. Vaughan.
Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit c05bae4ccb7b39543b019d612a4bdb6b7c6f0b08)
-rw-r--r-- | ChangeLog | 4 | ||||
-rwxr-xr-x | tests/generate.awk | 15 |
2 files changed, 12 insertions, 7 deletions
@@ -1,5 +1,9 @@ 2009-03-13 Eric Blake <ebb9@byu.net> + Fix awk script portability. + * checks/get-them: In gsub, properly escape {. + Reported by Gary V. Vaughan. + Make bootstrap easier on Solaris. * bootstrap: Add GNULIB_SRCDIR. Useful when a wrapper script gnulib-tool exists earlier on the path to work around /bin/sh diff --git a/tests/generate.awk b/tests/generate.awk index 538dc096..f4e782e0 100755 --- a/tests/generate.awk +++ b/tests/generate.awk @@ -1,6 +1,6 @@ # Extract all examples from the manual source. -*- AWK -*- -# Copyright (C) 1992, 2000, 2001, 2006, 2007, 2008 Free Software +# Copyright (C) 1992, 2000, 2001, 2006, 2007, 2008, 2009 Free Software # Foundation, Inc. # # This file is part of GNU M4. @@ -28,7 +28,8 @@ BEGIN { # I don't know how to get this file's name, so it's hard coded :( print "# Do not edit by hand, it was generated by generate.awk."; print "#"; - print "# Copyright (C) 1992, 2000, 2001, 2006 Free Software Foundation, Inc."; + print "# Copyright (C) 1992, 2000, 2001, 2006, 2007, 2008, 2009 Free"; + print "# Software Foundation, Inc."; print ; print "AT_BANNER([Documentation examples.])"; print ; @@ -134,13 +135,13 @@ function normalize(contents, i, lines, n, line, res) { for (i = 1; i < n; ++i) { line = lines[i]; - gsub (/^@result\{\}/, "", line); - gsub (/^@error\{\}/, "", line); + gsub ("^@result[{]}", "", line); + gsub ("^@error[{]}", "", line); gsub ("@[{]", "{", line); gsub ("@}", "}", line); gsub ("@@", "@", line); - gsub ("@tabchar{}", "\t", line); - gsub ("@w{ }", " @\\&t@", line); + gsub ("@tabchar[{]}", "\t", line); + gsub ("@w[{] }", " @\\&t@", line); gsub ("m4_", "m@\\&t@4_", line); # Some of the examples have improperly balanced square brackets. @@ -154,7 +155,7 @@ function normalize(contents, i, lines, n, line, res) { function new_group(node) { banner = node ". "; - gsub (/./, "-", banner); + gsub (".", "-", banner); printf ("\n\n"); printf ("## %s ##\n", banner); printf ("## %s. ##\n", node); |