From 4547c1a410fbc3ab5592a68bac1661135d91983f Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 16 Sep 1997 21:51:15 +0000 Subject: Update. 1997-09-16 23:48 Ulrich Drepper * libio/fileops.c: Define __set_errno if necessary. * libio/libioP.h: Don't use __BEGIN_DECLS/__END_DECLS, expand macros. 1997-09-16 22:03 Ulrich Drepper * string/Makefile (headers): Instead bits/string2.h. Reported by David S. Miller . 1997-09-16 13:31 David S. Miller * sysdeps/unix/sysv/linux/sparc/sparc64/bits/statfs.h: New file. 1997-09-16 17:42 Ulrich Drepper * sysdeps/generic/bits/select.h (__FD_ZERO): Declare __arr variable as of type __fdset *. * sysdeps/i386/bits/select.h: Likewise. Reported by David S. Miller . 1997-09-16 04:32 Ulrich Drepper * hesiod/hesiod.c: Don't use and define cistrcmp. We have strcasecmp. (hesiod_init): Use of HES_DOMAIN need not be protected by __secure_getenv. (hesiod_to_bind): Avoid using strcat and extra strlen calls, use stpcpy. * string/Makefile (noinl-tester-ENV): New variable to make strerror test pass. (CFLAGS-noinl-tester): Make sure we test the correct functions. * sysdeps/stub/atomicity.h: Fix typo. Zack Weinberg told me this twice. * manual/string.texi: Document strnlen and mempcpy. Tell a bit more about the locale dependence of strcasecmp and strncasecmp. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Remove ptrace. * sysdeps/unix/sysv/linux/sys/ptrace.h (ptrace): Change return value type to long int. * sysdeps/unix/sysv/linux/ptrace.c: Likewise. Adopt local variable types. * sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S: Fix typo. Patches by David S. Miller . --- manual/string.texi | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'manual/string.texi') diff --git a/manual/string.texi b/manual/string.texi index 48aaaf0965..d6c09b8df9 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -168,6 +168,26 @@ strlen (string) @end smallexample @end deftypefun +@comment string.h +@comment GNU +@deftypefun size_t strnlen (const char *@var{s}, size_t @var{maxlen}) +The @code{strnlen} function returns the length of the null-terminated +string @var{s} is this length is smaller than @var{maxlen}. Otherwise +it returns @var{maxlen}. Therefore this function is equivalent to +@code{(strlen (@var{s}) < n ? strlen (@var{s}) : @var{maxlen})} but it +is more efficent. + +@smallexample +char string[32] = "hello, world"; +strnlen (string, 32) + @result{} 12 +strnlen (string, 5) + @result{} 5 +@end smallexample + +This function is a GNU extension. +@end deftypefun + @node Copying and Concatenation @section Copying and Concatenation @@ -223,6 +243,33 @@ memcpy (new, old, arraysize * sizeof (struct foo)); @end smallexample @end deftypefun +@comment string.h +@comment GNU +@deftypefun {void *} mempcpy (void *@var{to}, const void *@var{from}, size_t @var{size}) +The @code{mempcpy} function is nearly identical to the @code{memcpy} +function. It copies @var{size} byts from the object beginning at +@code{from} into the object pointed to by @var{to}. But instead of +returning the value of @code{to} it returns a pointer to the byte +following the last written byte in the object beginning at @var{to}. +I.e., the value is @code{((void *) ((char *) @var{to} + @var{size}))}. + +This function is useful in situations where a number of objects shall be +copied to consecutive memory positions. + +@smallexample +void * +combine (void *o1, size_t s1, void *o2, size_t s2) +@{ + void *result = malloc (s1 + s2); + if (result != NULL) + mempcpy (mempcpy (result, o1, s1), o2, s2); + return result; +@} +@end smallexample + +This function is a GNU extension. +@end deftypefun + @comment string.h @comment ISO @deftypefun {void *} memmove (void *@var{to}, const void *@var{from}, size_t @var{size}) @@ -565,8 +612,11 @@ is an initial substring of @var{s2}, then @var{s1} is considered to be @comment string.h @comment BSD @deftypefun int strcasecmp (const char *@var{s1}, const char *@var{s2}) -This function is like @code{strcmp}, except that differences in case -are ignored. +This function is like @code{strcmp}, except that differences in case are +ignored. How uppercase and lowercase character are related is +determined by the currently selected locale. In the standard @code{"C"} +locale the characters @"A and @"a do not match but in a locale which +regards this characters as parts of the alphabeth they do match. @code{strcasecmp} is derived from BSD. @end deftypefun @@ -575,7 +625,8 @@ are ignored. @comment BSD @deftypefun int strncasecmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n}) This function is like @code{strncmp}, except that differences in case -are ignored. +are ignored. Like for @code{strcasecmp} it is locale dependent how +uppercase and lowercase character are related. @code{strncasecmp} is a GNU extension. @end deftypefun -- cgit 1.4.1