-- {{{ Grab environment local tonumber = tonumber local os = { time = os.time } local setmetatable = setmetatable local helpers = require("vicious.helpers") local io = { popen = io.popen } local string = { match = string.match } -- }}} -- Net: provides state and usage statistics of all network interfaces -- vicious.widgets.net local net_freebsd = {} -- Initialize function tables local nets = {} -- Variable definitions local unit = { ["b"] = 1, ["kb"] = 1024, ["mb"] = 1024^2, ["gb"] = 1024^3 } -- {{{ Net widget type local function worker(format, warg) if not warg then return end local args = {} local buffer = nil local f = io.popen("netstat -n -b -I " .. helpers.shellquote(warg)) local now = os.time() for line in f:lines() do if not (line:find("