diff options
Diffstat (limited to 'unix/mkLinks.tcl')
-rw-r--r-- | unix/mkLinks.tcl | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/unix/mkLinks.tcl b/unix/mkLinks.tcl index 22f54f3..45a6131 100644 --- a/unix/mkLinks.tcl +++ b/unix/mkLinks.tcl @@ -47,23 +47,31 @@ foreach file $argv { if {[regexp "^.SH NAME" $line]} { set state name } - } - name { - regsub {\\-.*} $line {} line - foreach name [split $line ,] { - regsub -all { } $name "" name - if {![string match $name*$ext $tail]} { + } + name { + regsub {\\-.*} $line {} line + set rmOutput "" + set lnOutput "" + set namelist {} + foreach name [split $line ,] { + regsub -all {(\\)? } $name "" name + if {![string match $name*$ext $tail]} { + lappend namelist $name$ext + append rmOutput " rm -f $name$ext\n" + append lnOutput " ln $tail $name$ext\n" + } + } + if { [llength $namelist] } { puts "if test -r $tail; then" - puts " rm -f $name$ext" - puts " ln $tail $name$ext" + puts -nonewline $rmOutput + puts -nonewline $lnOutput puts "fi" } + set state end + } + end { + break } - set state end - } - end { - break - } } } close $in |