]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
tcl-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 01:17:40 +0000 (03:17 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 01:17:40 +0000 (03:17 +0200)
Proof that it's valid:
$ tclsh
puts [format "%.f" 3.1415926535]

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

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

index c98a4646929c96b9a2000899cb96595c427f2d46..9702e32e607143b892c937de8202e6a2c80643d8 100644 (file)
@@ -41,7 +41,7 @@
    - is optionally followed by a width specification: '*' (reads an argument)
      or a nonempty digit sequence,
    - is optionally followed by '.' and a precision specification: '*' (reads
-     an argument) or a nonempty digit sequence,
+     an argument) or an optional nonempty digit sequence,
    - is optionally followed by a size specifier, 'h' or 'l'. 'l' is ignored.
    - is finished by a specifier
        - '%', that needs no argument,
index 984f0c72427558fb488b3243768983e78700a5ba..c4ecfc46a18db06407219eff782188884c887990 100755 (executable)
@@ -58,6 +58,8 @@ cat <<\EOF > f-t-1.data
 "abc%F"
 # Invalid: flags after width
 "abc%*0g"
+# Valid: null precision
+"abc%.f"
 # Invalid: twice precision
 "abc%.4.2g"
 # Valid: three arguments