/usr/share/doc/m4/examples/capitalize2.m4 is in m4 1.4.16-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | divert(`-1')
# upcase(text)
# downcase(text)
# capitalize(text)
# change case of text, improved version
define(`upcase', `translit(`$*', `a-z', `A-Z')')
define(`downcase', `translit(`$*', `A-Z', `a-z')')
define(`_arg1', `$1')
define(`_to_alt', `changequote(`<<[', `]>>')')
define(`_from_alt', `changequote(<<[`]>>, <<[']>>)')
define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)')
define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)')
define(`_capitalize_alt',
`regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>,
<<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)')
define(`capitalize',
`_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>,
_from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())')
divert`'dnl
|