Ticket #15514: reinplace-warning5.diff
File reinplace-warning5.diff, 1.4 KB (added by ryandesign (Ryan Carsten Schmidt), 16 years ago) |
---|
-
src/port1.0/portutil.tcl
718 718 # Provides "sed in place" functionality 719 719 proc reinplace {args} { 720 720 set extended 0 721 set quiet 0 721 722 while 1 { 722 723 set arg [lindex $args 0] 723 724 if {[string index $arg 0] eq "-"} { … … 726 727 E { 727 728 set extended 1 728 729 } 730 q { 731 set quiet 1 732 } 729 733 - { 730 734 break 731 735 } … … 738 742 } 739 743 } 740 744 if {[llength $args] < 2} { 741 error "reinplace ?- E? pattern file ..."745 error "reinplace ?-q? ?-E? pattern file ..." 742 746 } 743 747 set pattern [lindex $args 0] 744 748 set files [lrange $args 1 end] … … 776 780 777 781 close $tmpfd 778 782 783 if {![catch {exec cmp -s $file $tmpfile}]} { 784 if {!$quiet} { 785 ui_warn "[format [msgcat::mc "reinplace %1\$s didn't change anything in %2\$s"] $pattern $file]" 786 } else { 787 ui_info "[format "reinplace %1\$s didn't change anything in %2\$s" $pattern $file]" 788 } 789 } 790 779 791 set attributes [file attributes $file] 780 792 # We need to overwrite this file 781 793 if {[catch {file attributes $file -permissions u+w} error]} {