This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add man page entry for strnstr.c.


On 08/29/2017 11:03 PM, Sichen Zhao wrote:
---
  newlib/libc/string/strings.tex |  4 ++++
  newlib/libc/string/strnstr.c   | 39 +++++++++++++++++++++++++++++++++++++++
  2 files changed, 43 insertions(+)

diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex
index c619886..6aec5fe 100644
...
@page
diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c
index 05d86ee..fe3da6e 100644
--- a/newlib/libc/string/strnstr.c
+++ b/newlib/libc/string/strnstr.c
@@ -1,3 +1,42 @@
...
+
+TRAD_SYNOPSIS
+	#include <string.h>
+	size_t strnstr(<[s1]>, <[s2]>, <[n]>)
+	char *<[s1]>;
+        char *<[s2]>;
+	size_t <[n]>;
You can leave out the TRAD_SYNOPSIS section, as it is has been ignored by the document-generation tools for years.
+
+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]>
As I read this, is it saying that is looks for at most n characters of s2 within s1. However, this disagrees with the description in the source just before the function, itself, which says "Find the first occurrence of find in s, where the search is limited to the first slen characters of s."
+
+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
strnstr() is not ANSI C. (According to the gate in the header when added, it is BSD.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]