diff options
Diffstat (limited to 'tools/man2html1.tcl')
-rw-r--r-- | tools/man2html1.tcl | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/tools/man2html1.tcl b/tools/man2html1.tcl index 0adc61e..59dc396 100644 --- a/tools/man2html1.tcl +++ b/tools/man2html1.tcl @@ -8,6 +8,8 @@ # SCCS: @(#) man2html1.tcl 1.2 96/03/21 10:48:29 # +package require Tcl 8.4 + # Global variables used by these scripts: # # state - state variable that controls action of text proc. @@ -27,7 +29,6 @@ # inDT - in dictionary term. - # text -- # # This procedure adds entries to the hypertext arrays NAME_file @@ -39,7 +40,6 @@ # Arguments: # string - Text to index. - proc text string { global state curFile NAME_file KEY_file inDT @@ -80,7 +80,7 @@ proc macro {name args} { switch $args { NAME { - if {$state == "INIT" } { + if {$state eq "INIT"} { set state NAME } } @@ -100,8 +100,8 @@ proc macro {name args} { set inDT 0 set state INIT if {[llength $args] != 5} { - set args [join $args " "] - puts stderr "Bad .TH macro: .$name $args" + set args [join $args " "] + puts stderr "Bad .TH macro: .$name $args" } set lib [lindex $args 3] ;# Tcl or Tk } @@ -109,7 +109,6 @@ proc macro {name args} { } - # dash -- # # This procedure is invoked to handle dash characters ("\-" in @@ -120,13 +119,12 @@ proc macro {name args} { proc dash {} { global state - if {$state == "NAME"} { + if {$state eq "NAME"} { set state DASH } } - # newline -- # # This procedure is invoked to handle newlines in the troff input. @@ -141,8 +139,6 @@ proc newline {} { } - - # initGlobals, tab, font, char, macro2 -- # # These procedures do nothing during the first pass. @@ -184,14 +180,14 @@ proc doListing {file pattern} { return } incr max_len - set ncols [expr 90/$max_len] - set nrows [expr int( ceil( [llength $type] / $ncols. ) ) ] + set ncols [expr {90/$max_len}] + set nrows [expr {int(ceil([llength $type] / double($ncols)))} ] # ? max_len ncols nrows set index 0 foreach f $type { - lappend row([expr $index % $nrows]) $f + lappend row([expr {$index % $nrows}]) $f incr index } @@ -215,8 +211,9 @@ proc doListing {file pattern} { # # Arguments: # file - name of the contents file. -# packageName - string used in the title and sub-heads of the HTML page. Normally -# name of the package without version numbers. +# packageName - string used in the title and sub-heads of the HTML +# page. Normally name of the package without version +# numbers. proc doContents {file packageName} { global footer @@ -239,8 +236,6 @@ proc doContents {file packageName} { } - - # do -- # # This is the toplevel procedure that searches a man page @@ -266,4 +261,3 @@ proc do fileName { exit 1 } } - |