Changeset 5220


Ignore:
Timestamp:
Feb 5, 2004, 8:59:33 PM (20 years ago)
Author:
landonf (Landon Fuller)
Message:

Use the md5 built-in instead of running md5(1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwinports1.0/darwinports.tcl

    r5216 r5220  
    757757    if {![catch {file stat $fname statvar}]} {
    758758        if {[file isfile $fname]} {
    759             set md5regex "^(MD5)\[ \]\\((.+)\\)\[ \]=\[ \](\[A-Za-z0-9\]+)\n$"
    760             set pipe [open "|md5 \"$fname\"" r]
    761             set line [read $pipe]
    762             if {[regexp $md5regex $line match type filename sum] == 1} {
    763                 ::close $pipe
    764                 set line [string trimright $line "\n"]
     759            if {[catch {md5 file $fname} md5sum] == 0} {
     760                # Create a line that matches md5(1)'s output
     761                # for backwards compatibility
     762                set line "MD5 ($fname) = $md5sum"
    765763                return [list $fname $statvar(uid) $statvar(gid) $statvar(mode) $statvar(size) $line]
    766764            }
    767             ::close $pipe
    768765        } else {
    769766            return  [list $fname $statvar(uid) $statvar(gid) $statvar(mode) $statvar(size) "MD5 ($fname) NONE"]
Note: See TracChangeset for help on using the changeset viewer.