]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Update gnulib files.
authorSimon Josefsson <simon@josefsson.org>
Thu, 5 Nov 2009 13:44:12 +0000 (14:44 +0100)
committerSimon Josefsson <simon@josefsson.org>
Thu, 5 Nov 2009 13:44:12 +0000 (14:44 +0100)
gl/m4/gnulib-comp.m4
gl/m4/inet_ntop.m4
gl/m4/inet_pton.m4
gl/tests/Makefile.am
gl/tests/test-inet_ntop.c [new file with mode: 0644]
gl/tests/test-inet_pton.c [new file with mode: 0644]
gl/tests/test-sys_socket.c
lib/gl/tests/test-func.c
lib/gl/tests/test-sys_socket.c
libextra/gl/md5.c

index 669e6d8b1d3bd8eba3211ae5afa3b42001e5ed06..f4bf32e54ac6c721d5a52cbff3b884507368951e 100644 (file)
@@ -237,6 +237,8 @@ AC_SUBST([LTALLOCA])
   gl_source_base='gl/tests'
   gl_FUNC_UNGETC_WORKS
   gl_FUNC_GETTIMEOFDAY
+  AC_C_BIGENDIAN
+  AC_C_BIGENDIAN
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   if test "$ac_cv_header_winsock2_h" = yes; then
     dnl Even if the 'socket' module is not used here, another part of the
@@ -527,6 +529,8 @@ AC_DEFUN([gl_FILE_LIST], [
   tests/test-getdelim.c
   tests/test-getline.c
   tests/test-gettimeofday.c
+  tests/test-inet_ntop.c
+  tests/test-inet_pton.c
   tests/test-lseek.c
   tests/test-lseek.sh
   tests/test-memchr.c
index ea645f242f7b16ecfb04f5c8312966efc62dda19..2a8ff205159bdc34de53e2f2d9a37e104b13f776 100644 (file)
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 10
+# inet_ntop.m4 serial 11
 dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,7 @@ AC_DEFUN([gl_INET_NTOP],
     [AC_REPLACE_FUNCS([inet_ntop])])
   LIBS=$gl_save_LIBS
   INET_NTOP_LIB=
-  if test "$ac_cv_search_inet_ntop" != "none needed" &&
+  if test "$ac_cv_search_inet_ntop" != "no" &&
      test "$ac_cv_search_inet_ntop" != "none required"; then
     INET_NTOP_LIB="$ac_cv_search_inet_ntop"
   fi
index 068deee628a81079c405b0d3d64a119ebd6a7546..e890b9b7a09404d75319464ce2f07f9a9aa64822 100644 (file)
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 8
+# inet_pton.m4 serial 9
 dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,7 @@ AC_DEFUN([gl_INET_PTON],
     [AC_REPLACE_FUNCS([inet_pton])])
   LIBS=$gl_save_LIBS
   INET_PTON_LIB=
-  if test "$ac_cv_search_inet_pton" != "none needed" &&
+  if test "$ac_cv_search_inet_pton" != "no" &&
      test "$ac_cv_search_inet_pton" != "none required"; then
     INET_PTON_LIB="$ac_cv_search_inet_pton"
   fi
index 94918936fcca622357d6f5e97de6c63cb3ede804..cd2ebd9591d0dc76062a1d1b93c105478f97ea3d 100644 (file)
@@ -142,6 +142,24 @@ EXTRA_DIST += test-gettimeofday.c
 
 ## end   gnulib module gettimeofday-tests
 
+## begin gnulib module inet_ntop-tests
+
+TESTS += test-inet_ntop
+check_PROGRAMS += test-inet_ntop
+test_inet_ntop_LDADD = $(LDADD) @INET_NTOP_LIB@
+EXTRA_DIST += test-inet_ntop.c
+
+## end   gnulib module inet_ntop-tests
+
+## begin gnulib module inet_pton-tests
+
+TESTS += test-inet_pton
+check_PROGRAMS += test-inet_pton
+test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@
+EXTRA_DIST += test-inet_pton.c
+
+## end   gnulib module inet_pton-tests
+
 ## begin gnulib module ioctl
 
 
diff --git a/gl/tests/test-inet_ntop.c b/gl/tests/test-inet_ntop.c
new file mode 100644 (file)
index 0000000..71ba5c3
--- /dev/null
@@ -0,0 +1,64 @@
+/* Test of inet_ntop function.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <arpa/inet.h>
+
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define ASSERT(expr) \
+  do                                                                        \
+    {                                                                       \
+      if (!(expr))                                                          \
+        {                                                                   \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          fflush (stderr);                                                  \
+          abort ();                                                         \
+        }                                                                   \
+    }                                                                       \
+  while (0)
+
+int
+main (void)
+{
+#if defined AF_INET /* HAVE_IPV4 */
+  {
+    struct in_addr internal;
+    char printable[16];
+    const char *result;
+
+    /* This machine was for a long time known as
+       ma2s2.mathematik.uni-karlsruhe.de.  */
+# ifdef WORDS_BIGENDIAN
+    internal.s_addr = 0x810D7302;
+# else
+    internal.s_addr = 0x02730D81;
+# endif
+    result = inet_ntop (AF_INET, &internal, printable, sizeof (printable));
+    ASSERT (result != NULL);
+    ASSERT (strcmp (result, "129.13.115.2") == 0);
+  }
+#endif
+
+  return 0;
+}
diff --git a/gl/tests/test-inet_pton.c b/gl/tests/test-inet_pton.c
new file mode 100644 (file)
index 0000000..b6c3ab2
--- /dev/null
@@ -0,0 +1,67 @@
+/* Test of inet_pton function.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
+
+#include <config.h>
+
+#include <arpa/inet.h>
+
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ASSERT(expr) \
+  do                                                                        \
+    {                                                                       \
+      if (!(expr))                                                          \
+        {                                                                   \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          fflush (stderr);                                                  \
+          abort ();                                                         \
+        }                                                                   \
+    }                                                                       \
+  while (0)
+
+int
+main (void)
+{
+#if defined AF_INET /* HAVE_IPV4 */
+  {
+    /* This machine was for a long time known as
+       ma2s2.mathematik.uni-karlsruhe.de.  */
+    const char printable[] = "129.13.115.2";
+    struct in_addr internal;
+    int ret;
+
+    ret = inet_pton (AF_INET, printable, &internal);
+    ASSERT (ret == 1);
+    /* Verify that internal is filled in network byte order.  */
+    ASSERT (((unsigned char *) &internal)[0] == 0x81);
+    ASSERT (((unsigned char *) &internal)[1] == 0x0D);
+    ASSERT (((unsigned char *) &internal)[2] == 0x73);
+    ASSERT (((unsigned char *) &internal)[3] == 0x02);
+# ifdef WORDS_BIGENDIAN
+    ASSERT (internal.s_addr == 0x810D7302);
+# else
+    ASSERT (internal.s_addr == 0x02730D81);
+# endif
+  }
+#endif
+
+  return 0;
+}
index ddb491b312df757340e87496000783fb12c0a278..606708dc1a5bdf49f71bb22c82c42313ec87cb9f 100644 (file)
@@ -47,7 +47,7 @@ main (void)
     }
 
   x.ss_family = 42;
