Sha256: 409ceba4c7381b88cf74e87d2e1ef048931c811e845fecf6dbe6e2e919e0bc8e
Contents?: true
Size: 1.01 KB
Versions: 46
Compression:
Stored size: 1.01 KB
Contents
# $Id: ifconfig.rb,v 1.1.1.1 2005/07/02 19:10:57 hobe Exp $ # require 'ifconfig/common/ifconfig' class Ifconfig # # Can manually specify the platform (should be output of the 'uname' command) # and the ifconfig input # def initialize(input=nil,verbose=nil) if input.nil? cmd = IO.popen('which ifconfig'){ |f| f.readlines[0] } exit unless !cmd.nil? @ifconfig = IO.popen("/sbin/ifconfig -a"){ |f| f.readlines.join } else @ifconfig = input end @verbose = verbose require 'ifconfig/sunos/network_types' require 'ifconfig/sunos/interface_types' @ifaces = {} split_interfaces(@ifconfig).each do |iface| iface_name = get_iface_name(iface) case iface when /^lo\d\:/im @ifaces[iface_name] = LoopbackInterface.new(iface_name,iface) when /\s+ether\s+/im @ifaces[iface_name] = EthernetAdapter.new(iface_name,iface) else puts "Unknown Adapter Type: #{iface}" if @verbose end end end end
Version data entries
46 entries across 46 versions & 2 rubygems