int state_width;
int addr_width;
int serv_width;
+char *odd_width_pad = "";
static const char *TCP_PROTO = "tcp";
static const char *SCTP_PROTO = "sctp";
printf("%-*s ", state_width, sstate_name[s->state]);
}
- printf("%-6d %-6d ", s->rq, s->wq);
+ printf("%-6d %-6d %s", s->rq, s->wq, odd_width_pad);
}
static void sock_details_print(struct sockstat *s)
}
addrp_width = screen_width;
- addrp_width -= netid_width+1;
- addrp_width -= state_width+1;
+ if (netid_width)
+ addrp_width -= netid_width + 1;
+ if (state_width)
+ addrp_width -= state_width + 1;
addrp_width -= 14;
if (addrp_width&1) {
netid_width++;
else if (state_width)
state_width++;
+ else
+ odd_width_pad = " ";
}
addrp_width /= 2;
printf("%-*s ", netid_width, "Netid");
if (state_width)
printf("%-*s ", state_width, "State");
- printf("%-6s %-6s ", "Recv-Q", "Send-Q");
+ printf("%-6s %-6s %s", "Recv-Q", "Send-Q", odd_width_pad);
}
/* Make enough space for the local/remote port field */