couple of small fixes
authorPhil Blundell <philb@gnu.org>
Thu, 16 Apr 1998 20:08:51 +0000 (20:08 +0000)
committerPhil Blundell <philb@gnu.org>
Thu, 16 Apr 1998 20:08:51 +0000 (20:08 +0000)
ChangeLog
lib/ash.c
lib/net-string.c

index 46b98ae..31ba807 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1998-04-15  Phil Blundell  <philb@gnu.org>
+
+       * lib/ash.c (pr_ash): Fix typo.
+       (in_ash): Hamming-encode the hops.
+
 Fri Apr 10 22:26:48 1998  Philip Blundell  <Philip.Blundell@pobox.com>
 
        * ifconfig.c (ife_print): Bracket Appletalk stuff in #if
index 54ecdf9..b8bdf56 100644 (file)
--- a/lib/ash.c
+++ b/lib/ash.c
@@ -39,7 +39,7 @@ pr_ash(unsigned char *ptr)
 
   p[0] = '['; p++;
   while (ptr[i] != 0xc9 && ptr[i] != 0xff && (i < ASH_ALEN))
-         sprintf (p++, "%01", ptr[i++]);
+         sprintf (p++, "%1x", ptr[i++]);
   *(p++) = ']';
   *p = 0;
 
@@ -57,6 +57,12 @@ pr_sash(struct sockaddr *sap)
   return pr_ash (sap->sa_data);
 }
 
+static unsigned char hamming[16] = 
+{ 
+  0x15, 0x02, 0x49, 0x5e, 0x64, 0x73, 0x38, 0x2f,
+  0xd0, 0xc7, 0x8c, 0x9b, 0xa1, 0xb6, 0xfd, 0xea 
+};
+
 
 static int
 in_ash(char *bufp, struct sockaddr *sap)
@@ -70,7 +76,7 @@ in_ash(char *bufp, struct sockaddr *sap)
   while (bufp && i < ASH_ALEN) {
     char *next;
     int hop = strtol (bufp, &next, 16);
-    ptr[i++] = hop;
+    ptr[i++] = hamming[hop];
     switch (*next) {
     case ':':
       bufp = next + 1;
index 4880a8b..d1d662b 100644 (file)
@@ -37,7 +37,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 
 char   *
 strsave(s)