summaryrefslogtreecommitdiff
blob: 2e9bcc2828d6a4fac3be79307cc3dc30a228305e (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
diff -urN tkman-2.2~/Makefile tkman-2.2/Makefile
--- tkman-2.2~/Makefile	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/Makefile	2008-12-05 17:37:55.000000000 -0600
@@ -97,7 +97,7 @@
 # at the closest DPI in this list
 dpis = "75 100"
 
-
+manxlongtmp = [exec mktemp -p /tmp tkman.XXXXXXXXXX]
 # # # MACHINE DEPENDENCIES # # #
 
 #manformat = {tbl | neqn | nroff -man }
@@ -113,7 +113,7 @@
 # Lines are cached in .../man/cat<n>@<line-length>; 
 #   that is, the line length is appended to the usual cache directory names
 #manformat = {groff -te -Tascii -man /tmp/ll -}
-manformat = {groff -te -Tlatin1 -man /tmp/ll -}
+manformat = "groff -te -Tlatin1 -mandoc $$manx(longtmp) -"
 # Ultrix users should uncomment the following line (you don't have eqn)
 #manformat = {tbl | nroff -man }
 # HP-UX uses a number of macros that groff doesn't define, so use the builtin nroff
@@ -362,6 +362,7 @@
 	echo 'set man(texinfodir) $(texinfodir)' >> tkman
 	echo 'set man(gzgrep) $(gzgrep)' >> tkman
 	echo 'set man(rfcdir) $(rfcdir)' >> tkman
+	echo 'set manx(longtmp) $(manxlongtmp)' >> tkman
 	echo 'set man(format) $(manformat)' >> tkman
 	echo 'set man(printers) $(printers)' >> tkman
 	echo 'set manx(dpis) $(dpis)' >> tkman
diff -urN tkman-2.2~/contrib/outline.tcl tkman-2.2/contrib/outline.tcl
--- tkman-2.2~/contrib/outline.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/contrib/outline.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -71,7 +71,7 @@
 
 	text [set t .inv] -font {Times 12 {}} -wrap word -borderwidth 3 -padx 5 -pady 5 -yscrollcommand "[set v .v] set"
 	set finv [expr 1-[catch {$t tag configure invis -elide 1}]]
-	if !$finv { puts "you must apply the elided text patches first"; exit 0 }
+	if !$finv { puts "you must apply the elided text patches first"; CLEANUP; exit 0 }
 
 	scrollbar $v -orient vertical -command "$t yview"
 
diff -urN tkman-2.2~/contrib/remote.tcl tkman-2.2/contrib/remote.tcl
--- tkman-2.2~/contrib/remote.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/contrib/remote.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -26,6 +26,7 @@
 				if {$res=="1"} {set ready 1}
 			} elseif {[string match "*insecure*" info]} {
 				puts stderr "can't talk to an insecure server -- see send(n)"
+				CLEANUP
 				exit 1
 			}
 		}
diff -urN tkman-2.2~/contrib/tkmanclient tkman-2.2/contrib/tkmanclient
--- tkman-2.2~/contrib/tkmanclient	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/contrib/tkmanclient	2008-12-05 17:37:55.000000000 -0600
@@ -60,7 +60,7 @@
 }
 
 set tkman [ check_for_tkman ]
-if { $tkman == 0 } { puts stderr "couldnt start tkman!"; exit 1; }
+if { $tkman == 0 } { puts stderr "couldnt start tkman!"; CLEANUP; exit 1; }
 
 set apropos 0
 set instNew 0
diff -urN tkman-2.2~/database.tcl tkman-2.2/database.tcl
--- tkman-2.2~/database.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/database.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -41,6 +41,7 @@
 	if {![llength $manx(manList)]} {
 		puts stderr "Can't find any man pages!"
 		puts stderr "MANPATH = $env(MANPATH)"
+		CLEANUP
 		exit 1
 	}
 
diff -urN tkman-2.2~/gui.tcl tkman-2.2/gui.tcl
--- tkman-2.2~/gui.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/gui.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -66,7 +66,7 @@
 		wm protocol $w WM_SAVE_YOURSELF "manSave"
 		wm command $w [concat $argv0 $argv]
 		# aborts without saving .tkman
-		wm protocol $w WM_DELETE_WINDOW {exit 0}
+		wm protocol $w WM_DELETE_WINDOW {CLEANUP; exit 0}
 
 		# some braindead window managers ignore iconposition requests after window is iconified, so special setting here
 		if {[regexp $manx(posnregexp) $manx(iconposition) all x y]} {wm iconposition $w $x $y}
@@ -221,7 +221,7 @@
 		-command "incr stat(checkpoint); manSave; manWinstdout \$curwin {[bolg $manx(startup) ~] updated}"
 #	if {!$dup} { ... but menu shared!
 		$m add separator
-		$m add command -label "Quit, don't update $manx(startup-short)" -command "exit 0"
+		$m add command -label "Quit, don't update $manx(startup-short)" -command "CLEANUP; exit 0"
 #	}
 	}
 
