@ -76,6 +76,7 @@ tcl::namespace::eval shellfilter::log {
if {![string length $is_open_required]} {
if {![string length $is_open_required]} {
return $allow_adhoc_tags
return $allow_adhoc_tags
} else {
} else {
#why not use string is boolean?
set truevalues [list y yes true 1]
set truevalues [list y yes true 1]
set falsevalues [list n no false 0]
set falsevalues [list n no false 0]
if {[string tolower $is_open_required] in $truevalues} {
if {[string tolower $is_open_required] in $truevalues} {
@ -415,14 +416,14 @@ namespace eval shellfilter::chan {
set inputbytes $o_encbuf$bytes
set inputbytes $o_encbuf$bytes
set o_encbuf ""
set o_encbuf ""
set tail_offset 0
set tail_offset 0
while {$tail_offset < [string length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [string range $inputbytes 0 end-$tail_offset]} stringdata]} {
while {$tail_offset < [::tcl::string::length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [::tcl::string:: range $inputbytes 0 end-$tail_offset]} stringdata]} {
incr tail_offset
incr tail_offset
}
}
if {$tail_offset > 0} {
if {$tail_offset > 0} {
if {$tail_offset < [string length $inputbytes]} {
if {$tail_offset < [::tcl::string:: length $inputbytes]} {
#stringdata from catch statement must be a valid result
#stringdata from catch statement must be a valid result
set t [expr {$tail_offset - 1}]
set t [expr {$tail_offset - 1}]
set o_encbuf [string range $inputbytes end-$t end]
set o_encbuf [::tcl::string:: range $inputbytes end-$t end]
} else {
} else {
set stringdata ""
set stringdata ""
set o_encbuf $inputbytes
set o_encbuf $inputbytes
@ -432,7 +433,7 @@ namespace eval shellfilter::chan {
#::shellfilter::log::write $o_logsource $logdata
#::shellfilter::log::write $o_logsource $logdata
puts -nonewline $o_localchan $stringdata
puts -nonewline $o_localchan $stringdata
#return $bytes
#return $bytes
return [string range $inputbytes 0 end-$tail_offset]
return [::tcl::string:: range $inputbytes 0 end-$tail_offset]
}
}
#a tee is not a redirection - because data still flows along the main path
#a tee is not a redirection - because data still flows along the main path
method meta_is_redirection {} {
method meta_is_redirection {} {
@ -490,23 +491,23 @@ namespace eval shellfilter::chan {
set inputbytes $o_encbuf$bytes
set inputbytes $o_encbuf$bytes
set o_encbuf ""
set o_encbuf ""
set tail_offset 0
set tail_offset 0
while {$tail_offset < [string length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [string range $inputbytes 0 end-$tail_offset]} stringdata]} {
while {$tail_offset < [::tcl::string::length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [::tcl::string:: range $inputbytes 0 end-$tail_offset]} stringdata]} {
incr tail_offset
incr tail_offset
}
}
if {$tail_offset > 0} {
if {$tail_offset > 0} {
if {$tail_offset < [string length $inputbytes]} {
if {$tail_offset < [::tcl::string:: length $inputbytes]} {
#stringdata from catch statement must be a valid result
#stringdata from catch statement must be a valid result
set t [expr {$tail_offset - 1}]
set t [expr {$tail_offset - 1}]
set o_encbuf [string range $inputbytes end-$t end]
set o_encbuf [::tcl::string:: range $inputbytes end-$t end]
} else {
} else {
set stringdata ""
set stringdata ""
set o_encbuf $inputbytes
set o_encbuf $inputbytes
return ""
return ""
}
}
}
}
::shellfilter::log::write $o_logsource $logdata
set bytes [::tcl::string::range $inputbytes 0 end-$tail_offset]
#return $bytes
::shellfilter::log::write $o_logsource $stringdata
return [string range $input bytes 0 end-$tail_offset]
return $bytes
}
}
method meta_is_redirection {} {
method meta_is_redirection {} {
return $o_is_junction
return $o_is_junction
@ -550,14 +551,14 @@ namespace eval shellfilter::chan {
set inputbytes $o_encbuf$bytes
set inputbytes $o_encbuf$bytes
set o_encbuf ""
set o_encbuf ""
set tail_offset 0
set tail_offset 0
while {$tail_offset < [string length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [string range $inputbytes 0 end-$tail_offset]} stringdata]} {
while {$tail_offset < [::tcl::string::length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [::tcl::string:: range $inputbytes 0 end-$tail_offset]} stringdata]} {
incr tail_offset
incr tail_offset
}
}
if {$tail_offset > 0} {
if {$tail_offset > 0} {
if {$tail_offset < [string length $inputbytes]} {
if {$tail_offset < [::tcl::string:: length $inputbytes]} {
#stringdata from catch statement must be a valid result
#stringdata from catch statement must be a valid result
set t [expr {$tail_offset - 1}]
set t [expr {$tail_offset - 1}]
set o_encbuf [string range $inputbytes end-$t end]
set o_encbuf [::tcl::string:: range $inputbytes end-$t end]
} else {
} else {
set stringdata ""
set stringdata ""
set o_encbuf $inputbytes
set o_encbuf $inputbytes
@ -586,10 +587,10 @@ namespace eval shellfilter::chan {
constructor {tf} {
constructor {tf} {
package require punk::ansi
package require punk::ansi
set o_trecord $tf
set o_trecord $tf
set o_enc [dict get $tf -encoding]
set o_enc [::tcl::dict:: get $tf -encoding]
set o_encbuf ""
set o_encbuf ""
if {[dict exists $tf -junction]} {
if {[::tcl::dict:: exists $tf -junction]} {
set o_is_junction [dict get $tf -junction]
set o_is_junction [::tcl::dict:: get $tf -junction]
} else {
} else {
set o_is_junction 0
set o_is_junction 0
}
}
@ -629,14 +630,14 @@ namespace eval shellfilter::chan {
set inputbytes $o_encbuf$bytes
set inputbytes $o_encbuf$bytes
set o_encbuf ""
set o_encbuf ""
set tail_offset 0
set tail_offset 0
while {$tail_offset < [string length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [string range $inputbytes 0 end-$tail_offset]} stringdata]} {
while {$tail_offset < [::tcl::string::length $inputbytes] && [catch {tcl::encoding::convertfrom $o_enc [::tcl::string:: range $inputbytes 0 end-$tail_offset]} stringdata]} {
incr tail_offset
incr tail_offset
}
}
if {$tail_offset > 0} {
if {$tail_offset > 0} {
if {$tail_offset < [string length $inputbytes]} {
if {$tail_offset < [::tcl::string:: length $inputbytes]} {
#stringdata from catch statement must be a valid result
#stringdata from catch statement must be a valid result
set t [expr {$tail_offset - 1}]
set t [expr {$tail_offset - 1}]
set o_encbuf [string range $inputbytes end-$t end]
set o_encbuf [::tcl::string:: range $inputbytes end-$t end]
} else {
} else {
set stringdata ""
set stringdata ""
set o_encbuf $inputbytes
set o_encbuf $inputbytes
@ -3343,5 +3344,5 @@ namespace eval shellfilter {
package provide shellfilter [namespace eval shellfilter {
package provide shellfilter [namespace eval shellfilter {
variable version
variable version
set version 0.2
set version 0.2.1
}]
}]