6 usage="usage: $MYNAME [man-directory]
7 (generates permuted index of -man files in directory)"
12 echo "$MYNAME: no man directory specified: assuming $md"
24 echo "Permuted index of $md:"
26 # ------ clumsy permuted index macros (replaced by stuff below) ------------
30 \\$1 \\$2 \\fB\\$3\\fR \\$4
\ 1 \\s-1\\$5\\s0
38 .tl '\s-2\\fIpermuted index\\fP\s0'\- \\n% \-'\s-2\\fIpermuted index\\fP\s0'
46 .ta 6.5i-1.1iR 6.5iR 6.51iR 6.52R
52 # ------ ------- ------- ------- ------- -------
53 # ------ alternate permuted index macros (from net) ------------
61 .tl '\s-2\\fIpermuted index\\fP\s0'\- \\n% \-'\s-2\\fIpermuted index\\fP\s0'
69 .tr ~ \" tildes will translate to blanks
70 '\".ll 80 \" line length of output
71 .ll 6.0i \" line length of output
72 .nf \" must be in no-fill mode
73 .nr )r \n(.lu-10n \" set position of reference in line (10 less than length)
74 .nr )k \n()ru/2u \" set position of keyword (approx. centered)
75 .ds s2 ~~~ \" this is the center gap -- 3 spaces
76 .de xx \"definition of xx macro
77 .ds s1\" \" initialise to null string
78 .if \w@\\$2@ .ds s1 ~\" \"set to single blank if there is second arg
79 .ds s3\" \" initialise to null string
80 .if \w@\\$4@ .ds s3 ~\" \"set to single blank if there is second arg
81 .ds s4 ~\" \" set to single blank
82 .ds s5 ~\" \" set to single blank
83 .ds y \\*(s4\a\\*(s5\" \" blank, leader, blank
84 .ta \\n()ru-\w@\\*(s5@u \" set tab just to left of ref
85 \h@\\n()ku-\w@\\$1\\*(s1\\$2\\*(s2@u@\\$1\\*(s1\\$2\\*(s2\\$3\\*(s3\\$4\\*y\\$5
89 # ------ ------- ------- ------- ------- -------
90 find $md -type f -name "*.[1-8nl]*" -print |
94 man=`expr "$man" : "\(.*\)\.[^\.]*"`
97 # Use 1st non-"." and non-"'" started line as input to ptx (this
98 # should be the synopsis after the `.SH NAME');
99 # strip any "\-" from it (a silly sort key for ptx to avoid);
100 # insert a leading man page name for the -r option to find
102 sed -n '/^[^.]/s/\\-//g;/^[^.]/p;/^[^.]/q' $f | sed "s/^/($man) /"
103 done | ptx -t -f -r >> $out
105 # Turn the troff'able permuted index file into PostScript
107 psroff -t -rL10i $out > ptx.ps
108 echo "$out and ptx.ps produced from man directory $md."