From nobody@FreeBSD.org  Fri Nov 16 19:41:49 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 06DC737B416
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 16 Nov 2001 19:41:49 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id fAH3fnr57341;
	Fri, 16 Nov 2001 19:41:49 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200111170341.fAH3fnr57341@freefall.freebsd.org>
Date: Fri, 16 Nov 2001 19:41:49 -0800 (PST)
From: SUZUKI Koichi <koich@cac.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: inconsistency between index.3 and rindex.3
X-Send-Pr-Version: www-1.0

>Number:         32054
>Category:       docs
>Synopsis:       inconsistency between index.3 and rindex.3
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    simon
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 16 19:50:01 PST 2001
>Closed-Date:    Mon Jul 28 15:51:56 PDT 2003
>Last-Modified:  Mon Jul 28 15:51:56 PDT 2003
>Originator:     SUZUKI Koichi
>Release:        FreeBSD 4.4-stanble
>Organization:
jpman Project
>Environment:
>Description:

I found some inconsistency between index.3 and rindex.3.

>How-To-Repeat:

>Fix:
--- index.3.orig	Fri Nov 16 19:24:34 2001
+++ index.3	Fri Nov 16 19:26:16 2001
@@ -62,9 +62,11 @@
 is returned.
 If
 .Fa c
-is '\e0',
+is
+.Ql \e0 ,
 .Fn index
-locates the terminating '\e0'.
+locates the terminating
+.Ql \e0 .
 .Sh SEE ALSO
 .Xr memchr 3 ,
 .Xr rindex 3 ,
--- rindex.3.orig	Fri Nov 16 19:24:40 2001
+++ rindex.3	Fri Nov 16 19:27:36 2001
@@ -50,8 +50,7 @@
 The
 .Fn rindex
 function
-locates the last character
-matching
+locates the last character matching
 .Fa c
 (converted to a
 .Em char )
@@ -59,7 +58,8 @@
 .Fa s .
 .Sh RETURN VALUES
 A pointer to the character is returned if it is found; otherwise
-NULL is returned.
+.Dv NULL
+is returned.
 If
 .Fa c
 is


>Release-Note:
>Audit-Trail:

From: Dima Dorfman <dima@trit.org>
To: SUZUKI Koichi <koich@cac.co.jp>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3 
Date: Sun, 18 Nov 2001 00:36:09 +0000

 SUZUKI Koichi <koich@cac.co.jp> wrote:
 > I found some inconsistency between index.3 and rindex.3.
 
 Is there a reason both of these shouldn't be described in one file?  I
 know some people complained about man pages being overcrowded, but
 this seems pretty natural to me.

