diff options
Diffstat (limited to 'tools/man2html1.tcl')
| -rw-r--r-- | tools/man2html1.tcl | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/tools/man2html1.tcl b/tools/man2html1.tcl index 2e8ba52..64982ff 100644 --- a/tools/man2html1.tcl +++ b/tools/man2html1.tcl @@ -4,14 +4,11 @@ # man page to html conversion process. It is sourced by h.tcl. # # Copyright (c) 1996 by Sun Microsystems, Inc. -# -# SCCS: @(#) man2html1.tcl 1.2 96/03/21 10:48:29 -# # Global variables used by these scripts: # # state - state variable that controls action of text proc. -# +# # curFile - tail of current man page. # # file - file pointer; for both xref.tcl and contents.html @@ -24,8 +21,7 @@ # # lib - contains package name. Used to label section in contents.html # -# inDT - in dictionary term. - +# inDT - in dictionary term. # text -- @@ -34,12 +30,11 @@ # and KEY_file. # # DT: might do this: if first word of $dt matches $name and [llength $name==1] -# and [llength $dt > 1], then add to NAME_file. +# and [llength $dt > 1], then add to NAME_file. # # Arguments: # string - Text to index. - proc text string { global state curFile NAME_file KEY_file inDT @@ -75,12 +70,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 } } @@ -89,7 +84,7 @@ proc macro {name args} { KEYWORDS {set state KEY} default {set state OFF} } - + } TP { global inDT @@ -100,8 +95,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 +104,6 @@ proc macro {name args} { } - # dash -- # # This procedure is invoked to handle dash characters ("\-" in @@ -120,13 +114,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,11 +134,9 @@ proc newline {} { } - - # initGlobals, tab, font, char, macro2 -- # -# These procedures do nothing during the first pass. +# These procedures do nothing during the first pass. # # Arguments: # None. @@ -184,14 +175,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,14 +206,15 @@ 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 - + set file [open $file w] - + puts $file "<HTML><HEAD><TITLE>$packageName Manual</TITLE></HEAD><BODY>" puts $file "<H3>$packageName</H3>" doListing $file "*.1" @@ -239,14 +231,12 @@ proc doContents {file packageName} { } - - # do -- # # This is the toplevel procedure that searches a man page # for hypertext links. It builds a data base consisting of -# two arrays: NAME_file and KEY file. It runs the man2tcl -# program to turn the man page into a script, then it evals +# two arrays: NAME_file and KEY file. It runs the man2tcl +# program to turn the man page into a script, then it evals # that script. # # Arguments: @@ -266,4 +256,3 @@ proc do fileName { exit 1 } } - |
