Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

Guardian Native C Library Calls (j - m) l
nd(3)
NAME
lnd - Performs a linear search
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <search.h>
#include <sys/types.h>
void *lnd(
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 species the entry to be searched for in
the table.
base Points to the rst entry in the table to be searched.
nelp Points to an integer that species the number of entries in the table to be
searched.
width Species the size of each entry, in bytes.
compar Points to the user-specied 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 lnd() function performs a linear search of a table. This function returns a pointer into a
table indicating where a specied key is located in the table. When the key is not found in the
table, a null pointer is returned.
NOTES
The function specied 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 lnd( ) function returns a pointer to its location in the
table. Otherwise, the lnd( ) function returns a null pointer.
ERRORS
There are no errors dened for this function.
RELATED INFORMATION
Functions: bsearch(3), hsearch(3), lsearch(3), tsearch(3), qsort(3).
527192-005 Hewlett-Packard Company 417