On 7/3/07, ara.t.howard <ara.t.howard / gmail.com> wrote:
>
> latest version.  can everyone test on various platforms and report
> results and/or patch?
>
>      def mac_address
>        return @mac_address if defined? @mac_address
>        re = %r/[^:\-](?:[0-9A-Za-z][0-9A-Za-z][:\-]){5}[0-9A-Za-z]
> [0-9A-Za-z][^:\-]/o
>        lines = nil
>        cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig',
> 'ipconfig /all'
>
>        cmds.each do |cmd|
>          stdout = IO.popen('ifconfig'){|fd| fd.readlines}

# fix small typo
stdout = IO.popen(cmd){|fd| fd.readlines}

>          next unless stdout and stdout.size > 0
>          lines = stdout and break
>        end
>        raise 'ifconfig failed' unless lines
>
>        candidates = lines.select{|line| line =~ re}
>        raise 'no mac address candidates' unless candidates.first
>
>        maddr = candidates.first[re]
>        raise 'no mac address found' unless maddr
>        @mac_address = maddr.strip
>      end
>
> i promise to post this when we're done so we all have it.
>
> kind regards.
>
>
> -a
> --
> we can deny everything, except that we have the possibility of being
> better. simply reflect on that.
> h.h. the 14th dalai lama
>
>
>
>
>