2 .\" Initial implementation:
3 .\" Copyright (c) 2002 Robert Drehmel
4 .\" All rights reserved.
6 .\" As long as the above copyright statement and this notice remain
7 .\" unchanged, you can do what ever you want with this file.
9 .\" $FreeBSD: src/lib/libc/stdlib/lsearch.3,v 1.5 2005/01/20 09:17:04 ru Exp $
10 .\" $DragonFly: src/lib/libc/stdlib/lsearch.3,v 1.1 2008/05/19 10:06:34 corecode Exp $
18 .Nd linear search and append
25 .Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
26 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
30 .Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
31 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
38 functions walk linearly through an array and compare each element with
39 the one to be sought using a supplied comparison function.
44 points to an element that matches the one that is searched.
45 The array's address in memory is denoted by the
48 The width of one element (i.e., the size as returned by
53 The number of valid elements contained in the array (not the number of
54 elements the array has space reserved for) is given in the integer pointed
59 argument points to a function which compares its two arguments and returns
60 zero if they are matching, and non-zero otherwise.
62 If no matching element was found in the array,
66 into the position after the last element and increments the
75 return a pointer to the first element found.
76 If no element was found,
78 returns a pointer to the newly added element, whereas
101 functions appeared in
105 they reappeared conforming to