Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 28 Apr 1998 15:58:57 +0000 (15:58 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 28 Apr 1998 15:58:57 +0000 (15:58 +0000)
* inet/Makefile (tests): Add tst-ether_aton.
* inet/tst-ether_aton.c: New file.

ChangeLog
inet/Makefile
inet/tst-ether_aton.c [new file with mode: 0644]

index 866fa20..991402c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1998-04-28  Ulrich Drepper  <drepper@cygnus.com>
 
+       * inet/Makefile (tests): Add tst-ether_aton.
+       * inet/tst-ether_aton.c: New file.
+
        * inet/ether_aton_r.c (ether_aton_r): Preserve high-nibble value
        in hex conversion.
        * inet/ether_aton.c (ether_aton): Declare result variable static.
index 18a990e..4aa76bd 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ routines := htonl htons               \
            getaliasent_r getaliasent getaliasname getaliasname_r \
            in6_addr getnameinfo if_index
 
-tests := htontest test_ifindex tst-ntoa
+tests := htontest test_ifindex tst-ntoa tst-ether_aton
 
 # No warnings about losing BSD code.
 CFLAGS-rcmd.c = -w
diff --git a/inet/tst-ether_aton.c b/inet/tst-ether_aton.c
new file mode 100644 (file)
index 0000000..76ce8af
--- /dev/null
@@ -0,0 +1,28 @@
+#include <netinet/ether.h>
+
+int
+main (int argc, char *argv[])
+{
+  struct ether_addr *val;
+  int result;
+
+  val = ether_aton ("12:34:56:78:9a:bc");
+
+  printf ("ether_aton (\"12:34:56:78:9a:bc\") = %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\n",
+         val->ether_addr_octet[0],
+         val->ether_addr_octet[1],
+         val->ether_addr_octet[2],
+         val->ether_addr_octet[3],
+         val->ether_addr_octet[4],
+         val->ether_addr_octet[5]);
+
+
+  result = (val->ether_addr_octet[0] != 0x12
+           || val->ether_addr_octet[1] != 0x34
+           || val->ether_addr_octet[2] != 0x56
+           || val->ether_addr_octet[3] != 0x78
+           || val->ether_addr_octet[4] != 0x9a
+           || val->ether_addr_octet[5] != 0xbc);
+
+  return result;
+}