freebsd-ports/textproc/wordnet/files/patch-wnb
Mikhail Teterin 27db40cf8d Upgrade from 2.1 to 3.0. It appears, the bulk of the changes went into
the word databases, for the software is almost completely unmodified.

Depened only on Tcl. Tk is needed for the GUI-browser wnb only, and
should not prevent X11-less servers from using WordNet. pkg-message
is set up to inform the user, that they need Tk present for wnb to
function.
2007-05-28 18:43:00 +00:00

57 lines
1.7 KiB
Text

This patch makes wnb use man(1) to access its own man-pages instead
of relying on textual copies of them being in the $resourcedir.
Similarly, it looks for the compiled-in license instead of opening
its textual copy.
These leave wn.xbm as the only "resource" file, thus removing the need
for a separate resource directory. FreeBSD port installs all -- the
dictionaries and the bitmap into ${PREFIX}/share/WordNet.
-mi
--- src/wnb Tue Jun 7 15:19:22 2005
+++ src/wnb Sun Jan 15 07:42:38 2006
@@ -103,9 +100,15 @@
if {$tcl_platform(platform) == "unix"} {
- if {[lsearch -exact [array names env] WNHOME] == -1} {
- set resourcedir "/usr/local/WordNet-3.0/lib/wnres"
- } else {
- set resourcedir "$env(WNHOME)/lib/wnres"
+ set resourcedirs {
+ /usr/local/WordNet-3.0
+ /usr/local/WordNet-3.0/lib/wnres
+ }
+ if {[info exists env(WNHOME)]} {
+ lappend resourcedirs $env(WNHOME) $env(WNHOME)/lib/wnres
}
+ foreach resourcedir $resourcedirs {
+ if {[file exists $resourcedir/wn.xbm]} break
+ }
+ unset resourcedirs
set configfile "$env(HOME)/.wnrc"
if [ file exists $configfile ] {
@@ -575,7 +578,19 @@
.$w.top.text configure \
-state normal
- set fileid [open $filename "r"]
- set filetext [read $fileid]
- close $fileid
+ switch -glob -- $filename {
+ *.man {
+ set manpage [file tail $filename]
+ set manpage [string range $manpage 0 end-4]
+ set fileid [open "|man $manpage"]
+ } */license.txt {
+ set filetext [wnlicense]
+ } default {
+ set fileid [open $filename]
+ }
+ }
+ if {[info exists fileid]} {
+ set filetext [read $fileid]
+ close $fileid
+ }
regsub -all ".\b" $filetext "" filetext
.$w.top.text insert end $filetext