Date: Sun, 4 May 2003 15:30:22 -0700 (PDT) From: "Simon L. Nielsen" <simon@nitro.dk> To: freebsd-doc@FreeBSD.org Subject: Re: docs/32054: inconsistency between index.3 and rindex.3 Message-ID: <200305042230.h44MUMQp053323@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR docs/32054; it has been noted by GNATS. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305042230.h44MUMQp053323>