Ticket #15514: reinplace-warning4.diff

File reinplace-warning4.diff, 1.3 KB (added by ryandesign (Ryan Carsten Schmidt), 16 years ago)

change the option to -q for "quiet"

  • src/port1.0/portutil.tcl

     
    718718# Provides "sed in place" functionality
    719719proc reinplace {args}  {
    720720    set extended 0
     721    set quiet 0
    721722    while 1 {
    722723        set arg [lindex $args 0]
    723724        if {[string index $arg 0] eq "-"} {
     
    726727                E {
    727728                    set extended 1
    728729                }
     730                q {
     731                    set quiet 1
     732                }
    729733                - {
    730734                    break
    731735                }
     
    738742        }
    739743    }
    740744    if {[llength $args] < 2} {
    741         error "reinplace ?-E? pattern file ..."
     745        error "reinplace ?-q? ?-E? pattern file ..."
    742746    }
    743747    set pattern [lindex $args 0]
    744748    set files [lrange $args 1 end]
     
    776780   
    777781        close $tmpfd
    778782   
     783        if {!$quiet && ![catch {exec cmp -s $file $tmpfile}]} {
     784            ui_warn "[format [msgcat::mc "reinplace %1\$s didn't change anything in %2\$s"] $pattern $file]"
     785        }
     786   
    779787        set attributes [file attributes $file]
    780788        # We need to overwrite this file
    781789        if {[catch {file attributes $file -permissions u+w} error]} {