home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume20 / etherlib / part01 / src / ethere2a.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-24  |  630 b   |  37 lines

  1. /* $Id: ethere2a.c,v 2.1 89/10/23 15:42:28 dupuy Exp $ */
  2.  
  3. #include <stdio.h>
  4.  
  5. #include "libether.h"
  6.  
  7. char *
  8. ether_e2a (addr, estring)
  9. ether_addr *addr;
  10. char *estring;
  11. {
  12. #ifdef lint
  13.     char *sprintf ();
  14. #endif
  15.     if (estring == NULL)
  16.     estring = (char *) malloc (ETHERSTRLEN);
  17.  
  18.     if (estring != NULL)
  19.     (void) sprintf (estring, "%x:%x:%x:%x:%x:%x",
  20.             addr->bytes[0], addr->bytes[1], addr->bytes[2],
  21.             addr->bytes[3], addr->bytes[4], addr->bytes[5]);
  22.     return (estring);
  23. }
  24.  
  25. #ifndef ETHERDB
  26.  
  27. char *
  28. ether_ntoa (addr)
  29. ether_addr *addr;
  30. {
  31.     static char estring[ETHERSTRLEN];
  32.  
  33.     return (ether_e2a (addr, estring));
  34. }
  35.  
  36. #endif
  37.