]> git.ipfire.org Git - thirdparty/man-pages.git/commit
scripts/sortman: Use version sort
authorAlejandro Colomar <alx@kernel.org>
Sun, 13 Aug 2023 21:00:45 +0000 (23:00 +0200)
committerAlejandro Colomar <alx@kernel.org>
Sun, 13 Aug 2023 22:11:24 +0000 (00:11 +0200)
commitaab14503ef101d918046aeaa941f226685fe7bf5
tree6d5e796f82cb8cf6e8bd609d62e75aa2d8b3e1ee
parent993910a218af7a8871225edf378c54da0e341cfc
scripts/sortman: Use version sort

This is to collate correctly pages like the following:

man7/iso-8859-1.7
man7/iso-8859-2.7
man7/iso-8859-3.7
man7/iso-8859-4.7
man7/iso-8859-5.7
man7/iso-8859-6.7
man7/iso-8859-7.7
man7/iso-8859-8.7
man7/iso-8859-9.7
man7/iso-8859-10.7
man7/iso-8859-11.7
man7/iso-8859-13.7
man7/iso-8859-14.7
man7/iso-8859-15.7
man7/iso-8859-16.7

Also ignore case, since otherwise a version sort would collate 'Z'
before 'a'.  We don't need LC_COLLATE anymore.

Version sort has some issues for our purpose: underscores and dashes
have special (and different) meaning.  We want to ignore underscores or
dashes that aren't next to digits, so that _exit(2) remains next to
exit(2).  However, we want to keep them next to digits, such as in
iso-8859-1(7), to keep the right order for pages with numbers.  For
that, we need some extra sed(1) magic.

Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca>
Cc: Deri James <deri@chuzzlewit.myzen.co.uk>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
scripts/sortman