diff options
Diffstat (limited to 'tools/man2help.tcl')
| -rw-r--r-- | tools/man2help.tcl | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/tools/man2help.tcl b/tools/man2help.tcl index 130fde2..018fa84 100644 --- a/tools/man2help.tcl +++ b/tools/man2help.tcl @@ -5,14 +5,14 @@ # entries. # # Copyright (c) 1996 by Sun Microsystems, Inc. -# -# RCS: @(#) $Id: man2help.tcl,v 1.7 2000/11/24 14:17:12 dkf Exp $ -# # # PASS 1 # +set man2tclprog [file join [file dirname [info script]] \ + man2tcl[file extension [info nameofexecutable]]] + proc generateContents {basename version files} { global curID topics set curID 0 @@ -21,12 +21,18 @@ proc generateContents {basename version files} { flush stdout doFile $f } - set fd [open "$basename$version.cnt" w] + set fd [open [file join [file dirname [info script]] $basename$version.cnt] w] fconfigure $fd -translation crlf puts $fd ":Base $basename$version.hlp" foreach package [getPackages] { foreach section [getSections $package] { + if {![info exists lastSection]} { + set lastSection {} + } + if {[string compare $lastSection $section]} { puts $fd "1 $section" + } + set lastSection $section set lastTopic {} foreach topic [getTopics $package $section] { if {[string compare $lastTopic $topic]} { @@ -55,9 +61,9 @@ proc generateHelp {basename files} { } } - set file [open "$basename.rtf" w] + set file [open [file join [file dirname [info script]] $basename.rtf] w] fconfigure $file -translation crlf - puts $file "\{\\rtf1\\ansi \\deff0\\deflang1033\{\\fonttbl\{\\f0\\froman\\fcharset0\\fprq2 Times New Roman\;\}\}" + puts $file "\{\\rtf1\\ansi \\deff0\\deflang1033\{\\fonttbl\{\\f0\\froman\\fcharset0\\fprq2 Times New Roman\;\}\{\\f1\\fmodern\\fcharset0\\fprq1 Courier New\;\}\}" foreach f $files { puts "Pass 2 -- $f" flush stdout @@ -78,8 +84,8 @@ proc generateHelp {basename files} { # file - Name of file to translate. proc doFile {file} { - if {[catch {eval [exec man2tcl [glob $file]]} msg] && - [catch {eval [exec ./man2tcl [glob $file]]} msg]} { + global man2tclprog + if {[catch {eval [exec $man2tclprog [glob $file]]} msg]} { global errorInfo puts stderr $msg puts "in" @@ -99,21 +105,27 @@ proc doFile {file} { proc doDir dir { puts "Generating man pages for $dir..." foreach f [lsort [glob -directory $dir "*.\[13n\]"]] { - do $f + doFile $f } } # process command line arguments if {$argc < 3} { - puts stderr "usage: $argv0 projectName version manFiles..." + puts stderr "usage: $argv0 \[options\] projectName version manFiles..." exit 1 } -set baseName [lindex $argv 0] -set version [lindex $argv 1] +set arg 0 + +if {![string compare [lindex $argv $arg] "-bitmap"]} { + set bitmap [lindex $argv [incr arg]] + incr arg +} +set baseName [lindex $argv $arg] +set version [lindex $argv [incr arg]] set files {} -foreach i [lrange $argv 2 end] { +foreach i [lrange $argv [incr arg] end] { set i [file join $i] if {[file isdir $i]} { foreach f [lsort [glob -directory $i "*.\[13n\]"]] { @@ -123,8 +135,7 @@ foreach i [lrange $argv 2 end] { lappend files $i } } - -source [file join [file dir $argv0] index.tcl] +source [file join [file dirname [info script]] index.tcl] generateContents $baseName $version $files -source [file join [file dir $argv0] man2help2.tcl] +source [file join [file dirname [info script]] man2help2.tcl] generateHelp $baseName $files |
