Ticket #15514: reinplace-warning5.diff

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

show warning in debug mode even if quiet switch is used

  • 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 {![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   
    779791        set attributes [file attributes $file]
    780792        # We need to overwrite this file
    781793        if {[catch {file attributes $file -permissions u+w} error]} {