From: Sergey Matveev Date: Wed, 10 Dec 2025 10:36:47 +0000 (+0300) Subject: Compatibility with Jim 0.81 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3c26d4010420ef22393884c4c4634ac6167ac2c1cef17dbd15c808acb6c75437;p=dsc.git Compatibility with Jim 0.81 --- diff --git a/dsc b/dsc index edb35ae..415f17f 100755 --- a/dsc +++ b/dsc @@ -101,13 +101,13 @@ proc is-bin {opt} { proc run-checker {opt v} { global Schema - set fh [open |[list "$Schema/[find-opt-schema $opt]/check" $opt 2>@1 << $v] r] + set fh [open [list "|$Schema/[find-opt-schema $opt]/check" $opt 2>@1 << $v]] set v [$fh read] if {[catch {close $fh}]} { puts -nonewline stderr $v exit 1 } - untaint v + catch {untaint v} return $v } @@ -229,7 +229,7 @@ switch [lindex $argv 0] { } if {[file exists $Stash/$opt]} { if {[is-bin $opt]} { - set fh [open $Stash/$opt r] + set fh [open $Stash/$opt] fconfigure $fh -translation binary fconfigure stdout -translation binary $fh copyto stdout @@ -245,7 +245,7 @@ switch [lindex $argv 0] { set pth [find-opt-schema $opt] if {[file exists $Schema/$pth/apply]} { puts stderr "applying $opt..." - if {[catch {exec | [list "$Schema/$pth/apply" $opt] >@stdout 2>@stderr}]} { + if {[catch {exec {*}[list "$Schema/$pth/apply" $opt] >@stdout 2>@stderr}]} { exit 1 } exit @@ -253,14 +253,14 @@ switch [lindex $argv 0] { if {[file exists $Schema/$pth/*]} { set rc 0 foreach dir [readents $Stash/$opt directory] { - if {[catch {exec | [list dsc apply $opt/$dir] >@stdout 2>@stderr}]} { + if {[catch {exec {*}[list dsc apply $opt/$dir] >@stdout 2>@stderr}]} { set rc 1 } } exit $rc } foreach ent [readents $Schema/$opt directory] { - if {[catch {exec | [list dsc apply $opt/$ent] >@stdout 2>@stderr}]} { + if {[catch {exec {*}[list dsc apply $opt/$ent] >@stdout 2>@stderr}]} { set rc 1 } } @@ -278,12 +278,12 @@ switch [lindex $argv 0] { puts $fh [string range $fn [string length $Stash]+1 end] } close $fh - set fh [open |[list diff -u -L dirs -L dirs $dirsSaved $dirsStash] r] + set fh [open [list |diff -u -L dirs -L dirs $dirsSaved $dirsStash]] puts -nonewline [read $fh] catch {close $fh} file delete $dirsSaved file delete $dirsStash - set fh [open |[list diff -urN $Saved/$opt $Stash/$opt] r] + set fh [open [list |diff -urN $Saved/$opt $Stash/$opt]] set prefixSaved "--- $Saved/" set prefixSavedLen [string length $prefixSaved] set prefixStash "+++ $Stash/" @@ -306,12 +306,12 @@ switch [lindex $argv 0] { } revert { catch {file delete -force $Stash/$opt} - exec | [list cp -a $Saved/$opt $Stash/$opt] + exec {*}[list cp -a $Saved/$opt $Stash/$opt] } commit { file delete -force $Saved.bak set tmp $Saved.[expr {int(rand() * 1000000)}] - exec | [list cp -a $Stash $tmp] + exec {*}[list cp -a $Stash $tmp] exec sync file rename $Saved $Saved.bak file rename $tmp $Saved @@ -331,7 +331,7 @@ switch [lindex $argv 0] { set sfn [string range $fn [string length $Saved]+1 end] if {[is-bin $sfn]} { puts "-- $sfn:base64 --" - set fh [open "|base64 $fn" r] + set fh [open "|base64 $fn"] $fh copyto stdout close $fh } else { @@ -375,7 +375,7 @@ switch [lindex $argv 0] { global Stash file mkdir [file dirname $Stash/$fn] if {$bin} { - set fh [open |[list base64 -d > $Stash/$fn] w] + set fh [open [list |base64 -d > $Stash/$fn] w] } else { set fh [open $Stash/$fn w] fconfigure $fh -translation binary @@ -403,3 +403,5 @@ switch [lindex $argv 0] { } } } + +# vim: ft=tcl