From bb5b40485651d5b8f8f49754a7a482cb37c898d0 Mon Sep 17 00:00:00 2001 From: Eric Norum Date: Mon, 25 Oct 2004 13:50:39 +0000 Subject: Install working version of ether_sprintf(). --- c/src/ChangeLog | 4 ++++ c/src/libchip/network/i82586.c | 16 ---------------- cpukit/ChangeLog | 4 ++++ cpukit/libnetworking/net/if_ethersubr.c | 20 +++++++++++--------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/c/src/ChangeLog b/c/src/ChangeLog index 6eb45f68de..a165c902da 100644 --- a/c/src/ChangeLog +++ b/c/src/ChangeLog @@ -1,3 +1,7 @@ +2004-10-25 Eric Norum + + * libchip/network/i82586.c: ether_sprintf() is part of networking library. + 2004-10-22 Ralf Corsepius * alocal/check-custom-bsp.m4: Reflect new location of bspkit*cfg. diff --git a/c/src/libchip/network/i82586.c b/c/src/libchip/network/i82586.c index 2afd015d8b..2191d3777c 100644 --- a/c/src/libchip/network/i82586.c +++ b/c/src/libchip/network/i82586.c @@ -263,22 +263,6 @@ char *bitmask_snprintf(unsigned long value, const char *format, char *buf, int b return buf; } -char *ether_sprintf(unsigned char *addr) -{ - static char buf[32]; - char *b = buf; - int i; - - for (i = 0; i < ETHER_ADDR_LEN; i++) - { - sprintf(b, "%02x:", *addr++); - b += 3; - } - b--; - b = "\0"; - return buf; -} - /* * Front-ends call this function to attach to the MI driver. * diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 8e241fac34..2d3d1c0acc 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,7 @@ +2004-10-25 Eric Norum + + * libnetworking/net/if_ethersubr.c: Working version of ether_sprintf(). + 2004-10-22 Ralf Corsepius * libnetworking/Makefile.am: Reflect changes below. diff --git a/cpukit/libnetworking/net/if_ethersubr.c b/cpukit/libnetworking/net/if_ethersubr.c index 4d802860d5..4ae25fbbeb 100644 --- a/cpukit/libnetworking/net/if_ethersubr.c +++ b/cpukit/libnetworking/net/if_ethersubr.c @@ -512,18 +512,20 @@ ether_input(ifp, eh, m) /* * Convert Ethernet address to printable (loggable) representation. - * This routine is for compatibility; it's better to just use - * - * printf("%6D", , ":"); - * - * since there's no static buffer involved. + * The static buffer isn't a really huge problem since this code + * is protected by the RTEMS network mutex. */ char * -ether_sprintf(const u_char *ap) +ether_sprintf(const u_int8_t *addr) { - static char etherbuf[18]; - snprintf(etherbuf, sizeof (etherbuf), "%6D", ap, ":"); - return (etherbuf); + static char buf[32]; + char *b = buf; + int i; + + for (i = 0; i < ETHER_ADDR_LEN; i++, b+=3) + sprintf(b, "%02x:", *addr++); + *--b = '\0'; + return buf; } /* -- cgit v1.2.3