From: SUZUKI Koichi <metal@gc5.so-net.ne.jp>
To: Dima Dorfman <dima@trit.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3
Date: Sat, 17 Nov 2001 23:30:13 -0800

 This is a multi-part message in MIME format.
 --------------030409000304010801080506
 Content-Type: text/plain; charset=ISO-2022-JP
 Content-Transfer-Encoding: 7bit
 
 Dima Dorfman wrote:
 
 > SUZUKI Koichi <koich@cac.co.jp> wrote:
 >>I found some inconsistency between index.3 and rindex.3.
 > 
 > Is there a reason both of these shouldn't be described in one file.  I
 
 > know some people complained about man pages being overcrowded, but
 > this seems pretty natural to me.
 
 I don't know why these man pages are separated.
 
 I agree with you.
 I think these shoud be described together.
 
 I made a patch to index.3 rev.1.6.
 How about this one.
 You know, I'm not native.
 Please correct if you feel strange.
 
 -- 
 This is my STYLE.
 SUZUKI Koichi
 
 --------------030409000304010801080506
 Content-Type: text/plain;
  name="index.3.diff"
 Content-Transfer-Encoding: base64
 Content-Disposition: inline;
  filename="index.3.diff"
 
 LS0tIGluZGV4LjMub3JpZwlTYXQgTm92IDE3IDIzOjEyOjU2IDIwMDEKKysrIGluZGV4LjMJ
 U2F0IE5vdiAxNyAyMzoxNjo0MCAyMDAxCkBAIC0zOCw3ICszOCw4IEBACiAuRHQgSU5ERVgg
 MwogLk9zCiAuU2ggTkFNRQotLk5tIGluZGV4CisuTm0gaW5kZXggLAorLk5tIHJpbmRleAog
 Lk5kIGxvY2F0ZSBjaGFyYWN0ZXIgaW4gc3RyaW5nCiAuU2ggTElCUkFSWQogLkxiIGxpYmMK
 QEAgLTQ2LDI4ICs0NywzNyBAQAogLkluIHN0cmluZy5oCiAuRnQgY2hhciAqCiAuRm4gaW5k
 ZXggImNvbnN0IGNoYXIgKnMiICJpbnQgYyIKKy5GdCBjaGFyICoKKy5GbiByaW5kZXggImNv
 bnN0IGNoYXIgKnMiICJpbnQgYyIKIC5TaCBERVNDUklQVElPTgogVGhlCiAuRm4gaW5kZXgK
 LWZ1bmN0aW9uCi1sb2NhdGVzIHRoZSBmaXJzdCBjaGFyYWN0ZXIgbWF0Y2hpbmcKK2Z1bmN0
 aW9uIGxvY2F0ZXMgdGhlIGZpcnN0IGNoYXJhY3RlciBtYXRjaGluZwogLkZhIGMKIChjb252
 ZXJ0ZWQgdG8gYQogLkVtIGNoYXIgKQogaW4gdGhlIG51bGwtdGVybWluYXRlZCBzdHJpbmcK
 IC5GYSBzIC4KKy5QcAorVGhlCisuRm4gcmluZGV4CitmdW5jdGlvbiBiZWhhdmVzIGFzIHdl
 bGwsIGV4Y2VwdCBsb2NhdGVzIHRoZSBsYXN0IGNoYXJhY3RlciBtYXRjaGluZworLkZhIGMg
 LgogLlNoIFJFVFVSTiBWQUxVRVMKIEEgcG9pbnRlciB0byB0aGUgY2hhcmFjdGVyIGlzIHJl
 dHVybmVkIGlmIGl0IGlzIGZvdW5kOyBvdGhlcndpc2UKIC5EdiBOVUxMCiBpcyByZXR1cm5l
 ZC4KIElmCiAuRmEgYwotaXMgJ1xlMCcsCitpcworLlFsIFxlMCAsCiAuRm4gaW5kZXgKLWxv
 Y2F0ZXMgdGhlIHRlcm1pbmF0aW5nICdcZTAnLgorYW5kCisuRm4gcmluZGV4Citsb2NhdGUg
 dGhlIHRlcm1pbmF0aW5nCisuUWwgXGUwIC4KIC5TaCBTRUUgQUxTTwogLlhyIG1lbWNociAz
 ICwKLS5YciByaW5kZXggMyAsCiAuWHIgc3RyY2hyIDMgLAogLlhyIHN0cmNzcG4gMyAsCiAu
 WHIgc3RycGJyayAzICwKQEAgLTc3LDcgKzg3LDkgQEAKIC5YciBzdHJzdHIgMyAsCiAuWHIg
 c3RydG9rIDMKIC5TaCBISVNUT1JZCi1BCitUaGUKIC5GbiBpbmRleAotZnVuY3Rpb24gYXBw
 ZWFyZWQgaW4KK2FuZAorLkZuIHJpbmRleAorZnVuY3Rpb25zIGFwcGVhcmVkIGluCiAuQXQg
 djYgLgo=
 --------------030409000304010801080506--
 

