]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
librep-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sat, 21 Jun 2025 23:30:12 +0000 (01:30 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 21 Jun 2025 23:30:12 +0000 (01:30 +0200)
Proof that it's valid:
$ rep
(format t "%.d" 3.1415926535)

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

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

index 264e122b617f86ce246fcc3f4dd8a8cf8bf4608b..2e202535628ab511338aeec0a9eb84a65f6aa82a 100644 (file)
@@ -38,8 +38,8 @@
      each of which acts as a flag,
    - is optionally followed by a width specification: a nonempty digit
      sequence,
-   - is optionally followed by '.' and a precision specification: a nonempty
-     digit sequence,
+   - is optionally followed by '.' and a precision specification: an optional
+     nonempty digit sequence,
    - is finished by a specifier
        - '%', that needs no argument,
        - 'c', that need a character argument,
index cffaa89b7fca7c27949c6424200d168916422548..b54dafda04dcf12180f20eb004a19dc3800f99a0 100755 (executable)
@@ -34,6 +34,8 @@ cat <<\EOF > f-lr-1.data
 "abc%y"
 # Invalid: flags after width
 "abc%2^d"
+# Valid: null precision
+"abc%.d"
 # Invalid: twice precision
 "abc%.4.2d"
 # Valid: three arguments