summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2008-05-27 20:04:27 +0000
committerXin LI <delphij@FreeBSD.org>2008-05-27 20:04:27 +0000
commita42061812f70428fb1285f6756dfd08ab7013f29 (patch)
tree4cc7272a227dadc1d572f8dcf6f7cd97f46c75a5 /lib/libc/string
parent773f501a7252190d5fe9e73dde9f2f0420dc8667 (diff)
Notes
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/Makefile.inc3
-rw-r--r--lib/libc/string/Symbol.map4
-rw-r--r--lib/libc/string/memchr.331
3 files changed, 34 insertions, 4 deletions
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 6d64ea5a08c9..9e5f0dab9b3b 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -7,7 +7,7 @@ CFLAGS+= -I${.CURDIR}/locale
# machine-independent string sources
MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c fls.c flsl.c index.c memccpy.c \
- memchr.c memcmp.c \
+ memchr.c memrchr.c memcmp.c \
memcpy.c memmem.c memmove.c memset.c rindex.c stpcpy.c strcasecmp.c \
strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c \
@@ -39,6 +39,7 @@ MLINKS+=ffs.3 ffsl.3
MLINKS+=ffs.3 fls.3
MLINKS+=ffs.3 flsl.3
MLINKS+=index.3 rindex.3
+MLINKS+=memchr.3 memrchr.3
MLINKS+=strcasecmp.3 strncasecmp.3
MLINKS+=strcat.3 strncat.3
MLINKS+=strchr.3 strrchr.3
diff --git a/lib/libc/string/Symbol.map b/lib/libc/string/Symbol.map
index ad9f74327f13..d034ecce718b 100644
--- a/lib/libc/string/Symbol.map
+++ b/lib/libc/string/Symbol.map
@@ -77,6 +77,10 @@ FBSD_1.0 {
wmemset;
};
+FBSD_1.1 {
+ memrchr;
+};
+
FBSDprivate_1.0 {
__strtok_r;
};
diff --git a/lib/libc/string/memchr.3 b/lib/libc/string/memchr.3
index d82d859dd0f1..5cbaf6cc1779 100644
--- a/lib/libc/string/memchr.3
+++ b/lib/libc/string/memchr.3
@@ -32,7 +32,7 @@
.\" @(#)memchr.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd April 9, 2008
.Dt MEMCHR 3
.Os
.Sh NAME
@@ -44,6 +44,8 @@
.In string.h
.Ft void *
.Fn memchr "const void *b" "int c" "size_t len"
+.Ft void *
+.Fn memrchr "const void *b" "int c" "size_t len"
.Sh DESCRIPTION
The
.Fn memchr
@@ -53,11 +55,22 @@ locates the first occurrence of
(converted to an unsigned char)
in string
.Fa b .
+.Pp
+The
+.Fn memrchr
+function behaves like
+.Fn memchr ,
+except that it locates the last occurrence of
+.Fa c
+in string
+.Fa b .
.Sh RETURN VALUES
The
.Fn memchr
-function
-returns a pointer to the byte located,
+and
+.Fn memrchr
+functions
+return a pointer to the byte located,
or NULL if no such byte exists within
.Fa len
bytes.
@@ -77,3 +90,15 @@ The
function
conforms to
.St -isoC .
+.Pp
+The
+.Fn memrchr
+function is a GNU extension and conforms to no standard.
+.Sh HISTORY
+The
+.Fn memrchr
+function first appeared in GNU libc 2.1.91, this implementation
+first appeared in
+.Fx 8.0 ,
+coming from
+.Ox 4.3 .