From: Giorgos Keramidas <keramida@freebsd.org>
To: Suzuki Koichi <koich@cac.co.jp>, Dima Dorfman <dd@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3
Date: Thu, 11 Jul 2002 21:46:49 +0300

 On 2001-11-16 19:41 +0000, SUZUKI Koichi wrote:
 > I found some inconsistency between index.3 and rindex.3.
 
 On 2001-11-18 00:36 +0000, Dima Dorfman wrote:
 > Is there a reason both of these shouldn't be described in one file?
 > I know some people complained about man pages being overcrowded, but
 > this seems pretty natural to me.
 
 On 2001-11-17 23:30 +0000, SUZUKI Koichi wrote:
 > I agree with you.
 > I think these shoud be described together.
 >
 > I made a patch to index.3 rev.1.6.
 > How about this one.
 > You know, I'm not native.
 > Please correct if you feel strange.
 
 How about this patch to src/lib/libc/string/ to make a link from
 rindex.3 -> index.3, merge the text of rindex.3 and index.3 and then
 `cvs remove' of rindex.3?
 
 %%%
 Index: Makefile.inc
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/string/Makefile.inc,v
 retrieving revision 1.26
 diff -u -r1.26 Makefile.inc
 --- Makefile.inc	27 Nov 2001 07:57:31 -0000	1.26
 +++ Makefile.inc	11 Jul 2002 18:34:04 -0000
 @@ -30,6 +30,7 @@
  	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strrchr.3 strsep.3 \
  	strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wmemchr.3
  
 +MLINKS+=index.3 rindex.3
  MLINKS+=strcasecmp.3 strncasecmp.3
  MLINKS+=strcat.3 strncat.3
  MLINKS+=strcmp.3 strncmp.3
 Index: index.3
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/string/index.3,v
 retrieving revision 1.6
 diff -u -r1.6 index.3
 --- index.3	1 Oct 2001 16:09:00 -0000	1.6
 +++ index.3	11 Jul 2002 18:45:47 -0000
 @@ -46,6 +46,9 @@
  .In string.h
  .Ft char *
  .Fn index "const char *s" "int c"
 +.Lp
 +.Ft char *
 +.Fn rindex "const char *s" "int c"
  .Sh DESCRIPTION
  The
  .Fn index
 @@ -56,18 +59,25 @@
  .Em char )
  in the null-terminated string
  .Fa s .
 +The
 +.Fn rindex
 +function locates the last character matching
 +.Fa c .
  .Sh RETURN VALUES
  A pointer to the character is returned if it is found; otherwise
  .Dv NULL
  is returned.
  If
  .Fa c
 -is '\e0',
 +is
 +.Ql \e0 ,
  .Fn index
 -locates the terminating '\e0'.
 +and
 +.Fn
 +locate the terminating
 +.Ql \e0 .
  .Sh SEE ALSO
  .Xr memchr 3 ,
 -.Xr rindex 3 ,
  .Xr strchr 3 ,
  .Xr strcspn 3 ,
  .Xr strpbrk 3 ,
 %%%

From: "Simon L. Nielsen" <simon@nitro.dk>
To: freebsd-gnats-submit@FreeBSD.org, koich@cac.co.jp
Cc:  
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3
Date: Thu, 1 May 2003 00:27:05 +0200

 --BFVE2HhgxTpCzM8t
 Content-Type: multipart/mixed; boundary="yr/DzoowOgTDcSCF"
 Content-Disposition: inline
 
 
 --yr/DzoowOgTDcSCF
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hello
 
 It seems very logical to merge the two man pages like suggested in the
 PR.  I have a few minor changed to the patch that Giorgos Keramidas
 <keramida@freebsd.org> added to the PR :
 
 * No .Lp - there is no seperation between functions in other similar man
 pages and it renderes in the same way if it is removed.
 * Slight rewording of the rindex() description.
 * Fix a .Fn in the RETURN value section to actually reference rindex
 (appears to be a typo in the original patch).
 
 * Remove reference to rindex.3 in Makefile.inc
 
 Note if this patch is applied rindex.3 should be removed from the cvs
 tree.
 
 --=20
 Simon L. Nielsen
 
 --yr/DzoowOgTDcSCF
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="man-index.3-sln.patch"
 Content-Transfer-Encoding: quoted-printable
 
 Index: Makefile.inc
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/lib/libc/string/Makefile.inc,v
 retrieving revision 1.32
 diff -u -d -r1.32 Makefile.inc
 --- Makefile.inc	18 Nov 2002 09:50:56 -0000	1.32
 +++ Makefile.inc	30 Apr 2003 22:15:48 -0000
 @@ -26,12 +26,13 @@
  .endif
 =20
  MAN+=3D	bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
 -	memcmp.3 memcpy.3 memmove.3 memset.3 rindex.3 strcasecmp.3 strcat.3 \
 +	memcmp.3 memcpy.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
  	strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \
  	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strrchr.3 strsep.3 \
  	strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \
  	wcswidth.3 wcsxfrm.3 wmemchr.3
 =20
 +MLINKS+=3Dindex.3 rindex.3
  MLINKS+=3Dstrcasecmp.3 strncasecmp.3
  MLINKS+=3Dstrcat.3 strncat.3
  MLINKS+=3Dstrcmp.3 strncmp.3
 Index: index.3
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/lib/libc/string/index.3,v
 retrieving revision 1.8
 diff -u -d -r1.8 index.3
 --- index.3	18 Dec 2002 13:33:03 -0000	1.8
 +++ index.3	30 Apr 2003 22:02:38 -0000
 @@ -46,6 +46,8 @@
  .In strings.h
  .Ft char *
  .Fn index "const char *s" "int c"
 +.Ft char *
 +.Fn rindex "const char *s" "int c"
  .Sh DESCRIPTION
  The
  .Fn index
 @@ -56,18 +58,27 @@
  .Vt char )
  in the null-terminated string
  .Fa s .
 +The
 +.Fn rindex
 +function is identical to
 +.Fn index
 +except it locates the last character matching
 +.Fa c .
  .Sh RETURN VALUES
  A pointer to the character is returned if it is found; otherwise
  .Dv NULL
  is returned.
  If
  .Fa c
 -is '\e0',
 +is
 +.Ql \e0 ,
  .Fn index
 -locates the terminating '\e0'.
 +and
 +.Fn rindex
 +locate the terminating
 +.Ql \e0 .
  .Sh SEE ALSO
  .Xr memchr 3 ,
 -.Xr rindex 3 ,
  .Xr strchr 3 ,
  .Xr strcspn 3 ,
  .Xr strpbrk 3 ,
 
 --yr/DzoowOgTDcSCF--
 
 --BFVE2HhgxTpCzM8t
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.1 (FreeBSD)
 
 iD8DBQE+sE248kocFXgPTRwRAj0BAJ0Ti9G8JJ7dVUEo3h0+70Rjed4LZgCdEGwD
 Vt6icoISZwXnXIg2lJ09bfA=
 =HaZM
 -----END PGP SIGNATURE-----
 
 --BFVE2HhgxTpCzM8t--

From: "Simon L. Nielsen" <simon@nitro.dk>
To: freebsd-gnats-submit@freebsd.org, SUZUKI Koichi <koich@cac.co.jp>
Cc:  
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3
Date: Thu, 1 May 2003 00:55:08 +0200

 --umrsQkkrw7viUWFs
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On 2003.04.30 15:30:09 -0700, Simon L. Nielsen wrote:
 >  It seems very logical to merge the two man pages like suggested in the
 >  PR.  I have a few minor changed to the patch that Giorgos Keramidas
 >  <keramida@freebsd.org> added to the PR :
 
 Having sent this I of course went to look if this was a generel issue
 and found that actually strchr / strrchr are identical to index / rindex
 and are in fact implemented from the same .c files.
 
 Wouldn't it make sense to merge the man pages for all for pages since
 all of them are very short and basically identical ?
 
 Unless somebody tells me this is a bad idea I think I will do a new
 patch to merge all four man pages...
 
 --=20
 Simon L. Nielsen
 
 --umrsQkkrw7viUWFs
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.1 (FreeBSD)
 
 iD8DBQE+sFRL8kocFXgPTRwRAhtmAJ0d+J3IqPDqYvJi3t0jzYjFOPGwGACgglVH
 uqXFDAK3aXWTl56Vptwt9jw=
 =QBb/
 -----END PGP SIGNATURE-----
 
 --umrsQkkrw7viUWFs--

From: "Simon L. Nielsen" <simon@nitro.dk>
To: freebsd-gnats-submit@freebsd.org, SUZUKI Koichi <koich@cac.co.jp>
Cc:  
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3
Date: Fri, 2 May 2003 00:35:59 +0200

 --brEuL7wsLY8+TuWz
 Content-Type: multipart/mixed; boundary="sgneBHv3152wZ8jf"
 Content-Disposition: inline
 
 
 --sgneBHv3152wZ8jf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hello
 
 After some more research...
 
 index / strchr are located in different header files so to avoid
 confusion I think it is simpler to keep them as seperate man pages.
 
 The attached patch differes from the pr previous patch I added to this
 PR by :
 
 Minor fixes found from comparing with other similar man pages
 documenting multiple functions.
 
 Include the documentation of strrchr in strchr(3).
 
 Minimze the diff between strchr(3) and index(3) mainly overriding from
 strchr(3) to index(3) since the former is the "standard" one and
 strchr(3) matches mostly with the Open Group Unix Specification
 description.
 
 If this patch is used rindex.3 and strrchr.3 should be deleted from the
 tree.
 
 --=20
 Simon L. Nielsen
 
 --sgneBHv3152wZ8jf
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="man-index.3-sln2.patch"
 Content-Transfer-Encoding: quoted-printable
 
 Index: Makefile.inc
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/lib/libc/string/Makefile.inc,v
 retrieving revision 1.32
 diff -u -d -r1.32 Makefile.inc
 --- Makefile.inc	18 Nov 2002 09:50:56 -0000	1.32
 +++ Makefile.inc	1 May 2003 22:13:19 -0000
 @@ -26,14 +26,16 @@
  .endif
 =20
  MAN+=3D	bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
 -	memcmp.3 memcpy.3 memmove.3 memset.3 rindex.3 strcasecmp.3 strcat.3 \
 +	memcmp.3 memcpy.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
  	strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \
 -	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strrchr.3 strsep.3 \
 +	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \
  	strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \
  	wcswidth.3 wcsxfrm.3 wmemchr.3
 =20
 +MLINKS+=3Dindex.3 rindex.3
  MLINKS+=3Dstrcasecmp.3 strncasecmp.3
  MLINKS+=3Dstrcat.3 strncat.3
 +MLINKS+=3Dstrchr.3 strrchr.3
  MLINKS+=3Dstrcmp.3 strncmp.3
  MLINKS+=3Dstrcpy.3 stpcpy.3
  MLINKS+=3Dstrcpy.3 strncpy.3
 Index: index.3
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/lib/libc/string/index.3,v
 retrieving revision 1.8
 diff -u -d -r1.8 index.3
 --- index.3	18 Dec 2002 13:33:03 -0000	1.8
 +++ index.3	1 May 2003 22:02:15 -0000
 @@ -38,7 +38,8 @@
  .Dt INDEX 3
  .Os
  .Sh NAME
 -.Nm index
 +.Nm index ,
 +.Nm rindex
  .Nd locate character in string
  .Sh LIBRARY
  .Lb libc
 @@ -46,28 +47,44 @@
  .In strings.h
  .Ft char *
  .Fn index "const char *s" "int c"
 +.Ft char *
 +.Fn rindex "const char *s" "int c"
  .Sh DESCRIPTION
  The
  .Fn index
  function
 -locates the first character matching
 +locates the first occurrence of
  .Fa c
  (converted to a
  .Vt char )
 -in the null-terminated string
 +in the string pointed to by
  .Fa s .
 +The terminating
 +.Dv NULL
 +character is considered part of the string.
 +.Pp
 +The
 +.Fn rindex
 +function is identical to
 +.Fn index
 +except it locates the last occurrence of
 +.Fa c .
  .Sh RETURN VALUES
 -A pointer to the character is returned if it is found; otherwise
 +The functions
 +.Fn index
 +and
 +.Fn rindex
 +returns a pointer to the located character, or
  .Dv NULL
 -is returned.
 +if the character does not appear in the string.
  If
  .Fa c
 -is '\e0',
 -.Fn index
 -locates the terminating '\e0'.
 +is
 +.Ql \e0 ,
 +the functions locates the terminating
 +.Ql \e0 .
  .Sh SEE ALSO
  .Xr memchr 3 ,
 -.Xr rindex 3 ,
  .Xr strchr 3 ,
  .Xr strcspn 3 ,
  .Xr strpbrk 3 ,
 @@ -79,11 +96,13 @@
  .Sh HISTORY
  A
  .Fn index
 +and a
 +.Fn rindex
  function appeared in
  .At v6 .
 -Its prototype existed previously in
 +Their prototypes existed previously in
  .Aq Pa string.h
 -before it was moved to
 +before they were moved to
  .Aq Pa strings.h
  for
  .St -p1003.1-2001
 Index: strchr.3
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/lib/libc/string/strchr.3,v
 retrieving revision 1.9
 diff -u -d -r1.9 strchr.3
 --- strchr.3	18 Dec 2002 13:33:03 -0000	1.9
 +++ strchr.3	1 May 2003 21:40:59 -0000
 @@ -40,7 +40,8 @@
  .Dt STRCHR 3
  .Os
  .Sh NAME
 -.Nm strchr
 +.Nm strchr ,
 +.Nm strrchr
  .Nd locate character in string
  .Sh LIBRARY
  .Lb libc
 @@ -48,41 +49,53 @@
  .In string.h
  .Ft char *
  .Fn strchr "const char *s" "int c"
 +.Ft char *
 +.Fn strrchr "const char *s" "int c"
  .Sh DESCRIPTION
  The
  .Fn strchr
  function locates the first occurrence of
  .Fa c
 +(converted to a
 +.Vt char )
  in the string pointed to by
  .Fa s .
  The terminating
 -.Dv NUL
 +.Dv NULL
  character is considered part of the string.
 -If
 -.Fa c
 -is
 -.Ql \e0 ,
 +.Pp
 +The
 +.Fn strrchr
 +function is identical to
  .Fn strchr
 -locates the terminating
 -.Ql \e0 .
 +except it locates the last occurrence of
 +.Fa c .
  .Sh RETURN VALUES
 -The function
 +The functions
  .Fn strchr
 +and
 +.Fn strrchr
  returns a pointer to the located character, or
  .Dv NULL
  if the character does not appear in the string.
 +If
 +.Fa c
 +is
 +.Ql \e0 ,
 +the functions locates the terminating
 +.Ql \e0 .
  .Sh SEE ALSO
  .Xr memchr 3 ,
  .Xr strcspn 3 ,
  .Xr strpbrk 3 ,
 -.Xr strrchr 3 ,
  .Xr strsep 3 ,
  .Xr strspn 3 ,
  .Xr strstr 3 ,
  .Xr strtok 3
  .Sh STANDARDS
 -The
 +The functions
  .Fn strchr
 -function
 +and
 +.Fn strrchr
  conforms to
  .St -isoC .
 
 --sgneBHv3152wZ8jf--
 
 --brEuL7wsLY8+TuWz
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.1 (FreeBSD)
 
 iD8DBQE+saFN8kocFXgPTRwRAohJAJ0Yg6Ge9jhzTdcdTPdYKicQpbmCXQCgxwPy
 m13i6mqQqOLtQYq3o0HsWds=
 =Uhep
 -----END PGP SIGNATURE-----
 
 --brEuL7wsLY8+TuWz--

From: "Simon L. Nielsen" <simon@nitro.dk>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: docs/32054: inconsistency between index.3 and rindex.3
Date: Mon, 5 May 2003 00:25:58 +0200

 Hello
 
 Resubmit of the previous patch inline as per request of Giorgos
 Keramidas. At least I hope it will be inline when I don't sign
 the mail...
 
 The patch is also at
 http://simon.nitro.dk/freebsd/files/work/man-index.3-sln2.patch in case
 that is a simpler way to extract it.
 
 %%%
 Index: Makefile.inc
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/string/Makefile.inc,v
 retrieving revision 1.32
 diff -u -d -r1.32 Makefile.inc
 --- Makefile.inc	18 Nov 2002 09:50:56 -0000	1.32
 +++ Makefile.inc	1 May 2003 22:13:19 -0000
 @@ -26,14 +26,16 @@
  .endif
  
  MAN+=	bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
 -	memcmp.3 memcpy.3 memmove.3 memset.3 rindex.3 strcasecmp.3 strcat.3 \
 +	memcmp.3 memcpy.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
  	strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \
 -	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strrchr.3 strsep.3 \
 +	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \
  	strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \
  	wcswidth.3 wcsxfrm.3 wmemchr.3
  
 +MLINKS+=index.3 rindex.3
  MLINKS+=strcasecmp.3 strncasecmp.3
  MLINKS+=strcat.3 strncat.3
 +MLINKS+=strchr.3 strrchr.3
  MLINKS+=strcmp.3 strncmp.3
  MLINKS+=strcpy.3 stpcpy.3
  MLINKS+=strcpy.3 strncpy.3
 Index: index.3
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/string/index.3,v
 retrieving revision 1.8
 diff -u -d -r1.8 index.3
 --- index.3	18 Dec 2002 13:33:03 -0000	1.8
 +++ index.3	1 May 2003 22:02:15 -0000
 @@ -38,7 +38,8 @@
  .Dt INDEX 3
  .Os
  .Sh NAME
 -.Nm index
 +.Nm index ,
 +.Nm rindex
  .Nd locate character in string
  .Sh LIBRARY
  .Lb libc
 @@ -46,28 +47,44 @@
  .In strings.h
  .Ft char *
  .Fn index "const char *s" "int c"
 +.Ft char *
 +.Fn rindex "const char *s" "int c"
  .Sh DESCRIPTION
  The
  .Fn index
  function
 -locates the first character matching
 +locates the first occurrence of
  .Fa c
  (converted to a
  .Vt char )
 -in the null-terminated string
 +in the string pointed to by
  .Fa s .
 +The terminating
 +.Dv NULL
 +character is considered part of the string.
 +.Pp
 +The
 +.Fn rindex
 +function is identical to
 +.Fn index
 +except it locates the last occurrence of
 +.Fa c .
  .Sh RETURN VALUES
 -A pointer to the character is returned if it is found; otherwise
 +The functions
 +.Fn index
 +and
 +.Fn rindex
 +returns a pointer to the located character, or
  .Dv NULL
 -is returned.
 +if the character does not appear in the string.
  If
  .Fa c
 -is '\e0',
 -.Fn index
 -locates the terminating '\e0'.
 +is
 +.Ql \e0 ,
 +the functions locates the terminating
 +.Ql \e0 .
  .Sh SEE ALSO
  .Xr memchr 3 ,
 -.Xr rindex 3 ,
  .Xr strchr 3 ,
  .Xr strcspn 3 ,
  .Xr strpbrk 3 ,
 @@ -79,11 +96,13 @@
  .Sh HISTORY
  A
  .Fn index
 +and a
 +.Fn rindex
  function appeared in
  .At v6 .
 -Its prototype existed previously in
 +Their prototypes existed previously in
  .Aq Pa string.h
 -before it was moved to
 +before they were moved to
  .Aq Pa strings.h
  for
  .St -p1003.1-2001
 Index: strchr.3
 ===================================================================
 RCS file: /home/ncvs/src/lib/libc/string/strchr.3,v
 retrieving revision 1.9
 diff -u -d -r1.9 strchr.3
 --- strchr.3	18 Dec 2002 13:33:03 -0000	1.9
 +++ strchr.3	1 May 2003 21:40:59 -0000
 @@ -40,7 +40,8 @@
  .Dt STRCHR 3
  .Os
  .Sh NAME
 -.Nm strchr
 +.Nm strchr ,
 +.Nm strrchr
  .Nd locate character in string
  .Sh LIBRARY
  .Lb libc
 @@ -48,41 +49,53 @@
  .In string.h
  .Ft char *
  .Fn strchr "const char *s" "int c"
 +.Ft char *
 +.Fn strrchr "const char *s" "int c"
  .Sh DESCRIPTION
  The
  .Fn strchr
  function locates the first occurrence of
  .Fa c
 +(converted to a
 +.Vt char )
  in the string pointed to by
  .Fa s .
  The terminating
 -.Dv NUL
 +.Dv NULL
  character is considered part of the string.
 -If
 -.Fa c
 -is
 -.Ql \e0 ,
 +.Pp
 +The
 +.Fn strrchr
 +function is identical to
  .Fn strchr
 -locates the terminating
 -.Ql \e0 .
 +except it locates the last occurrence of
 +.Fa c .
  .Sh RETURN VALUES
 -The function
 +The functions
  .Fn strchr
 +and
 +.Fn strrchr
  returns a pointer to the located character, or
  .Dv NULL
  if the character does not appear in the string.
 +If
 +.Fa c
 +is
 +.Ql \e0 ,
 +the functions locates the terminating
 +.Ql \e0 .
  .Sh SEE ALSO
  .Xr memchr 3 ,
  .Xr strcspn 3 ,
  .Xr strpbrk 3 ,
 -.Xr strrchr 3 ,
  .Xr strsep 3 ,
  .Xr strspn 3 ,
  .Xr strstr 3 ,
  .Xr strtok 3
  .Sh STANDARDS
 -The
 +The functions
  .Fn strchr
 -function
 +and
 +.Fn strrchr
  conforms to
  .St -isoC .
 %%%
 
 -- 
 Simon L. Nielsen
Responsible-Changed-From-To: freebsd-doc->simon 
Responsible-Changed-By: simon 
Responsible-Changed-When: Fri Jul 25 09:15:52 PDT 2003 
Responsible-Changed-Why:  
I already worked on this, so I will handle it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32054 
State-Changed-From-To: open->closed 
State-Changed-By: simon 
State-Changed-When: Mon Jul 28 15:51:45 PDT 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32054 
>Unformatted:
