Viewing man pages in Windows and MinGW/MSYS

You can download here mandoc binaries built for Windows. These binaries would allow you to format and view man pages in Windows or MinGW/MSYS.

2014-11-02

Manual pages, also called man pages, are a well supported, popular way to document software in Unix, BSD, and GNU/Linux operating systems. A text formatter program is required to process the intrinsic formats of man pages into other formats suitable for viewing. GNU/Linux systems typically use groff and some BSD systems, like OpenBSD for example, use mandoc suite of programs as a text formatter. To view man pages in Windows, however, you still need a formatting program. Hence we have decided to build for Windows the main programs of mandoc suite and put together the binaries for download with a short explanation on usage and building from sources.

The fastest way to start is to read the disclaimers at the end of this page as well as authors' license file. If you agree to the terms and conditions stated in the disclaimers and the license file, you can download mdocml-1.13.1-win32-embedeo-02.zip file (~440KB); extract its contents; possibly, add its bin-directory to your PATH; run the mandoc program with the man page file that you wish to view and pipe the output to a pager program. The default pager in an ordinary Windows system is more. So a minimal usage example will look like:

> mandoc.exe manpage.1 | more

In MinGW/MSYS less is a better pager:

$ mandoc.exe manpage.1 | less

Mandoc can also output nice looking HTML, optionally with a style sheet and links. Mandoc sources come with two sample style sheets example.style.css and style.css that are worth experimenting with. The first one is also copied during installation, so it could be found in the share/examples/mandoc/ of the binary package. HTML output can be specified, for example, like this:

mandoc.exe -Thtml -Oman=%N.%S.html manpage.1 > manpage.html
mandoc.exe -Thtml -Ostyle=style.css -Oman=%N.%S.html mandoc.1 > mandoc.1.html

Mutibyte encoded man pages, for example in UTF-8, need first recoding with the included preconv program. This example converts the French manual of gpasm, part of gputils:

preconv.exe -e utf-8 fr/man1/gpasm.1 | mandoc.exe -Thtml > gpasm.1.html

We have built the above mentioned Windows binaries in MinGW/MSYS with modifications mdocml-1.13.1-embedeo-02.patch (~37KB) atop original mandoc source tarball 1.13.1 mdocml-1.13.1.tar.gz with some additional software from other authors.

The default MinGW installation lacks POSIX-compliant memory mapping like mmap() and related functions, so we have installed and linked against mman-win32, which is a MIT licensed, lightweight wrapper library and it is sufficient for the purpose. You can install the library libmman.a from its sources in mman.zip file (~7KB).

The vasprintf() and wcwidth() functions are not available in a typical MinGW and Windows environments, and although their implementations (source files) are already included in our patch here are links to vasprintf.c for vasprintf() under modified BSD licence and wcwidth.c for wcwidth() under a permissive license. Both licenses and authors' information are also included in their files and therefore also in our patch without any modification.

Our own work in mdocml-1.13.1-embedeo-02.patch is public domain and WE DISCLAIM ALL WARRANTIES WITH REGARD TO ANY SOFTWARE IN SOURCE OR BINARY FORM, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.

As we aimed at building only the main parts of mandoc suite, it will only work for base-build target. For example, in MinGW/MSYS the build commands could be:

$ make base-build
$ make base-install PREFIX=/home/embedeo/mdocml-win32 INSTALL=install.exe

We would like to thank all the authors and contributors of mandoc suite, mman-win32, vasprintf.c and wcwidth.c!

All trademarks and registered trademarks appearing on this page are the property of their respective owners.

Copyright (C) 2017 embedeo.com Terms of use and legal disclaimer