1

I'm wondering a few things about man pages and man utility.

man seems to be implemented as a pipeline of basic commands, such as (over-simplified):

zcat /path/to/man/page.3.gz | groff -man | less

However, there is some logic implemented: reading /etc/man.config, reading the database index, browse manpath directories, etc.

1

So my first question is: where can I find the source code for man utility? I guess different implementations exist, so I'm mainly interested in GNU or SYSV systems (I'm using Fedora).

2

My second question is about compression utility and configuration. Man pages can be compressed using gzip. Gzipped pages are natively unzipped by man. However, xz seems to have a better compression rate than gzip.

Are there some man implementations that are compatible with xz? Here is an excerpt from a man page of man (https://linux.die.net/man/1/man):

if the filename has a known compression suffix (like .gz), man assumes it is gzipped.

This is a bit unclear for me. From my point of view xz is a "known compression suffix", but it is contradictory with "man assumes it is gzipped", and I couldn't find no mention of using xz and man together.

The config file /etc/manpath.config allows to define for example a different pager that less. So I was wondering if we could define in the same fashion a different "zipper" in order to use xz instead of gzip.

Community
  • 1
  • 1
randruc
  • 11
  • 1

1 Answers1

0

Self-answer

1

Many Linux distributions (including Fedora) rely on the man-db project. Project websites here:

http://www.nongnu.org/man-db/

https://savannah.nongnu.org/projects/man-db

2

After inspecting the source code, and testing with an official release, man-db does support xz compression.

randruc
  • 11
  • 1