Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (i - m) lfind(3)
NAME
lfind - Performs a linear search
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <search.h>
#include <sys/types.h>
void *lfind(
const void *key,
const void *base,
size_t *nelp,
size_t width,
int (*compar) (const void *, const void *) );
PARAMETERS
key Points to an entry containing the key that specifies the entry to be searched for in
the table.
base Points to the first entry in the table to be searched.
nelp Points to an integer that specifies the number of entries in the table to be
searched.
width Specifies the size of each entry, in bytes.
compar Points to the user-specified function to be used for comparing two table entries
(strcmp( ), for example). This function must return 0 (zero) when called with
arguments that point to entries whose keys compare equal, and nonzero other-
wise.
DESCRIPTION
The lfind( ) function performs a linear search of a table. This function returns a pointer into a
table indicating where a specified key is located in the table. When the key is not found in the
table, a null pointer is returned.
NOTES
The function specified for compar does not need to compare every byte; therefore, the table
entries can contain arbitrary data in addition to the values undergoing comparison.
RETURN VALUES
If an entry in the table matches the key, the lfind( ) function returns a pointer to its location in the
table. Otherwise, the lfind( ) function returns a null pointer.
ERRORS
There are no errors defined for this function.
RELATED INFORMATION
Functions: bsearch(3), hsearch(3), lsearch(3), tsearch(3), qsort(3).
527187-017 Hewlett-Packard Company 4−91