Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/string add strchrnul
details: https://anonhg.NetBSD.org/src/rev/b27689cc0a42
branches: trunk
changeset: 348265:b27689cc0a42
user: christos <christos%NetBSD.org@localhost>
date: Wed Oct 12 20:01:12 2016 +0000
description:
add strchrnul
diffstat:
lib/libc/string/Makefile.inc | 5 +++--
lib/libc/string/strchr.3 | 27 ++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 7 deletions(-)
diffs (96 lines):
diff -r 2d0b5884720d -r b27689cc0a42 lib/libc/string/Makefile.inc
--- a/lib/libc/string/Makefile.inc Wed Oct 12 18:43:40 2016 +0000
+++ b/lib/libc/string/Makefile.inc Wed Oct 12 20:01:12 2016 +0000
@@ -1,5 +1,5 @@
# from: @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $NetBSD: Makefile.inc,v 1.80 2014/09/24 18:16:37 christos Exp $
+# $NetBSD: Makefile.inc,v 1.81 2016/10/12 20:01:12 christos Exp $
# string sources
.PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -22,7 +22,7 @@
SRCS+= explicit_memset.c consttime_memequal.c
SRCS+= memccpy.c memcpy.c memmem.c memmove.c
-SRCS+= strchr.c strrchr.c
+SRCS+= strchr.c strrchr.c strchrnul.c
SRCS+= popcount32.c popcount64.c
# wide char
@@ -59,6 +59,7 @@
MLINKS+=strlen.3 strnlen.3
MLINKS+=strstr.3 strcasestr.3
MLINKS+=strstr.3 strnstr.3
+MLINKS+=strchr.3 strchrnul.3
MLINKS+=memchr.3 memrchr.3
MLINKS+=strtok.3 strtok_r.3
MLINKS+=strerror.3 strerror_r.3 strerror.3 perror.3 \
diff -r 2d0b5884720d -r b27689cc0a42 lib/libc/string/strchr.3
--- a/lib/libc/string/strchr.3 Wed Oct 12 18:43:40 2016 +0000
+++ b/lib/libc/string/strchr.3 Wed Oct 12 20:01:12 2016 +0000
@@ -30,13 +30,13 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)strchr.3 8.2 (Berkeley) 4/19/94
-.\" $NetBSD: strchr.3,v 1.11 2003/08/07 16:43:49 agc Exp $
+.\" $NetBSD: strchr.3,v 1.12 2016/10/12 20:01:12 christos Exp $
.\"
-.Dd August 11, 2002
+.Dd October 12, 2016
.Dt STRCHR 3
.Os
.Sh NAME
-.Nm strchr
+.Nm strchr, strchrnul
.Nd locate character in string
.Sh LIBRARY
.Lb libc
@@ -44,10 +44,14 @@
.In string.h
.Ft char *
.Fn strchr "const char *s" "int c"
+.Ft char *
+.Fn strchrnul "const char *s" "int c"
.Sh DESCRIPTION
The
.Fn strchr
-function locates the first occurrence of
+and
+.Fn strchrnul
+functions locate the first occurrence of
.Ar c
in the string pointed to by
.Ar s .
@@ -59,7 +63,9 @@
is
.Ql \e0 ,
.Fn strchr
-locates the terminating
+and
+.Fn strchrnul
+locate the terminating
.Ql \e0 .
.Sh RETURN VALUES
The function
@@ -67,6 +73,13 @@
returns a pointer to the located character, or
.Dv NULL
if the character does not appear in the string.
+The function
+.Fn strchrnul
+returns a pointer to the located character, or
+the a pointer to the
+.Dv NUL
+terminating character of the string if the character does not appear
+in the string.
.Sh EXAMPLES
After the following call to
.Fn strchr ,
@@ -96,3 +109,7 @@
function
conforms to
.St -ansiC .
+.The
+.Fn strchrnul
+appeared in
+.Nx 8 .
Home |
Main Index |
Thread Index |
Old Index