summaryrefslogtreecommitdiff
path: root/string/tester.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-09-16 00:42:43 +0000
committerUlrich Drepper <drepper@redhat.com>1997-09-16 00:42:43 +0000
commit61eb22d3a8e9bb9c339bdbe907a85656823f4c7e (patch)
treef0cc84f2036c52f081839b17a4608fb2277b2178 /string/tester.c
parent4a9332b3765e77fecb06d7135e2fefa3d7d28806 (diff)
1997-09-16 02:14 Ulrich Drepper <drepper@cygnus.com> Implementation of Hesiod NSS module by Mark Kettenis. * hesiod/Makefile: New file. * hesiod/hesiod.c: New file. * hesiod/hesiod.h: New file. * hesiod/hesiod_p.h: New file. * hesiod/libnss_hesiod.map: New file. * hesiod/nss_hesiod/hesiod-grp.c: New file. * hesiod/nss_hesiod/hesiod-pwd.c: New file. * hesiod/nss_hesiod/hesiod-service.c: New file. * sysdeps/unix/inet/Subdirs: Add hesiod. * shlib-versions: Add version number for libnss_hesiod. * libio/iolibio.h: Remove definition of _IO_* macros. * libio/fileops.c: Define close, fstat, lseek, read, and write as macros to use __ protected versions. Use those functions instead of _IO_* functions. * libio/iopopen.c: Define _IO_close to close. * manual/math.texi: Explain the use of the optimizing inline functions. Describe rand_r function and tell about SysV RNGs in introduction. * resolv/res_send.c (res_send): Use socklen_t type for `fromlen' variable. * string/Makefile (tests): Add noinl-tester. * string/noinl-tester.c: New file. * string/tester.c: Add more stpcpy tests for constant arguments for all short lengths. * string/string.h: Always declare __bzero. Describe __NO_STRING_INLINES. Always include <bits/string.h>. * string/bits/string2.h: Add warning about direct use. Change __strcpy_small and __stpcpy_small implementation to use macros and provide alternative for platforms which cannot do unaligned stores. * sysdeps/i386/bits/string.h: Don't define anything is __NO_STRING_INLINES is defined. * sysdeps/i386/i486/bits/string.h: Change __strcpy_small and __stpcpy_small implementation to use macros and provide alternative for platforms which cannot do unaligned stores. * sysdeps/alpha/bzero.S: Define bzero as weak alias of __bzero. * sysdeps/generic/bzero.c: Likewise. * sysdeps/i386/bzero.c: Likewise. * sysdeps/i386/i586/bzero.S: Likewise. * sysdeps/vax/bzero.s: Likewise. * sysdeps/generic/bits/select.h: Don't use ugly casts to access array. * sysdeps/i386/bits/select.h: Likewise. * sysdeps/i386/fpu/bits/mathinline.c (__finite): Relax register constraints a bit. Don't define and test for _BITS_MATHINLINE_H. Emit warning if used directly and not through math.h. * sysdeps/i386/i486/atomicity.h: Change return type of compare_and_swap to char to get better code. Fix typo. * sysdeps/stub/atomicity.h: Fix typo. 1997-09-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/stpcpy.c: #undef stpcpy and __stpcpy. 1997-09-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * string/bits/string2.h: Add prototypes to avoid warning. 1997-09-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * string/bits/string2.h (strsep): Fix handling of empty REJECT. (__strsep_1c): Handle NULL and empty string. (__strsep_g): Likewise. 1997-09-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * catgets/Makefile (extra-objs): Set this instead of generated. * md5-crypt/Makefile (extra-objs): Add all object file variants of onlymd5-entry. 1997-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/sysd-stdio.c (__stdio_read): Fix typo in last change. 1997-09-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/m68020/atomicity.h: New file. 1997-09-15 05:11 Ulrich Drepper <drepper@cygnus.com> * posix/Makefile (distribute): Add globtest.c and globtest.sh. Compile and run globtest if not cross-compiling. * posix/globtest.c: New file. * posix/globtest.sh: New file. * posix/glob.c: Pretty print preprocessor stuff. (glob_in_dir): If PATTERN is not really a pattern still check whether it is a real file in the current directory and return error if not. Reported by Eugene Mamchits <eugin@ips.ras.ru>. * libio/fileops.c (_IO_file_sync): Acquire lock before doing the work. * libio/ioseekoff.c (_IO_seekoff): Likewise. * libio/ioseekpos.c (_IO_seekpos): Likewise. 1997-09-13 18:06 Ulrich Drepper <drepper@cygnus.com> * configure.in: Prevent configuration for unsupported platforms. 1997-09-13 04:07 Ulrich Drepper <drepper@cygnus.com> * elf/rtld.c (dl_main): Make sure we always have a file argument by testing for < 2 arguments after recognizing the options. 1997-09-12 11:47 Fila Kolodny <fila@ibi.com> * string/bits/string2.h (__strsep_1c): Cast out const from __retval. (__strsep_g): Likewise.
Diffstat (limited to 'string/tester.c')
-rw-r--r--string/tester.c64
1 files changed, 56 insertions, 8 deletions
diff --git a/string/tester.c b/string/tester.c
index dfb1258864..ee36e12a6d 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -135,16 +135,64 @@ main (void)
/* A closely related function is stpcpy. */
it = "stpcpy";
- check ((stpcpy (one, "abcde") - one) == 5, 1);
- equal (one, "abcde", 2);
+ check ((stpcpy (one, "a") - one) == 1, 1);
+ equal (one, "a", 2);
- check ((stpcpy (one, "x") - one) == 1, 3);
- equal (one, "x", 4); /* Writeover. */
- equal (one+2, "cde", 5); /* Wrote too much? */
+ check ((stpcpy (one, "ab") - one) == 2, 3);
+ equal (one, "ab", 4);
- check ((stpcpy (stpcpy (stpcpy (one, "a"), "b"), "c") - one) == 3, 6);
- equal (one, "abc", 7);
- equal (one + 4, "e", 8);
+ check ((stpcpy (one, "abc") - one) == 3, 5);
+ equal (one, "abc", 6);
+
+ check ((stpcpy (one, "abcd") - one) == 4, 7);
+ equal (one, "abcd", 8);
+
+ check ((stpcpy (one, "abcde") - one) == 5, 9);
+ equal (one, "abcde", 10);
+
+ check ((stpcpy (one, "abcdef") - one) == 6, 11);
+ equal (one, "abcdef", 12);
+
+ check ((stpcpy (one, "abcdefg") - one) == 7, 13);
+ equal (one, "abcdefg", 14);
+
+ check ((stpcpy (one, "abcdefgh") - one) == 8, 15);
+ equal (one, "abcdefgh", 16);
+
+ check ((stpcpy (one, "abcdefghi") - one) == 9, 17);
+ equal (one, "abcdefghi", 18);
+
+ check ((stpcpy (one, "x") - one) == 1, 19);
+ equal (one, "x", 20); /* Writeover. */
+ equal (one+2, "cdefghi", 21); /* Wrote too much? */
+
+ check ((stpcpy (one, "xx") - one) == 2, 22);
+ equal (one, "xx", 23); /* Writeover. */
+ equal (one+3, "defghi", 24); /* Wrote too much? */
+
+ check ((stpcpy (one, "xxx") - one) == 3, 25);
+ equal (one, "xxx", 26); /* Writeover. */
+ equal (one+4, "efghi", 27); /* Wrote too much? */
+
+ check ((stpcpy (one, "xxxx") - one) == 4, 28);
+ equal (one, "xxxx", 29); /* Writeover. */
+ equal (one+5, "fghi", 30); /* Wrote too much? */
+
+ check ((stpcpy (one, "xxxxx") - one) == 5, 31);
+ equal (one, "xxxxx", 32); /* Writeover. */
+ equal (one+6, "ghi", 33); /* Wrote too much? */
+
+ check ((stpcpy (one, "xxxxxx") - one) == 6, 34);
+ equal (one, "xxxxxx", 35); /* Writeover. */
+ equal (one+7, "hi", 36); /* Wrote too much? */
+
+ check ((stpcpy (one, "xxxxxxx") - one) == 7, 37);
+ equal (one, "xxxxxxx", 38); /* Writeover. */
+ equal (one+8, "i", 39); /* Wrote too much? */
+
+ check ((stpcpy (stpcpy (stpcpy (one, "a"), "b"), "c") - one) == 3, 40);
+ equal (one, "abc", 41);
+ equal (one + 4, "xxx", 42);
/* stpncpy. */
it = "stpncpy";