"Fossies" - the Fresh Open Source Software Archive

Member "dosemu-1.4.0/setup/browse.tk" (23 Jun 2003, 2405 Bytes) of package /linux/misc/old/dosemu-1.4.0.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # This script is (c) Copyright 1998 Hans Lermen <lermen@fgan.de>
    2 #
    3 # It is made available to the DOSEmu project under the GPL Version 2, or at
    4 # your option any later version. Details of this Licence can be found in the
    5 # file 'COPYING' in the distribution's top level directory.
    6 #
    7 
    8 set answer 0
    9 set readme "../doc/README.txt"
   10 
   11 proc display_output { titletext but1 but2 movto longtext} {
   12     global answer
   13     upvar $longtext longtx
   14     set w .longlist
   15     catch {destroy $w}
   16     toplevel $w
   17     wm title $w $titletext
   18     wm iconname $w $titletext
   19     positionWindow $w
   20 
   21     frame $w.buttons
   22     pack  $w.buttons -side bottom -expand y -fill x -pady 2m
   23     set answer 0
   24     button $w.buttons.but1 -text $but1 -width 20 -command "destroy $w; global answer; set answer 0"
   25     if { "$but2" == "" } {
   26 	pack $w.buttons.but1 -side left -expand 1
   27     } else {
   28 	button $w.buttons.but2 -text $but2 -width 20 -command "destroy $w; global answer; set answer 1"
   29 	pack $w.buttons.but1 $w.buttons.but2 -side left -expand 1
   30     }
   31     text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 -height 25 -width 80
   32     scrollbar $w.scroll -command "$w.text yview"
   33     pack $w.scroll -side right -fill y
   34     pack $w.text -expand yes -fill both
   35     $w.text insert 0.0 "$longtx"
   36     $w.text yview moveto $movto
   37     vwait answer
   38     return $answer
   39 }
   40 
   41 proc get_line_of {text pattern} {
   42     upvar $text tx
   43     set line 0
   44     catch {set line [exec grep -n $pattern << $tx | head -n1 | cut -d: -f1]}
   45     return $line
   46 }
   47 
   48 proc show_readme_text {text textlines header pattern} {
   49     upvar $text tx
   50     set moveto 0.0
   51     if {$pattern != ""} {
   52 	set line [get_line_of tx $pattern]
   53 	set moveto [expr (($line -1) * 1.0) / $textlines]
   54     }
   55     display_output $header "Ok" "" $moveto tx
   56 }
   57 
   58 proc readin_readme {filename filevar filecount startpattern stoppattern} {
   59     upvar $filevar fvar $filecount count
   60     global env
   61     set tmp "$env(HOME)/.dosemu/tmp/readin_browse"
   62     append tmp [ pid ]
   63 
   64     set startpattern "/$startpattern/"
   65     if {$stoppattern != ""} {
   66 	set stoppattern "/$stoppattern/"
   67 	catch { exec csplit -f $tmp. $filename $startpattern $stoppattern >& /dev/null }
   68     } else {
   69 	catch { exec csplit -f $tmp. $filename $startpattern >& /dev/null }
   70     }
   71     catch { set count [exec wc -l $tmp.01 | awk {{print $1}}] }
   72     set fvar [exec  col -b <$tmp.01]
   73     catch { exec /bin/bash -c "rm -f $tmp*" }
   74 }