foreign characters

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1786 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg
2014-02-18 21:34:44 +00:00
parent 98c4182a1f
commit 23cc31a02a
3 changed files with 13 additions and 3 deletions

View File

@@ -308,9 +308,9 @@ proc s_time {a b} {
}
if {[catch {file stat $a l}]} { return 0}
set at $l(ctime)
set at $l(mtime)
if {[catch {file stat $b l}]} { return 0}
set bt $l(ctime)
set bt $l(mtime)
if {$at < $bt} { return -1 }
if {$at > $bt} { return 1 }

View File

@@ -1,6 +1,7 @@
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
if {![exists -proc binary]} { package require binary }
class system {}
@@ -179,6 +180,15 @@ proc {system busy} {} {
proc {system inuse} {file} {
# Is anything using the file?
set file [file rootname [file tail $file]]
# Escape any unicode characters to match lsof output.
foreach range [lreverse [\
regexp -inline -indices -all -- {[\x80-\xff]} $file]] {
set i [lindex $range 0]
binary scan [string index $file $i] H2 hex
set file [string replace $file $i $i "\\x$hex"]
}
set c 0
foreach line [split [exec /mod/bin/lsof] "\n"] {
if {[string first $file $line] >= 0} { incr c }