Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/lib/libc/stdlib Pull up revision 1.2 (requested by drochn...



details:   https://anonhg.NetBSD.org/src/rev/141d60712ce8
branches:  netbsd-3
changeset: 576833:141d60712ce8
user:      tron <tron%NetBSD.org@localhost>
date:      Thu Aug 04 17:36:28 2005 +0000

description:
Pull up revision 1.2 (requested by drochner in ticket #632):
fix for non-const lsearch() arg, also fix return values and the
description of the comparision function, and refer to POSIX
partly borrowed from FreeBSD

diffstat:

 lib/libc/stdlib/lsearch.3 |  26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diffs (57 lines):

diff -r c99fa5b30c55 -r 141d60712ce8 lib/libc/stdlib/lsearch.3
--- a/lib/libc/stdlib/lsearch.3 Thu Aug 04 17:35:05 2005 +0000
+++ b/lib/libc/stdlib/lsearch.3 Thu Aug 04 17:36:28 2005 +0000
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)lsearch.3    8.1 (Berkeley) 6/4/93
-.\"    $NetBSD: lsearch.3,v 1.3.2.2 2005/08/04 17:33:23 tron Exp $
+.\"    $NetBSD: lsearch.3,v 1.3.2.3 2005/08/04 17:36:28 tron Exp $
 .\"
 .Dd July 6, 2005
 .Dt LSEARCH 3
@@ -39,9 +39,9 @@
 .Lb libc
 .Sh SYNOPSIS
 .In search.h
-.Ft char *
-.Fn lsearch "const void *key" "const void *base" "size_t *nelp" "size_t width" "int (*compar)(const void *, const void *)"
-.Ft char *
+.Ft void *
+.Fn lsearch "const void *key" "void *base" "size_t *nelp" "size_t width" "int (*compar)(const void *, const void *)"
+.Ft void *
 .Fn lfind "const void *key" "const void *base" "size_t *nelp" "size_t width" "int (*compar)(const void *, const void *)"
 .Sh DESCRIPTION
 .Pp
@@ -61,15 +61,8 @@
 bytes long.
 The
 .Fa compar
-function
-is a comparison routine which is used to compare two elements.
-It takes two arguments which point to the
-.Fa key
-object and to an array member, in that order, and must return an integer
-less than, equivalent to, or greater than zero if the
-.Fa key
-object is considered, respectively, to be less than, equal to, or greater
-than the array member.
+argument points to a function which compares its two arguments and returns
+zero if they are matching, and non-zero otherwise.
 .Pp
 The
 .Fn lsearch
@@ -93,6 +86,13 @@
 the location referenced by the argument
 .Fa nelp
 is incremented by one.
+.Sh STANDARDS
+The
+.Fn lsearch
+and
+.Fn lfind
+functions conform to
+.St -p1003.1-2001 .
 .Sh SEE ALSO
 .Xr bsearch 3 ,
 .Xr db 3



Home | Main Index | Thread Index | Old Index