Update post installation article url
[minix3.git] / bin / ksh / mkman
blob19592811ab152fd9714bd528d47b7ee59a9a2232
1 #!/bin/sh
3 : ${AWK:=awk}
5 verbose=no
7 if [ X"$1" = X-v ] ; then
8 verbose=yes
9 shift
11 if [ $# != 2 ] ; then
12 echo "usage: $0 [-v] which-shell ksh.Man-file" 1>&2
13 exit 1;
15 shell=$1
16 man=$2
18 case $shell in
19 sh) which=0;;
20 ksh) which=1;;
22 echo "$0: bad shell option (must be sh or ksh)" 1>&2
23 exit 1
25 esac
26 if [ ! -r "$man" ] ; then
27 echo "$0: can't read $man file" 1>&2
28 exit 1;
33 # Now generate the appropriate man page...
35 [ $verbose = yes ] && echo "$0: Generating $which man page (0=sh,1=ksh)..." 1>&2
37 ${AWK} 'BEGIN { ksh = '$which'; pr = 1 }
38 /^\.sh\(/ { pr = ksh - 1; next }
39 /^\.sh\)/ { pr = 1; next }
40 /^\.ksh\(/ { pr = ksh; next }
41 /^\.ksh\)/ { pr = 1; next }
42 { if (pr) print $0 } ' < $man
44 [ $verbose = yes ] && echo "$0: All done" 1>&2
46 exit 0