aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/netstat.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-09-03 08:30:47 -0500
committerRob Landley <rob@landley.net>2013-09-03 08:30:47 -0500
commitf538f420deffc242742ce2d0661a39fa9a3b5399 (patch)
tree25841579cf96612ab0f81e6d4738ac5da89ef7c4 /toys/pending/netstat.c
parent79d8bc70539b7a3d459630c97e38d3cdff77e591 (diff)
downloadtoybox-f538f420deffc242742ce2d0661a39fa9a3b5399.tar.gz
Remove itoa/utoa, let libc do this with sprintf.
Diffstat (limited to 'toys/pending/netstat.c')
-rw-r--r--toys/pending/netstat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/pending/netstat.c b/toys/pending/netstat.c
index cbe245ec..88e5bd3b 100644
--- a/toys/pending/netstat.c
+++ b/toys/pending/netstat.c
@@ -173,7 +173,7 @@ static const char *get_pid_name(unsigned long inode)
*/
static void display_data(unsigned rport, char *label, unsigned rxq, unsigned txq, char *lip, char *rip, unsigned state, unsigned long inode)
{
- char *ss_state = "UNKNOWN";
+ char *ss_state = "UNKNOWN", buf[12];
char *state_label[] = {"", "ESTABLISHED", "SYN_SENT", "SYN_RECV", "FIN_WAIT1", "FIN_WAIT2",
"TIME_WAIT", "CLOSE", "CLOSE_WAIT", "LAST_ACK", "LISTEN", "CLOSING", "UNKNOWN"};
if (!strcmp(label, "tcp")) {
@@ -185,7 +185,7 @@ static void display_data(unsigned rport, char *label, unsigned rxq, unsigned txq
if (state == 1) ss_state = state_label[state];
else if (state == 7) ss_state = "";
}
- else if (!strcmp(label, "raw")) ss_state = itoa(state);
+ else if (!strcmp(label, "raw")) sprintf(ss_state = buf, "%u", state);
if ( (toys.optflags & FLAG_W) && (toys.optflags & FLAG_p))
xprintf("%3s %6d %6d %-51s %-51s %-12s%s\n", label, rxq, txq, lip, rip, ss_state, get_pid_name(inode));
@@ -215,7 +215,7 @@ static char *get_servname(int port, char *label)
if (!lport) return xmsprintf("%s", "*");
struct servent *ser = getservbyport(lport, label);
if (ser) return xmsprintf("%s", ser->s_name);
- return xmsprintf("%s", itoa(ntohs(lport)));
+ return xmsprintf("%u", (unsigned)ntohs(lport));
}
/*
* used to convert address into text format.