summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSichen Zhao <1473996754@qq.com>2017-08-30 11:03:57 +0800
committerCorinna Vinschen <corinna@vinschen.de>2017-08-30 15:10:07 +0200
commit42885ea4b8bfece01cac0a4a4030ff4341454353 (patch)
treeefa6a78afcfffc28fedbbd1ded19f5c5616d0704
parentf22054c94d3f77ba834d55123ffa9fe4aef6f93c (diff)
downloadcygnal-42885ea4b8bfece01cac0a4a4030ff4341454353.tar.gz
cygnal-42885ea4b8bfece01cac0a4a4030ff4341454353.tar.bz2
cygnal-42885ea4b8bfece01cac0a4a4030ff4341454353.zip
Add man page entry for strnstr.c.
-rw-r--r--newlib/libc/string/strings.tex4
-rw-r--r--newlib/libc/string/strnstr.c39
2 files changed, 43 insertions, 0 deletions
diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex
index c619886b5..6aec5fe0e 100644
--- a/newlib/libc/string/strings.tex
+++ b/newlib/libc/string/strings.tex
@@ -40,6 +40,7 @@ managing areas of memory. The corresponding declarations are in
* strncat:: Concatenate strings
* strncmp:: Character string compare
* strncpy:: Counted copy string
+* strnstr:: Find string segment
* strnlen:: Character string length
* strpbrk:: Find chars in string
* strrchr:: Reverse search for character in string
@@ -159,6 +160,9 @@ managing areas of memory. The corresponding declarations are in
@include string/strncpy.def
@page
+@include string/strnstr.def
+
+@page
@include string/strnlen.def
@page
diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c
index 05d86ee20..fcceebc1f 100644
--- a/newlib/libc/string/strnstr.c
+++ b/newlib/libc/string/strnstr.c
@@ -1,3 +1,42 @@
+/*
+FUNCTION
+ <<strnstr>>---find string segment
+
+INDEX
+ strnstr
+
+ANSI_SYNOPSIS
+ #include <string.h>
+ size_t strnstr(const char *<[s1]>, const char *<[s2]>, size_t <[n]>);
+
+TRAD_SYNOPSIS
+ #include <string.h>
+ size_t strnstr(<[s1]>, <[s2]>, <[n]>)
+ char *<[s1]>;
+ char *<[s2]>;
+ size_t <[n]>;
+
+DESCRIPTION
+ Locates the first occurrence in the string pointed to by <[s1]> of
+ the sequence of limited to the <[n]> characters in the string
+ pointed to by <[s2]>
+
+RETURNS
+ Returns a pointer to the located string segment, or a null
+ pointer if the string <[s2]> is not found. If <[s2]> points to
+ a string with zero length, <[s1]> is returned.
+
+
+PORTABILITY
+<<strnstr>> is ANSI C.
+
+<<strnstr>> requires no supporting OS subroutines.
+
+QUICKREF
+ strnstr ansi pure
+
+*/
+
#undef __STRICT_ANSI__
#include <_ansi.h>
#include <string.h>