forked from hummypkg/webif
Fix regexp parsing whilst SMART test in progress
This commit is contained in:
parent
e1b038d161
commit
114550d540
@ -194,18 +194,14 @@ puts {
|
||||
if {[catch {exec /bin/smartctl -l selftest $device} msg]} {
|
||||
set rc [lindex $::errorCode 2]
|
||||
set rc $($rc eq "" ? 1 : [expr {$rc & 7}])
|
||||
if {$rc} {
|
||||
set msg ""
|
||||
}
|
||||
if {$rc} { set msg "" }
|
||||
}
|
||||
|
||||
set i 0
|
||||
foreach line [split $msg "\n"] {
|
||||
regsub -all -- {[[:space:]][[:space:]]+} $line "|" line
|
||||
if {[incr i] < 7} continue
|
||||
lassign [split $line "|"] id name status remaining when lba
|
||||
if {[string length $id] > 10} continue
|
||||
if {$id eq ""} continue
|
||||
if {[regexp {\s*#\s*(\d+)\s+((?:[\s-]?\w[:;.,]?)+)\s+((?:[\s-]?\w[:;.,]?)+?)\s+(\d\d?%)\s+(\d+)\s+([\d-]\d*)} \
|
||||
$line x id name status remaining when lba] == 0} continue
|
||||
puts "<tr>
|
||||
<td>$id</td>
|
||||
<td>$name</td>
|
||||
|
Loading…
Reference in New Issue
Block a user