]> git.ipfire.org Git - thirdparty/coreutils.git/commit
expr: add multibyte support
authorAssaf Gordon <assafgordon@gmail.com>
Wed, 28 Jun 2017 01:23:52 +0000 (01:23 +0000)
committerAssaf Gordon <assafgordon@gmail.com>
Wed, 28 Jun 2017 01:23:52 +0000 (01:23 +0000)
commita9f2be5bfec2bfe86c0851787312996467a653ee
tree1379a1fd2ff74e64fb78e5d19b973e99194f1c43
parente13fe20049166da816cc5102f13210264c866008
expr: add multibyte support

Discussed in https://bugs.gnu.org/26779 .

* NEWS: Mention the improvement.
* bootstrap.conf: Add gnulib modules mbslen,mbschr.
* src/expr.c (mbs_logical_substr): New function to return a substring
based on logical character positions (instead of bytes).
(mbs_logical_cspn): Similar to strcspn/mbscspn, but returns number of
logical characters instead of byte offset.
(mbs_offset_to_chars): New function to return number of logical
characters fitting in a given byte offset.
(docolon): Report matched logical characters instead of bytes.
(eval6): For length/substr/index operations, use logical characters
instead of bytes by calling the above new functions.
* tests/misc/expr.pl: Repeat all tests with non-C locale to detect any
regressions.
* tests/misc/expr-multibyte.pl: New tests with multibyte input.
* tests/local.mk: Add new test file.
NEWS
bootstrap.conf
src/expr.c
tests/local.mk
tests/misc/expr-multibyte.pl [new file with mode: 0755]
tests/misc/expr.pl