aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-03 17:00:25 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-03 17:00:25 +0000
commit1aadea5917b691d2fac2dcb96da3ed366c10b870 (patch)
tree502d4e1de24f3031e4a0138e0fca707746f82a50
parentUpdate. (diff)
downloadglibc-1aadea5917b691d2fac2dcb96da3ed366c10b870.tar.gz
glibc-1aadea5917b691d2fac2dcb96da3ed366c10b870.tar.bz2
glibc-1aadea5917b691d2fac2dcb96da3ed366c10b870.zip
Update.
2000-01-03 Andreas Jaeger <aj@suse.de> * include/resolv.h: Remove declarations for __ns_name_ntop and __ns_name_unpack since those are available in resolv/arpa/nameser.h. 2000-01-03 Andreas Jaeger <aj@suse.de> * time/tst-strptime.c (test_tm): Add tests for all fields of struct tm. 2000-01-03 Ulrich Drepper <drepper@cygnus.com> * string/bits/string2.h (__strsep_g): Don't handle empty __S special. 2000-01-03 Andreas Jaeger <aj@suse.de> * string/tester.c (test_strsep): Add one more test. 2000-01-03 Philip Blundell <philb@gnu.org> * string/tester.c (test_mempcpy): New function. (main): Call it. (test_memcpy): Test unaligned cases too. * sysdeps/arm/bits/string.h (_HAVE_STRING_ARCH_mempcpy): Define. * sysdeps/arm/fpu/bits/mathdef.h: New file. * nss/Makefile: Add rules to build makedb.
-rw-r--r--ChangeLog29
-rw-r--r--include/resolv.h6
-rw-r--r--nss/Makefile6
-rw-r--r--posix/tst-mmap.c1
-rw-r--r--string/bits/string2.h4
-rw-r--r--string/tester.c64
-rw-r--r--sysdeps/arm/bits/string.h8
-rw-r--r--sysdeps/arm/fpu/bits/mathdef.h54
-rw-r--r--time/tst-strptime.c67
9 files changed, 225 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index fee7a5ea2e..16e8f89729 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2000-01-03 Andreas Jaeger <aj@suse.de>
+
+ * include/resolv.h: Remove declarations for __ns_name_ntop and
+ __ns_name_unpack since those are available in resolv/arpa/nameser.h.
+
+2000-01-03 Andreas Jaeger <aj@suse.de>
+
+ * time/tst-strptime.c (test_tm): Add tests for all fields of
+ struct tm.
+
+2000-01-03 Ulrich Drepper <drepper@cygnus.com>
+
+ * string/bits/string2.h (__strsep_g): Don't handle empty __S special.
+
+2000-01-03 Andreas Jaeger <aj@suse.de>
+
+ * string/tester.c (test_strsep): Add one more test.
+
+2000-01-03 Philip Blundell <philb@gnu.org>
+
+ * string/tester.c (test_mempcpy): New function.
+ (main): Call it.
+ (test_memcpy): Test unaligned cases too.
+
+ * sysdeps/arm/bits/string.h (_HAVE_STRING_ARCH_mempcpy): Define.
+
+ * sysdeps/arm/fpu/bits/mathdef.h: New file.
+
2000-01-02 Ulrich Drepper <drepper@cygnus.com>
* posix/Makefile (tests): Add tst-mmap.
@@ -34,6 +62,7 @@
typos (__ASSUME_TRUNCATE64_SYSCALL -> __ASSUME_MMAP2_SYSCALL).
Reported by Philip Blundell <Philip.Blundell@pobox.com>.
+ * nss/Makefile: Add rules to build makedb.
* nss/nss_db/nss_db.h: Add definitions needed for makedb.
* nss/nss_db/dummy-db.h: Likewise.
* nss/makedb.c: New file. Copied from file in db2, modified to not
diff --git a/include/resolv.h b/include/resolv.h
index cf4f3754b0..95b9eebef8 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -1,7 +1 @@
#include <resolv/resolv.h>
-
-/* Internal interfaces. */
-
-extern int __ns_name_ntop (const u_char *, char *, size_t);
-extern int __ns_name_unpack (const u_char *, const u_char *,
- const u_char *, u_char *, size_t);
diff --git a/nss/Makefile b/nss/Makefile
index 685047fc42..e481446d38 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -36,8 +36,8 @@ routines = nsswitch $(addsuffix -lookup,$(databases))
databases = proto service hosts network grp pwd rpc ethers \
spwd netgrp key alias
-others := getent
-install-bin := getent
+others := getent makedb
+install-bin := getent makedb
tests = test-netdb
@@ -72,6 +72,8 @@ generated += $(filter-out db-alias.c db-netgrp.c, \
distribute += db-XXX.c nss_db.h dummy-db.h
+$(objpfx)makedb: $(libdl)
+
# Build static module if requested
ifneq ($(build-static-nss),yes)
libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
diff --git a/posix/tst-mmap.c b/posix/tst-mmap.c
index 0332828723..7a57366903 100644
--- a/posix/tst-mmap.c
+++ b/posix/tst-mmap.c
@@ -36,6 +36,7 @@ main (void)
printf ("`fwrite' failed: %m\n");
return 1;
}
+ fflush (fp);
assert (ps + 1000 < c * sizeof (buf));
/* First try something which is not allowed: map at an offset which is
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 336aafef9a..db6ba97bbc 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -1,5 +1,5 @@
/* Machine-independant string function optimizations.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -1165,7 +1165,7 @@ __STRING_INLINE char *
__strsep_g (char **__s, __const char *__reject)
{
register char *__retval = *__s;
- if (__retval == NULL || *__retval == '\0')
+ if (__retval == NULL)
return NULL;
if ((*__s = strpbrk (__retval, __reject)) != NULL)
*(*__s)++ = '\0';
diff --git a/string/tester.c b/string/tester.c
index d9043e046f..ebb65ce725 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -1,5 +1,5 @@
/* Tester for string functions.
- Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999, 2000 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
@@ -928,6 +928,13 @@ test_strsep (void)
equal(ptr, "", 83);
check(ptr == one, 84);
check(cp == NULL, 85);
+
+ *one = '\0'; /* Empty string and no token. */
+ cp = one;
+ ptr = strsep(&cp, "");
+ equal(ptr, "", 86);
+ check(ptr == one , 87);
+ check(cp == NULL, 88);
}
void
@@ -990,6 +997,7 @@ test_memchr (void)
void
test_memcpy (void)
{
+ int i;
it = "memcpy";
check(memcpy(one, "abc", 4) == one, 1); /* Returned value. */
equal(one, "abc", 2); /* Did the copy go right? */
@@ -1007,6 +1015,57 @@ test_memcpy (void)
(void) memcpy(two, one, 9);
equal(two, "hi there", 5); /* Just paranoia. */
equal(one, "hi there", 6); /* Stomped on source? */
+
+ for (i = 0; i < 16; i++)
+ {
+ const char *x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+ strcpy (one, x);
+ check (memcpy (one + i, "hi there", 9) == one + i,
+ 7 + (i * 6)); /* Unaligned destination. */
+ check (memcmp (one, x, i) == 0, 8 + (i * 6)); /* Wrote under? */
+ equal (one + i, "hi there", 9 + (i * 6));
+ check (one[i + 9] == 'x', 10 + (i * 6)); /* Wrote over? */
+ check (memcpy (two, one + i, 9) == two,
+ 11 + (i * 6)); /* Unaligned source. */
+ equal (two, "hi there", 12 + (i * 6));
+ }
+}
+
+void
+test_mempcpy (void)
+{
+ int i;
+ it = "mempcpy";
+ check(mempcpy(one, "abc", 4) == one + 4, 1); /* Returned value. */
+ equal(one, "abc", 2); /* Did the copy go right? */
+
+ (void) strcpy(one, "abcdefgh");
+ (void) mempcpy(one+1, "xyz", 2);
+ equal(one, "axydefgh", 3); /* Basic test. */
+
+ (void) strcpy(one, "abc");
+ (void) mempcpy(one, "xyz", 0);
+ equal(one, "abc", 4); /* Zero-length copy. */
+
+ (void) strcpy(one, "hi there");
+ (void) strcpy(two, "foo");
+ (void) mempcpy(two, one, 9);
+ equal(two, "hi there", 5); /* Just paranoia. */
+ equal(one, "hi there", 6); /* Stomped on source? */
+
+ for (i = 0; i < 16; i++)
+ {
+ const char *x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+ strcpy (one, x);
+ check (mempcpy (one + i, "hi there", 9) == one + i + 9,
+ 7 + (i * 6)); /* Unaligned destination. */
+ check (memcmp (one, x, i) == 0, 8 + (i * 6)); /* Wrote under? */
+ equal (one + i, "hi there", 9 + (i * 6));
+ check (one[i + 9] == 'x', 10 + (i * 6)); /* Wrote over? */
+ check (mempcpy (two, one + i, 9) == two + 9,
+ 11 + (i * 6)); /* Unaligned source. */
+ equal (two, "hi there", 12 + (i * 6));
+ }
}
void
@@ -1295,6 +1354,9 @@ main (void)
/* memmove - must work on overlap. */
test_memmove ();
+ /* mempcpy */
+ test_mempcpy ();
+
/* memccpy. */
test_memccpy ();
diff --git a/sysdeps/arm/bits/string.h b/sysdeps/arm/bits/string.h
index 4ca2e307a1..094f90192d 100644
--- a/sysdeps/arm/bits/string.h
+++ b/sysdeps/arm/bits/string.h
@@ -1,5 +1,5 @@
/* Optimized, inlined string functions. ARM version.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 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
@@ -22,6 +22,10 @@
#endif
/* We must defeat the generic optimized versions of these functions in
- <bits/string2.h> since they don't work on the ARM. */
+ <bits/string2.h> since they don't work on the ARM. This is because
+ the games they play with the __STRING2_COPY_ARR# structures fail
+ when structs are always 32-bit aligned.
+ XXX Should provide suitably optimal replacements. */
#define _HAVE_STRING_ARCH_strcpy 1
#define _HAVE_STRING_ARCH_stpcpy 1
+#define _HAVE_STRING_ARCH_mempcpy 1
diff --git a/sysdeps/arm/fpu/bits/mathdef.h b/sysdeps/arm/fpu/bits/mathdef.h
new file mode 100644
index 0000000000..cb0c348374
--- /dev/null
+++ b/sysdeps/arm/fpu/bits/mathdef.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 1999, 2000 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
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF 1
+
+/* GCC does not promote `float' values to `double'. */
+typedef float float_t; /* `float' expressions are evaluated as
+ `float'. */
+typedef double double_t; /* `double' expressions are evaluated as
+ `double'. */
+
+/* Signal that types stay as they were declared. */
+# define FLT_EVAL_METHOD 0
+
+/* Define `INFINITY' as value of type `float'. */
+# define INFINITY HUGE_VALF
+
+
+/* The values returned by `ilogb' for 0 and NaN respectively. */
+# define FP_ILOGB0 0x80000001
+# define FP_ILOGBNAN 0x7fffffff
+
+/* Number of decimal digits for the `double' type. */
+# define DECIMAL_DIG 15
+
+#endif /* ISO C99 */
+
+#ifndef __NO_LONG_DOUBLE_MATH
+/* Signal that we do not really have a `long double'. This disables the
+ declaration of all the `long double' function variants. */
+/* XXX The FPA does support this but the patterns in GCC are currently
+ turned off. */
+# define __NO_LONG_DOUBLE_MATH 1
+#endif
diff --git a/time/tst-strptime.c b/time/tst-strptime.c
index f92cb0c201..142c689715 100644
--- a/time/tst-strptime.c
+++ b/time/tst-strptime.c
@@ -1,5 +1,5 @@
/* Test for strptime.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -38,6 +38,69 @@ static const struct
};
+static const struct
+{
+ const char *input;
+ const char *format;
+ const char *output;
+ int wday;
+ int yday;
+} tm_tests [] =
+{
+ {"17410105012000", "%H%M%S%d%m%Y", "2000-01-05 17:41:01", 3, 4}
+};
+
+
+
+static int
+test_tm (void)
+{
+ struct tm tm;
+ int i;
+ int result = 0;
+ char buf[100];
+
+ for (i = 0; i < sizeof (tm_tests) / sizeof (tm_tests[0]); ++i)
+ {
+ memset (&tm, '\0', sizeof (tm));
+
+ if (*strptime (tm_tests[i].input, tm_tests[i].format, &tm) != '\0')
+ {
+ printf ("not all of `%s' read\n", tm_tests[i].input);
+ result = 1;
+ }
+ strftime (buf, sizeof (buf), "%F %T", &tm);
+ printf ("strptime (\"%s\", \"%s\", ...)\n"
+ "\tshould be: %s, wday = %d, yday = %3d\n"
+ "\t is: %s, wday = %d, yday = %3d\n",
+ tm_tests[i].input, tm_tests[i].format,
+ tm_tests[i].output,
+ tm_tests[i].wday, tm_tests[i].yday,
+ buf, tm.tm_wday, tm.tm_yday);
+
+ if (strcmp (buf, tm_tests[i].output) != 0)
+ {
+ printf ("Time and date are not correct.\n");
+ result = 1;
+ }
+ if (tm.tm_wday != tm_tests[i].wday)
+ {
+ printf ("weekday for `%s' incorrect: %d instead of %d\n",
+ tm_tests[i].input, tm.tm_wday, tm_tests[i].wday);
+ result = 1;
+ }
+ if (tm.tm_yday != tm_tests[i].yday)
+ {
+ printf ("yearday for `%s' incorrect: %d instead of %d\n",
+ tm_tests[i].input, tm.tm_yday, tm_tests[i].yday);
+ result = 1;
+ }
+ }
+
+ return result;
+}
+
+
int
main (int argc, char *argv[])
{
@@ -76,5 +139,7 @@ main (int argc, char *argv[])
}
}
+ result |= test_tm ();
+
return result;
}