pike.git / lib / modules / NetUtils.pmod

version» Context lines:

pike.git/lib/modules/NetUtils.pmod:89:   }      //! Returns the CIDR of a given netmask. Only returns the correct   //! value for netmasks with all-zeroes at the end (eg, 255.255.255.128   //! works, while 255.255.255.3 will give the wrong return value)   //!   //! @seealso   //! http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation   int netmask_to_cidr( string mask )   { +  if( has_prefix( mask, "0x" ) ) +  { +  int i; +  if( sscanf( mask, "0x%x", i ) == 1 ) +  return i->popcount(); +  }    return string_to_ip( mask )->popcount();   }      //! Converts a string with an IP address and mask (in CIDR notation)   //! into a binary IP address and bitmask.   //!   //! @param cidr   //! The CIDR-notation input string.   //! @returns   //! An array containing:
pike.git/lib/modules/NetUtils.pmod:597:    {    string data = Process.popen( _ifconfig + " -s" );    return column(((data/"\n")[*]/" ")[1..<1],0)*"\n";    }    case NT:    error("FIXME: NT not currently supported\n");    return Process.popen( "ipconfig /all" );       default:    { -  string data = ifconfig + " -a | grep -v '\t'"; +  string data = Process.popen(_ifconfig + " -a | grep -v '\t'");    array res = ({});    foreach( data/"\n", string x )    {    if( strlen( x ) )    {    x = (x/" ")[0];    res += ({ x[..<1] });    }    }    return res*"\n";