]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
perl-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 00:16:38 +0000 (02:16 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 00:16:38 +0000 (02:16 +0200)
Proof that it's valid:
$ perl
printf "%.f", 3.1415926535

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

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

index f6e11d0754cf2c49a4bfa51c61470287c7542fcf..5e37a833448bd794c082fd624a48d2105b4c60cd 100644 (file)
@@ -46,7 +46,7 @@
      a nonempty digit sequence starting with a nonzero digit,
    - is optionally followed by '.' and a precision specification: '*' (reads
      an argument) or '*m$' where m is a positive integer starting with a
-     nonzero digit or a digit sequence,
+     nonzero digit or an optional nonempty digit sequence,
    - is optionally followed by a size specifier, one of 'h' 'l' 'll' 'L' 'q'
      'V' 'I32' 'I64' 'I',
    - is finished by a specifier
index 090795a75f9ff882e37b0e58a16008e5faef7a3d..119ecb310efa9b37cdcff0f30faad2cb11ab5cd9 100755 (executable)
@@ -88,6 +88,8 @@ cat <<\EOF > f-pl-1.data
 "abc%y"
 # Invalid: flags after width
 "abc%*0g"
+# Valid: null precision
+"abc%.f"
 # Invalid: twice precision
 "abc%.4.2g"
 # Valid: three arguments