xref: /386bsd/usr/bin/catman (revision a2142627)
1#!/bin/sh
2# usage: sh catman
3# put the section numbers here:
4SECTIONS="1 2 3 4 5 6 7 8"
5MANDIR=/usr/share/man
6
7formatman()
8{
9	echo "	"$1 "->" $*
10	(cd cat$section; rm -f $*)
11	nroff -man < man$section/$1 > cat$section/$1
12	catfile=$1; shift
13	while [ $# -gt 0 ]
14	do
15		ln cat$section/$catfile cat$section/$1
16		shift
17	done
18}
19
20cd $MANDIR
21for section in $SECTIONS
22do
23  echo formatting section $section ...
24
25  IFS=" "
26  allfiles=`ls -i1 man$section | sort | awk '{if (inode ~ $1) printf "/" $2;
27		 else printf " " $2; inode = $1 } END {printf "\n"}'`
28  for files in $allfiles
29  do
30    IFS="/"
31    tfiles=`echo $files`
32    IFS=" "
33    formatman $tfiles
34  done
35done
36exit 0
37