-  i = 4711;
+  i = 42;
 
   return 0;
 }
index 8a3c465e73f6a39abe83a3a0e9d731889ab85080..3c2de3cf7e79ab4ae02b6b31aa759917360bc5c8 100644 (file)
@@ -45,5 +45,8 @@ main ()
   ASSERT (strlen (__func__) + 1 == sizeof __func__);
 #endif
 
+  assert (strcmp (__func__, "main") == 0
+         || strcmp (__func__, "<unknown function>") == 0);
+
   return 0;
 }
index ddb491b312df757340e87496000783fb12c0a278..606708dc1a5bdf49f71bb22c82c42313ec87cb9f 100644 (file)
@@ -47,7 +47,7 @@ main (void)
     }
 
   x.ss_family = 42;
-  i = 4711;
+  i = 42;
 
   return 0;
 }
index 2eb66ed578103e00a2bb78caa36b6e5dc478026c..0905367bdd7f48b0d8896de98f53e0d54208701c 100644 (file)
@@ -63,7 +63,7 @@
 
 /* This array contains the bytes used to pad the buffer to the next
    64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
-static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */  };
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
 
 
 /* Initialize structure containing state of computation.
@@ -129,13 +129,13 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
   return md5_read_ctx (ctx, resbuf);
 }
 
-#if 0                          /* Not needed by GnuTLS, and it has a large stack frame. */
+#if 0 /* Not needed by GnuTLS, and it has a large stack frame. */
 
 /* Compute MD5 message digest for bytes read from STREAM.  The
    resulting message digest number will be written into the 16 bytes
    beginning at RESBLOCK.  */
 int
-md5_stream (FILE * stream, void *resblock)
+md5_stream (FILE *stream, void *resblock)
 {
   struct md5_ctx ctx;
   size_t sum;