@@ -537,8 +537,8 @@
 		"
 
 	### quit
-	button $w.quit -text "Quit" -command "manSave; exit 0" -padx 4
-	if {!$manx(quit)} {$w.quit configure -command "exit 0"}
+	button $w.quit -text "Quit" -command "manSave; CLEANUP; exit 0" -padx 4
+	if {!$manx(quit)} {$w.quit configure -command "CLEANUP; exit 0"}
 	if {$dup} {
 		$w.quit configure -text "Close" -command "
 			destroy $w; incr manx(outcnt) -1; manOutput
diff -urN tkman-2.2~/manpath.tcl tkman-2.2/manpath.tcl
--- tkman-2.2~/manpath.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/manpath.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -138,6 +138,7 @@
 	if {![llength $manx(paths)]} {
 		if {$manx(manpath-warnings) ne ""} {puts stderr $manx(manpath-warnings)}
 		puts stderr "NO VALID DIRECTORIES IN MANPATH!\a"
+		CLEANUP
 		exit 1
 	}
 }
diff -urN tkman-2.2~/prefs.tcl tkman-2.2/prefs.tcl
--- tkman-2.2~/prefs.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/prefs.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -365,7 +365,7 @@
 	pack $g.nroffsave $g.columns $g.fsstnd-always $g.texinfodir $g.recentdays $g.preferTexinfo $g.tryfuzzy $g.preferGNU \
 		$g.maxglimpse $g.maxglimpseexcerpt $g.indexglimpse $g.glimpsestrays $g.indexalso \
 		-fill x -pady 3 -padx 4
-	if {![string match "*groff*/tmp/ll -*" $man(format)]} {pack forget $g.columns}
+	if {![string match "*groff*$manx(longtmp) -*" $man(format)]} {pack forget $g.columns}
 
 
 
@@ -791,7 +791,7 @@
 		bold {set weight "bold"}
 		italics {set slant "italic"}
 		bold-italics {set weight "bold"; set slant "italic"}
-		default {puts stderr "nonexistent style: $style"; exit 1}
+		default {puts stderr "nonexistent style: $style"; CLEANUP; exit 1}
 	}
 
 	# specify s,m,l within small,medium,large; or set absolute point size
diff -urN tkman-2.2~/taputils.tcl tkman-2.2/taputils.tcl
--- tkman-2.2~/taputils.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/taputils.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -98,7 +98,7 @@
 proc assert {bool msg {boom 0}} {
 	if {!$bool} {
 		puts stderr $msg
-		if {$boom} {exit 1}
+		if {$boom} {CLEANUP; exit 1}
 	}
 }
 
diff -urN tkman-2.2~/tkman.tcl tkman-2.2/tkman.tcl
--- tkman-2.2~/tkman.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/tkman.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -539,7 +539,7 @@
 proc manMenuFit {m} {
 	global man manx
 
-	if {[winfo class $m]!="Menu"} {puts stderr "$m not of Menu class"; exit 1}
+	if {[winfo class $m]!="Menu"} {puts stderr "$m not of Menu class"; CLEANUP; exit 1}
 	if {[$m index last] eq "none"} return
 
 	set sh [winfo screenheight $m]
@@ -1827,7 +1827,7 @@
 	if {$inx<[llength $manx(binvars)]} {
 		after 1000 manBinCheck $inx $err
 	} else {
-		if {$err} {exit 1}
+		if {$err} {CLEANUP; exit 1}
 		.occ entryconfigure "Statistics*" -state normal
 	}
 
@@ -1850,6 +1850,7 @@
 				}
 				puts -nonewline "tkman"
 				foreach line [split [textmanip::linebreak $helptxt 70] "\n"] { puts "\t$line" }
+				CLEANUP
 				exit 0
 			}
 			-M {set env(MANPATH) $val; incr i}
@@ -1868,11 +1869,11 @@
 			-start* {set manx(startup) $val; incr i}
 			-data* {puts stderr "-database option obsolete: database kept in memory"; incr i}
 			--v* -
-			-v* {puts stdout "TkMan v$manx(version) of $manx(date)"; exit 0}
+			-v* {puts stdout "TkMan v$manx(version) of $manx(date)"; CLEANUP; exit 0}
 			-t* {set manx(title) $val; incr i}
 			-d* {set manx(debug) 1; set manx(quit) 0; set manx(iconify) 0}
 			-nod* {set manx(debug) 0}
-			-* {puts stdout "[file tail $argv0]: unrecognized option: $arg"; exit 1}
+			-* {puts stdout "[file tail $argv0]: unrecognized option: $arg"; CLEANUP; exit 1}
 			default {
 				after 2000 manShowMan $arg {{}} .man
 				# permit several???  add extras to History?
@@ -1888,6 +1889,7 @@
 proc ASSERT {args} {
 	if {![uplevel 1 eval $args]} {
 		puts "ASSERTION VIOLATED: $args"
+		CLEANUP
 		exit 1
 	}
 }
@@ -1906,7 +1908,10 @@
 	set manx(lastclick) $clicknow
 }
 
