| 1 | #!/bin/bash |
| 2 | # manview.sh: Formats the source of a man page for viewing. |
| 3 | |
| 4 | # This script is useful when writing man page source. |
| 5 | # It lets you look at the intermediate results on the fly |
| 6 | #+ while working on it. |
| 7 | |
| 8 | E_WRONGARGS=85 |
| 9 | |
| 10 | if [ -z "$1" ] |
| 11 | then |
| 12 | echo "Usage: `basename $0` filename" |
| 13 | exit $E_WRONGARGS |
| 14 | fi |
| 15 | |
| 16 | # --------------------------- |
| 17 | groff -Tascii -man $1 | less |
| 18 | # From the man page for groff. |
| 19 | # --------------------------- |
| 20 | |
| 21 | # If the man page includes tables and/or equations, |
| 22 | #+ then the above code will barf. |
| 23 | # The following line can handle such cases. |
| 24 | # |
| 25 | # gtbl < "$1" | geqn -Tlatin1 | groff -Tlatin1 -mtty-char -man |
| 26 | # |
| 27 | # Thanks, S.C. |
| 28 | |
| 29 | exit $? # See also the "maned.sh" script. |