Read Man Pages from Multiple Operating Systems
Introduction
As an user or developer of the Unix-like operating system, it’s beneficial
to have multiple versions of the man
command for reading man
pages
from different operating systems for your reference.
Why would you want to do this?
First, for interoperability. A FreeBSD
developer may want to know the implementation details of the same
system call in the Linux kernel. Similarly, a Linux developer may
want to borrow some helpful BSD functions (via libbsd
) - if there’s
already a common library used by many common programs like OpenSSH,
you may as well use it rather than reinventing the wheel.
For example, NetBSD contains some helpful C functions for bitstring
manipulations. But you have to be aware of these functions before
they can help you.
It also avoids occasional confusions: kernel.org
maintains the
Linux Programmer’s Manual and POSIX Programmer’s Manual
simultaneously, although they mostly documents the same commands and
APIs, but they can differ greatly. Reading them by calling different
commands avoids this problem.
Second, for a better understanding. Sometimes the man page of one operating system is easier to understand than another operating system, or offers new information. For example, most BSD man pages have a History section, which is absent in the Linux Programmer’s Manual. Also, if you are confused by the description, try again with a different author is often helpful.
Third, for critical reading. Projects sometimes have different approaches and opinions on technical issues, and biases are sometimes subtly reflected in the documentation.
For example, the unsafe C function
atoi()
.
In the Linux Programmer’s Manual, it says “The behavior is the same as
strtol()
, except that atoi()
does not detect errors.” Meanwhile,
in the FreeBSD Library Functions Manual, it says “The atoi()
function has been deprecated by strtol()
and should not be used
in new code.” Meanwhile, the OpenBSD man page’s position is: "
but strtonum(3)
can be used to convert numbers from strings much
more safely and easily."
As seen here, OpenBSD has the strongest attitude on safe programming
as expected. Another interesting observation is that strtonum()
is
supported by FreeBSD, but the recommendation of strtonum()
did not
appear in FreeBSD 12.2’s man page. If you a new user and only have
access to the FreeBSD homepage, strtonum()
can easily be missed.
Doing a comparative and critical reading is helpful here.