diff options
Diffstat (limited to 'tools/man2html1.tcl')
-rw-r--r-- | tools/man2html1.tcl | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/tools/man2html1.tcl b/tools/man2html1.tcl index be969f9..f2b2e43 100644 --- a/tools/man2html1.tcl +++ b/tools/man2html1.tcl @@ -5,6 +5,8 @@ # # Copyright (c) 1996 by Sun Microsystems, Inc. +package require Tcl 8.4 + # Global variables used by these scripts: # # state - state variable that controls action of text proc. @@ -24,7 +26,6 @@ # inDT - in dictionary term. - # text -- # # This procedure adds entries to the hypertext arrays NAME_file @@ -36,7 +37,6 @@ # Arguments: # string - Text to index. - proc text string { global state curFile NAME_file KEY_file inDT @@ -72,12 +72,12 @@ proc text string { proc macro {name args} { switch $name { - SH { + SH - SS { global state switch $args { NAME { - if {$state == "INIT" } { + if {$state eq "INIT"} { set state NAME } } @@ -97,8 +97,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 } @@ -106,7 +106,6 @@ proc macro {name args} { } - # dash -- # # This procedure is invoked to handle dash characters ("\-" in @@ -117,13 +116,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. @@ -138,8 +136,6 @@ proc newline {} { } - - # initGlobals, tab, font, char, macro2 -- # # These procedures do nothing during the first pass. @@ -181,14 +177,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 } @@ -212,8 +208,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 @@ -236,8 +233,6 @@ proc doContents {file packageName} { } - - # do -- # # This is the toplevel procedure that searches a man page @@ -263,4 +258,3 @@ proc do fileName { exit 1 } } - |