home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/wish -f
- ####################################
- # man.tk
- # man page viewer hack
- # Bob Bagwill - no rights reserved
- ####################################
- set sections {1 2 3 4 5 6 7 8 l n}
- set ALPHABET {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
- set alphabet {a b c d e f g h i j k l m n o p q r s t u v w x y z}
- set Alphabet [concat $ALPHABET $alphabet]
-
- set mandir /usr/man/man
-
- proc display page {
- catch {destroy .$page}
- toplevel .$page
- wm minsize .$page 80 25
- button .$page.ok -text OK -command "destroy .$page"
- text .$page.text -setgrid true -yscroll ".$page.scroll set"
- scrollbar .$page.scroll -command ".$page.text yview"
- pack append .$page .$page.ok {bottom fillx} \
- .$page.scroll {right filly} .$page.text {fill expand}
- .$page.text insert 1.0 [exec man -D $page]
- }
-
- wm title . man
-
- foreach h $sections {
- frame .$h
- label .$h.l$h -width 8 -relief raised -text $h
- pack append .$h .$h.l$h left
- foreach i $Alphabet {
- if {[glob -nocomplain $mandir$h/$i*] != ""} {
- menubutton .$h.$i -text $i -menu .$h.$i.m
- pack append .$h .$h.$i left
- menu .$h.$i.m
- foreach j [lsort [glob -nocomplain $mandir$h/$i*]] {
- if {$j != ""} {
- set manpage [file root [file tail $j]]
- .$h.$i.m add command -label $manpage -command "display $manpage"
- }
- }
- }
- }
- pack append . .$h {top fillx}
- }
- bind all <Control-q> {destroy .}
- ################
- # end of man.tk
- ################
-