]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
awk-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sat, 21 Jun 2025 21:31:17 +0000 (23:31 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 21 Jun 2025 21:36:00 +0000 (23:36 +0200)
Proof that it's valid:
$ echo 3.1415926 | gawk '{ printf "%.f", $1 }'

* gettext-tools/src/format-awk.c: Fix comment regarding the precision.
* gettext-tools/tests/format-awk-1: Add a test case with null precision.

gettext-tools/src/format-awk.c
gettext-tools/tests/format-awk-1

index ef2036bc275b8596f91015239ecbf812f0d9dbde..4ffb90106cc34013a249cc15103dc8b846b27839 100644 (file)
@@ -40,7 +40,7 @@
    - is optionally followed by a width specification: '*' (reads an argument)
      or '*m$' or a nonempty digit sequence,
    - is optionally followed by '.' and a precision specification: '*' (reads
-     an argument) or '*m$' or a nonempty digit sequence,
+     an argument) or '*m$' or an optional nonempty digit sequence,
    - is finished by a specifier
        - '%', that needs no argument,
        - 'c', that need a character argument,
index ce423cb0709e7b67bbb9f42758b292cbc5dbd24e..0cb413e274cd91e74c4ba39303ae067dab7f35e5 100755 (executable)
@@ -58,6 +58,8 @@ cat <<\EOF > f-a-1.data
 "abc%F"
 # Invalid: flags after width
 "abc%*0g"
+# Valid: null precision
+"abc%.f"
 # Invalid: twice precision
 "abc%.4.2g"
 # Valid: three arguments