aboutsummaryrefslogtreecommitdiff
path: root/manual/string.texi
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-09-16 21:51:15 +0000
committerUlrich Drepper <drepper@redhat.com>1997-09-16 21:51:15 +0000
commit4547c1a410fbc3ab5592a68bac1661135d91983f (patch)
treed1fee6956e5438e15e02c43ea7e9b03556271564 /manual/string.texi
parent61eb22d3a8e9bb9c339bdbe907a85656823f4c7e (diff)
downloadglibc-4547c1a410fbc3ab5592a68bac1661135d91983f.zip
glibc-4547c1a410fbc3ab5592a68bac1661135d91983f.tar.gz
glibc-4547c1a410fbc3ab5592a68bac1661135d91983f.tar.bz2
1997-09-16 23:48 Ulrich Drepper <drepper@cygnus.com> * 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 <drepper@cygnus.com> * string/Makefile (headers): Instead bits/string2.h. Reported by David S. Miller <davem@jenolan.rutgers.edu>. 1997-09-16 13:31 David S. Miller <davem@tanya.rutgers.edu> * sysdeps/unix/sysv/linux/sparc/sparc64/bits/statfs.h: New file. 1997-09-16 17:42 Ulrich Drepper <drepper@cygnus.com> * 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 <davem@jenolan.rutgers.edu>. 1997-09-16 04:32 Ulrich Drepper <drepper@cygnus.com> * 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 <zack@rabi.phys.columbia.edu> 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 <davem@jenolan.rutgers.edu>.
Diffstat (limited to 'manual/string.texi')
-rw-r--r--manual/string.texi57
1 files changed, 54 insertions, 3 deletions
diff --git a/manual/string.texi b/manual/string.texi
index 48aaaf0..d6c09b8 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
@@ -224,6 +244,33 @@ memcpy (new, old, arraysize * sizeof (struct foo));
@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})
@code{memmove} copies the @var{size} bytes at @var{from} into the
@@ -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