+/* Test for string function add boundaries of usable memory.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ 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. */
+
#define _GNU_SOURCE 1
+
+/* Make sure we don't test the optimized inline functions if we want to
+ test the real implementation. */
+#undef __USE_STRING_INLINES
+
#include <errno.h>
#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
- size_t size = sysconf (_SC_PAGESIZE);
+ int size = sysconf (_SC_PAGESIZE);
char *adr, *dest;
int result = 0;
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
dest = (char *) mmap (NULL, 3*size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
- if (adr == (char *)-1L || dest == (char *)-1L)
+ if (adr == MAP_FAILED || dest == MAP_FAILED)
{
if (errno == ENOSYS)
puts ("No test, mmap not available.");
else
{
- printf ("mmaping failed: %m");
+ printf ("mmap failed: %m");
result = 1;
}
}
{
adr[inner] = '\0';
- if (strlen (&adr[outer]) != inner - outer)
+ if (strlen (&adr[outer]) != (size_t) (inner - outer))
{
printf ("strlen flunked for outer = %d, inner = %d\n",
outer, inner);
adr[inner] = '\0';
if (strcpy (dest, &adr[outer]) != dest
- || strlen (dest) != inner - outer)
+ || strlen (dest) != (size_t) (inner - outer))
{
printf ("strcpy flunked for outer = %d, inner = %d\n",
outer, inner);