-
+proc CLEANUP {} {
+	global manx
+	if { [file exists $manx(longtmp)] == 1 } { file delete $manx(longtmp) }
+}
 
 
 ##################################################
@@ -1919,6 +1924,7 @@
 if {[package vcompare [info tclversion] $manx(mintcl)]==-1 || [package vcompare $tk_version $manx(mintk)]==-1} {
 	puts -nonewline stderr "Tcl $manx(mintcl)/Tk $manx(mintk) minimum versions required.  "
 	puts stderr "You have Tcl [info tclversion]/Tk $tk_version"
+	CLEANUP
 	exit 1
 } elseif {int([info tclversion])-int($manx(mintcl))>=1 || int($tk_version)-int($manx(mintk))>=1} {
 	puts stderr "New major versions of Tcl and/or Tk may have introduced\nincompatibilies in TkMan.\nCheck the TkMan home site for a possible new version.\n"
@@ -2111,7 +2117,6 @@
 set manx(line-scale) 1; set manx(screen-scale) 45; set manx(page-scale) [expr int(60*1.5)]
 set man(error-effect) "bell & flash"; set manx(error-effect-v) [set manx(error-effect-t) {"bell & flash" "bell" "flash" "none"}]
 set man(columns) 65; set manx(columns-v) {65 90 130 5000}; set manx(columns-t) {"65 (most compatible)" 90 130 "wrap to screen width"}; # no one would want shorter lines
-set manx(longtmp) /tmp/ll
 set man(volcol) 4.0c; set manx(volcol-v) {0 1.5c 2.0c 2.5c 3.0c 3.5c 4.0c 4.5c 5.0c 7.5c 10.0c}; set manx(volcol-t) {"no columns" "1.5 cm" "2 cm" "2.5 cm/~1 inch" "3 cm" "3.5 cm" "4 cm" "4.5 cm" "5.0 cm/~2 inches" "7.5 cm" "10 cm"}
 set man(apropostab) "4.5c"; set manx(apropostab-v) {0 3.0c 4.0c 4.5c 5.0c 5.5c 6.0c 7.5c 10.0c}; set manx(apropostab-t) {"none" "3 cm" "4 cm" "4.5 cm" "5 cm" "5.5 cm" "6 cm" "7.5 cm" "10 cm"}
 #set man(showoutsub) ""
@@ -2258,7 +2263,7 @@
 regexp {(\d\d\d\d)/(\d\d)/(\d\d)} {$Date: 2003/04/01 23:02:52 $} manx(date) y m d
 set manx(mtime) [clock scan "$m/$d/$y"]
 set manx(stray-warnings) ""
-if {[catch {set default(manList) 0}]} {puts "\aBLT conflicts with TkMan."; exit 1}
+if {[catch {set default(manList) 0}]} {puts "\aBLT conflicts with TkMan."; CLEANUP; exit 1}
 set manx(manList) $man(manList)
 set manx(manTitleList) $man(manTitleList)
 set manx(userconfig) "### your additions go below"
@@ -2385,6 +2390,7 @@
 	if {[string match "#!*" [gets $fid line]]} {
 		puts stderr "$manx(startup) looks like an executable."
 		puts stderr "You should delete it, probably."
+		CLEANUP
 		exit 1
 	}
 
@@ -2613,6 +2619,7 @@
 
 if {[llength $man(manList)]!=[llength $man(manTitleList)]} {
 	puts stderr "Length of section abbreviations differs from length of section titles:\n\nlength [llength $man(manList)]:\t$man(manList)\n\nlength [llength $man(manTitleList)]:\t$man(manTitleList)"
+	CLEANUP
 	exit 1
 }
 
diff -urN tkman-2.2~/tkmandesc.tcl tkman-2.2/tkmandesc.tcl
--- tkman-2.2~/tkmandesc.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/tkmandesc.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -152,6 +152,7 @@
 	foreach n [concat $from $to] {
 		if {[lsearch $mani(manList) $n]==-1} {
 			puts stderr "$cmd: Section letter `$n' doesn't exist."
+			CLEANUP
 			exit 1
 		}
 	}
diff -urN tkman-2.2~/version.tcl tkman-2.2/version.tcl
--- tkman-2.2~/version.tcl	2003-04-01 17:31:38.000000000 -0600
+++ tkman-2.2/version.tcl	2008-12-05 17:37:55.000000000 -0600
@@ -80,7 +80,7 @@
 
 		### collect diffs
 		# diff needs at least one of them to be a real file.  want text of previous version around anyhow
-		set tmpf /tmp/tkman[pid]
+		set tmpf [exec mktemp -p /tmp tkman.XXXXXXXXXX]
 # $man(changeleft) $man(zaphy) -- obsolete options
 		set format "$man(format) | $manx(rman) -f ASCII -N"
 #puts "creating $tmpf (old)"