From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32356 invoked by alias); 30 Aug 2017 14:59:04 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 32344 invoked by uid 89); 30 Aug 2017 14:59:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1743 X-HELO: mail02.lgsinnovations.com Received: from mail02.lgsinnovations.com (HELO mail02.lgsinnovations.com) (63.149.110.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Aug 2017 14:59:02 +0000 Subject: Re: [PATCH] Add man page entry for strnstr.c. To: References: <1504062237-19638-1-git-send-email-1473996754@qq.com> <1504062237-19638-2-git-send-email-1473996754@qq.com> From: Craig Howland Message-ID: Date: Wed, 30 Aug 2017 14:59:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1504062237-19638-2-git-send-email-1473996754@qq.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LGS-EX05.lgsdirect.com (135.22.48.227) To LGS-EX01.lgsdirect.com (135.22.77.164) X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00919.txt.bz2 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 > + 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 > +<> is ANSI C. > + > +<> 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.)