tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / workbench / network / stacks / AROSTCP / netlib / linkntoa.c
blobcbca05c57ca9c352dddcde32d52c5f066be401f7
1 /* $Id$
3 * linkntoa.c - link level address printing
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
7 * All rights reserved.
9 * Copyright © 1991 Regents of the University of California.
12 #include <sys/types.h>
13 #include <sys/socket.h>
14 #include <net/if.h>
15 #include <net/if_dl.h>
16 #include <string.h>
18 static char hexlist[] = "0123456789abcdef";
20 char *
21 link_ntoa(sdl)
22 register const struct sockaddr_dl *sdl;
24 static char obuf[64];
25 register char *out = obuf;
26 register int i;
27 register u_char *in = (u_char *)LLADDR(sdl);
28 u_char *inlim = in + sdl->sdl_alen;
29 int firsttime = 1;
31 if (sdl->sdl_nlen) {
32 bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen);
33 out += sdl->sdl_nlen;
34 *out++ = ':';
36 while (in < inlim) {
37 if (firsttime) firsttime = 0; else *out++ = '.';
38 i = *in++;
39 if (i > 0xf) {
40 out[1] = hexlist[i & 0xf];
41 i >>= 4;
42 out[0] = hexlist[i];
43 out += 2;
44 } else
45 *out++ = hexlist[i];
47 *out = 0;
48 return(obuf);