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}
>          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.
>

$ ruby --version
ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-cygwin]

$ ruby t.rb
t.rb:22: command not found: /sbin/ifconfig
t.rb:22: command not found: /bin/ifconfig
t.rb:22: command not found: ifconfig
XX-XX-XX-XX-XX-XX


Seems to be working on windows (except the annoying "command not
found" messages).

Blessings,
TwP