+ function make_status_net( \
+ out,
+ number_of_interfaces_to_show,
+ n,
+ array_of_prefixes_of_interfaces_to_show,
+ prefix,
+ interface,
+ label,
+ count_printed,
+ sep,
+ io_stat,
+ dw, dr,
+ bytes_per_unit\
+ ) {
+ out = ""
+ number_of_interfaces_to_show = \
+ split(\
+ opt_prefixes_of_net_interfaces_to_show,\
+ array_of_prefixes_of_interfaces_to_show,\
+ ","\
+ )
+ for (n = 1; n <= number_of_interfaces_to_show; n++) {
+ prefix = array_of_prefixes_of_interfaces_to_show[n]
+ for (interface in net_addr) {
+ if (interface ~ ("^" prefix)) {
+ label = substr(interface, 1, 1)
+ if (net_addr[interface]) {
+ bytes_per_mb = 1024 * 1024 # TODO: option
+ dw = net_io_diff_w[interface] / bytes_per_mb
+ dr = net_io_diff_r[interface] / bytes_per_mb
+ io_stat = sprintf("%0.3f▲ %0.3f▼", dw, dr)
+ } else {
+ io_stat = "--"
+ }
+ if (interface ~ "^w") {
+ label = label ":" db["net_wifi_status"]
+ }
+ if (++count_printed > 1) {
+ sep = " "
+ } else {
+ sep = ""
+ }
+ out = out sep label ":" io_stat
+ }
+ }
+ }
+ return sprintf("N[%s]", out)