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 $
17 .Nd linear search and append
24 .Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
25 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
29 .Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
30 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
37 functions walk linearly through an array and compare each element with
38 the one to be sought using a supplied comparison function.
43 points to an element that matches the one that is searched.
44 The array's address in memory is denoted by the
47 The width of one element (i.e., the size as returned by
52 The number of valid elements contained in the array (not the number of
53 elements the array has space reserved for) is given in the integer pointed
58 argument points to a function which compares its two arguments and returns
59 zero if they are matching, and non-zero otherwise.
61 If no matching element was found in the array,
65 into the position after the last element and increments the
74 return a pointer to the first element found.
75 If no element was found,
77 returns a pointer to the newly added element, whereas
100 functions appeared in
104 they reappeared conforming to