From: Bruno Haible Date: Sun, 22 Jun 2025 01:17:40 +0000 (+0200) Subject: tcl-format: Accept null precision. X-Git-Tag: v0.26~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d6241d0fe87014d8e47147bcac4cecd9d263513;p=thirdparty%2Fgettext.git tcl-format: Accept null precision. 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. --- diff --git a/gettext-tools/src/format-tcl.c b/gettext-tools/src/format-tcl.c index c98a46469..9702e32e6 100644 --- a/gettext-tools/src/format-tcl.c +++ b/gettext-tools/src/format-tcl.c @@ -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, diff --git a/gettext-tools/tests/format-tcl-1 b/gettext-tools/tests/format-tcl-1 index 984f0c724..c4ecfc46a 100755 --- a/gettext-tools/tests/format-tcl-1 +++ b/gettext-tools/tests/format-tcl-1 @@ -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