pub/scm/docs/man-pages/man-pages-posix.git  about / heads / tags
POSIX manual pages - sections 0p, 1p, 3p
$ git log --pretty=format:'%h %s (%cs)%d'
3032a29 complex.h.0p, stdint.h.0p, sys_socket.h.0p, bc.1p, cksum.1p, pax.1p, cexp.3p, cpow.3p, drand48.3p, exp2.3p, expm1.3p, hypot.3p, initstate.3p, ldexp.3p, logb.3p, pow.3p, rand.3p, remquo.3p, scalbln.3p: Use '**' to indicate power-of (2021-02-14)
	(HEAD -> master)
ce17d65 posix.py: ffix: Correctly format URIs (2021-01-20)
f94759d man-pages-posix-2013-a.lsm: Add (2020-12-03)
d049cc1 Add generated POSIX.1-2008 TC 2 pages (2020-11-05)
d96e2de Add pages that were produced for the POSIX.1-2008 TC 1 release (2020-11-05)
91d9972 Add pages long ago generated by Andries Brouwer for POSIX.1-2001 TC 1 (2020-11-05)
f26107f README: Add notes on clean-up after page generation (2020-11-05)
836678a Add .gitignore (2020-11-05)
5b3a141 README: Add a few details (2020-11-04)
c9e4bf8 man-pages-posix-2017-a.Announce: tfix (2020-11-04)
...

$ git cat-file blob HEAD:README
Conversion of Open Group's troff sources to POSIX man pages
===========================================================

This directory contains files and scripts that are used to convert
the POSIX manual pages to 'man' format, suitable for release by the
Linux man-pages project.

1. Necessary data:
==================

* obtainable from The Open Group
  - directory with the troff sources [1]
  - file ,xref.5 containing information to crossreferences
  - file _strings.def containing information to references to other
    standards
* obtainable online
  - the HTML version of the standard [2]

[1] The troff sources are not part of this repository, and must be
    obtained by contacting The Open Group.
[2] As at November 2020, the HTML version of the standard can be
    downloaded from https://pubs.opengroup.org/onlinepubs/9699919799/.


The directory of troff sources contains four directories: "Builtins",
"Commands", "Functions", "Headers". (Some of these contain
subdirectories with "LEGACY" interfaces.) The directories contain .mm
and .h files containing groff_mm files with extensions by The Open
Group. Upon request one can also obtain a file defining their custom
macros but this file is not necessary for the scripts.

A relevant line in ,xref.5 could look like

gropdf-info:href workdir page 104 Section 3.441

It contains a label ("workdir"), the page number and the
section number.

A line in _strings.def might look like

