Module Name: src Committed By: christos Date: Wed Oct 12 20:01:12 UTC 2016
Modified Files: src/lib/libc/string: Makefile.inc strchr.3 Log Message: add strchrnul To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/lib/libc/string/Makefile.inc cvs rdiff -u -r1.11 -r1.12 src/lib/libc/string/strchr.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/string/Makefile.inc diff -u src/lib/libc/string/Makefile.inc:1.80 src/lib/libc/string/Makefile.inc:1.81 --- src/lib/libc/string/Makefile.inc:1.80 Wed Sep 24 14:16:37 2014 +++ src/lib/libc/string/Makefile.inc Wed Oct 12 16:01:12 2016 @@ -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+= strspn.c strstr.c swab.c strnstr. 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+=strlcpy.3 strlcat.3 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 \ Index: src/lib/libc/string/strchr.3 diff -u src/lib/libc/string/strchr.3:1.11 src/lib/libc/string/strchr.3:1.12 --- src/lib/libc/string/strchr.3:1.11 Thu Aug 7 12:43:49 2003 +++ src/lib/libc/string/strchr.3 Wed Oct 12 16:01:12 2016 @@ -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 @@ If 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 @@ The function 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 @@ The function conforms to .St -ansiC . +.The +.Fn strchrnul +appeared in +.Nx 8 .