Install working version of ether_sprintf().

This commit is contained in:
Eric Norum
2004-10-25 13:50:39 +00:00
parent c4b0c2c150
commit bb5b404856
4 changed files with 19 additions and 25 deletions

View File

@@ -1,3 +1,7 @@
2004-10-25 Eric Norum <norume@aps.anl.gov>
* libchip/network/i82586.c: ether_sprintf() is part of networking library.
2004-10-22 Ralf Corsepius <ralf_corsepius@rtems.org> 2004-10-22 Ralf Corsepius <ralf_corsepius@rtems.org>
* alocal/check-custom-bsp.m4: Reflect new location of bspkit*cfg. * alocal/check-custom-bsp.m4: Reflect new location of bspkit*cfg.

View File

@@ -263,22 +263,6 @@ char *bitmask_snprintf(unsigned long value, const char *format, char *buf, int b
return buf; 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. * Front-ends call this function to attach to the MI driver.
* *

View File

@@ -1,3 +1,7 @@
2004-10-25 Eric Norum <norume@aps.anl.gov>
* libnetworking/net/if_ethersubr.c: Working version of ether_sprintf().
2004-10-22 Ralf Corsepius <ralf_corsepius@rtems.org> 2004-10-22 Ralf Corsepius <ralf_corsepius@rtems.org>
* libnetworking/Makefile.am: Reflect changes below. * libnetworking/Makefile.am: Reflect changes below.

View File

@@ -512,18 +512,20 @@ ether_input(ifp, eh, m)
/* /*
* Convert Ethernet address to printable (loggable) representation. * Convert Ethernet address to printable (loggable) representation.
* This routine is for compatibility; it's better to just use * The static buffer isn't a really huge problem since this code
* * is protected by the RTEMS network mutex.
* printf("%6D", <pointer to address>, ":");
*
* since there's no static buffer involved.
*/ */
char * char *
ether_sprintf(const u_char *ap) ether_sprintf(const u_int8_t *addr)
{ {
static char etherbuf[18]; static char buf[32];
snprintf(etherbuf, sizeof (etherbuf), "%6D", ap, ":"); char *b = buf;
return (etherbuf); int i;
for (i = 0; i < ETHER_ADDR_LEN; i++, b+=3)
sprintf(b, "%02x:", *addr++);
*--b = '\0';
return buf;
} }
/* /*