source: trunk/minix/lib/ip/ethere2a.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 987 bytes
Line 
1/* $Id: ethere2a.c,v 1.1.1.1 2005/04/21 14:56:16 beng Exp $ */
2/* This file was part of the etherlib package. */
3
4#include <stdio.h>
5
6#ifdef _MINIX
7#include <sys/types.h>
8#include <stdlib.h>
9
10#include <net/gen/ether.h>
11#include <net/gen/if_ether.h>
12
13#define ETHERSTRLEN 18 /* max length of "xx:xx:xx:xx:xx:xx" */
14#define ether_addr ether_addr_t
15#define bytes ea_addr
16char *ether_e2a _ARGS(( ether_addr_t *a, char *e ));
17#else
18#include "libether.h"
19#endif
20
21char *
22ether_e2a (addr, estring)
23ether_addr *addr;
24char *estring;
25{
26#ifdef lint
27 char *sprintf ();
28#endif
29 if (estring == NULL)
30 estring = (char *) malloc (ETHERSTRLEN);
31
32 if (estring != NULL)
33 (void) sprintf (estring, "%x:%x:%x:%x:%x:%x",
34 addr->bytes[0], addr->bytes[1], addr->bytes[2],
35 addr->bytes[3], addr->bytes[4], addr->bytes[5]);
36 return (estring);
37}
38
39#ifndef ETHERDB
40
41char *
42ether_ntoa (addr)
43ether_addr *addr;
44{
45 static char estring[ETHERSTRLEN];
46
47 return (ether_e2a (addr, estring));
48}
49
50#endif
Note: See TracBrowser for help on using the repository browser.