summaryrefslogtreecommitdiff
path: root/lang/tclX/files/patch-af
blob: a9339d197188addff1bb35b13e20c835ffe000f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- unix/tools/bldmanhelp.tcl	Thu Dec  2 15:33:05 2004
+++ unix/tools/bldmanhelp.tcl	Mon Jun 26 19:51:14 2006
@@ -12,8 +12,7 @@
 # The command line is:
 #
-#   bldmanhelp docdir maninfo helpdir
+#   bldmanhelp maninfo helpdir
 #
 # Where:
-#    o docdir is the directory containing the manual pages.
 #    o maninfo is the path to a file that when sources returns a list of
 #      entries describing manual pages to convert.  Each entry is a list
@@ -70,15 +69,27 @@
     global skipSection
 
-    set stat [catch {
-        open $manPage
-    } fh]
+    set section [lindex [split $manPage .] end]
+    set manPage [file rootname $manPage]
+    set manPage [split [exec man -w $section $manPage] ":)"]
+    if {[llength $manPage] > 1} { # Get the source, not from cat
+	set manPage [string trim [lindex $manPage 1]]
+    }
+    
+    if {[string match *.gz $manPage]} {
+	set stat [catch {open "|gzip -d -c $manPage"} fh]
+    } elseif {[string match *.bz2 $manPage]} {
+	set stat [catch {open "|bzip2 -d -c $manPage"} fh]
+    } else {
+	set stat [catch {open $manPage} fh]
+    }
     if {$stat != 0} {
         global gotErrors
         set gotErrors 1
-        puts stderr "can't open \"$manPage\" $fh"
+        puts stderr "can't open \"$manPage\" $fh. (cwd is [pwd])"
         return
     }
     while {[gets $fh line] >= 0} {
         switch -glob -- $line {
+	    {.so man.macros} {}
             .so* {
                 CopyManPage [lindex $line 1] $outFH
@@ -120,9 +131,8 @@
 #
 
-proc GenInputFile {docDir manInfoTbl tmpFile} {
+proc GenInputFile {manInfoTbl tmpFile} {
 
    set tmpFH [open $tmpFile w]
    set cwd [pwd]
-   cd $docDir
 
    foreach ent $manInfoTbl {
@@ -145,5 +155,4 @@
 set tmpFile "bldmanhelp.tmp"
 
-set docDir [lindex $argv 0]
 set manInfoTbl [source [lindex $argv 1]]
 set helpDir [lindex $argv 2]
@@ -151,5 +160,5 @@
 
 puts stdout "Begin preprocessing UCB manual files"
-GenInputFile $docDir $manInfoTbl $tmpFile
+GenInputFile $manInfoTbl $tmpFile
 
 buildhelp $helpDir $brief [list $tmpFile]