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
|
# This script is (c) Copyright 1998 Hans Lermen <lermen@fgan.de>
#
# It is made available to the DOSEmu project under the GPL Version 2, or at
# your option any later version. Details of this Licence can be found in the
# file 'COPYING' in the distribution's top level directory.
#
set answer 0
set readme "../doc/README.txt"
proc display_output { titletext but1 but2 movto longtext} {
global answer
upvar $longtext longtx
set w .longlist
catch {destroy $w}
toplevel $w
wm title $w $titletext
wm iconname $w $titletext
positionWindow $w
frame $w.buttons
pack $w.buttons -side bottom -expand y -fill x -pady 2m
set answer 0
button $w.buttons.but1 -text $but1 -width 20 -command "destroy $w; global answer; set answer 0"
if { "$but2" == "" } {
pack $w.buttons.but1 -side left -expand 1
} else {
button $w.buttons.but2 -text $but2 -width 20 -command "destroy $w; global answer; set answer 1"
pack $w.buttons.but1 $w.buttons.but2 -side left -expand 1
}
text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 -height 25 -width 80
scrollbar $w.scroll -command "$w.text yview"
pack $w.scroll -side right -fill y
pack $w.text -expand yes -fill both
$w.text insert 0.0 "$longtx"
$w.text yview moveto $movto
vwait answer
return $answer
}
proc get_line_of {text pattern} {
upvar $text tx
set line 0
catch {set line [exec grep -n $pattern << $tx | head -n1 | cut -d: -f1]}
return $line
}
proc show_readme_text {text textlines header pattern} {
upvar $text tx
set moveto 0.0
if {$pattern != ""} {
set line [get_line_of tx $pattern]
set moveto [expr (($line -1) * 1.0) / $textlines]
}
display_output $header "Ok" "" $moveto tx
}
proc readin_readme {filename filevar filecount startpattern stoppattern} {
upvar $filevar fvar $filecount count
global env
set tmp "$env(HOME)/.dosemu/tmp/readin_browse"
append tmp [ pid ]
set startpattern "/$startpattern/"
if {$stoppattern != ""} {
set stoppattern "/$stoppattern/"
catch { exec csplit -f $tmp. $filename $startpattern $stoppattern >& /dev/null }
} else {
catch { exec csplit -f $tmp. $filename $startpattern >& /dev/null }
}
catch { set count [exec wc -l $tmp.01 | awk {{print $1}}] }
set fvar [exec col -b <$tmp.01]
catch { exec /bin/bash -c "rm -f $tmp*" }
}
|