.ds Z5 ISO\ POSIX\(hy1 standard

This tells us how to translate the escape sequence \*(Z5 .

The HTML version of the standard can be obtained at

http://pubs.opengroup.org/onlinepubs/9699919799/download/index.html

The relevant files for the scripts are basedefs/V1_chap*.html,
functions/V2_chap*.html, utilities/V3_chap*.html and
xrat/V4_*_chap*.html. These are parts of the standard we do not
have the sources for.

2. Procedure to generate the man pages
======================================

Change your directory to the directory containing the conversion
scripts. Type

./,xref.1.awk < ,xref.5 > ,xref.1
./,xref.py /path/to/HTML_version_of_standard > ,xref

to generate ,xref and

sed -f _strings.sed _strings.def > _strings

to generate _strings. With this done you can start generating
individual man pages. To generate all pages use:

./posix.py 0p /path/to/troff_sources/Headers/*.h
./posix.py 1p /path/to/troff_sources/Built-Ins/*.mm
./posix.py 1p /path/to/troff_sources/Commands/*.mm
./posix.py 3p /path/to/troff_sources/Functions/*.mm

You can now find the converted pages in your current working
directory.

Clean up:

rm ,xref ,xref.1 _strings

3. Description of the included scripts
======================================

,xref.1.awk takes ,xref.5 from its standard input, strips
irrelevant lines and transforms lines of the form

gropdf-info:href whitespace page 103 Section 3.436

to

   whitespace Section 3.436

,xref.1.py expects ,xref.1 generated from ,xref.1.awk in the
current working directory and the path to the HTML version of
the standard as its first argument. It extracts section, table
and figure names for parts of the standard we do not have sources
for, adds them to the xrefs and writes them to standard output.
For the example, inside

/path/to/HTML_version_of_standard/basedefs/V1_chap03.html

it finds a line

class; see also <a href="#tag_03_436">White Space</a>.</p>

and therefore outputs

whitespace Section 3.436, White Space

to ,xref.

The sed script _strings.sed does a simple conversion of lines of
the form

.ds Z5 ISO\ POSIX\(hy1 standard

to

\*(Z5	ISO\ POSIX\(hy1 standard

The main script is posix.py. It takes the name of the man section
as its first argument and the names of the pages to be converted
as its other arguments. Furthermore, it expects the data files
,xref and _strings in its current working directory. It outputs
converted man pages to its current working directory.

Notes:

A final processing of the xrefs happens in posix.py: On the one
hand the section names for cross-references internal to the
current page are added.  On the other hand the references to
other man pages are correctly formatted. The order of the entries
in ,xref is used to deduce the right section number. This could
also be achieved by careful examining the source directory.

The code in posix.py to get the indentation right by inserting
".RS ..." and ".RE" in the right places is very hacky and might
fail with pages with a slightly more complex structure then now.

# heads (aka `branches'):
$ git for-each-ref --sort=-creatordate refs/heads \
	--format='%(HEAD) %(refname:short) %(subject) (%(creatordate:short))'
* master       complex.h.0p, stdint.h.0p, sys_socket.h.0p, bc.1p, cksum.1p, pax.1p, cexp.3p, cpow.3p, drand48.3p, exp2.3p, expm1.3p, hypot.3p, initstate.3p, ldexp.3p, logb.3p, pow.3p, rand.3p, remquo.3p, scalbln.3p: Use '**' to indicate power-of (2021-02-14)

# tags:
$ git for-each-ref --sort=-creatordate refs/tags \
	--format='%(refname:short) %(subject) (%(creatordate:short))'
# no tags, yet...

# associated public inboxes:
# (number on the left is used for dev purposes)
         40 lkml
         20 linux-man
         12 stable
         12 u-boot
          9 netdev
          8 linux-arm-kernel
          7 qemu-devel
          5 linux-devicetree
          5 linux-patches
          4 buildroot
          3 linux-block
          3 linux-fsdevel
          3 linux-arm-msm
          3 linux-mm
          3 xen-devel
          3 alsa-devel
          3 linux-btrfs
          3 linux-renesas-soc
          3 linuxppc-dev
          3 kvm
          3 git
          3 dri-devel
          3 linux-raid
          2 linux-wireless
          2 linux-riscv
          2 linux-xfs
          2 bpf
          2 linux-clk
          2 linux-bluetooth
          2 linux-api
          2 openembedded-devel
          2 qemu-riscv
          1 linux-mtd
          1 linux-efi
          1 linux-acpi
          1 linux-media
          1 linux-snps-arc
          1 linux-mips
          1 linux-pm
          1 driverdev-devel
          1 linux-usb
          1 linux-kselftest
          1 linux-rdma
          1 linux-next
          1 linux-parisc
          1 dpdk-dev
          1 linux-security-module
          1 linux-pci
          1 linux-f2fs-devel
          1 linux-serial
          1 linux-watchdog
          1 selinux-refpolicy
          1 util-linux
          1 linux-mmc
          1 intel-gfx
          1 cip-dev
          1 linux-omap
          1 linux-spi
          1 linux-tegra
          1 linux-fpga
          1 linux-arch
          1 soc
          1 linux-s390
          1 sparclinux
          1 openembedded-core
          1 yocto-meta-arago
          1 kexec
          1 batman
          1 kvm-ppc
          1 linux-alpha
          1 linux-hexagon
          1 linux-metag
          1 bridge
          1 perfbook

git clone https://yhbt.net/lore/pub/scm/docs/man-pages/man-pages-posix.git