*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> lsearch (3)              
Title
Content
Arch
Section
 

LSEARCH(3)

Contents


NAME    [Toc]    [Back]

     lsearch, lfind - linear searching routines

LIBRARY    [Toc]    [Back]

     Compatibility Library (libcompat, -lcompat)

SYNOPSIS    [Toc]    [Back]

     char *
     lsearch(const void *key, const void *base, size_t *nelp, size_t width,
             int (*compar)(void *, void *));

     char *
     lfind(const void *key, const void *base, size_t *nelp, size_t width,
             int (*compar)(void *, void *));

DESCRIPTION    [Toc]    [Back]

     These interfaces were obsolete before they were written.  They are avail-
     able from the compatibility library, libcompat.

     The functions lsearch(), and lfind() provide basic linear searching functionality.


     base is the pointer to the beginning of an array.  The argument nelp is
     the current number of elements in the array, where each element is width
     bytes long.  The compar function is a comparison routine which is used to
     compare two elements.  It takes two arguments which point to the 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 key object is considered,
 respectively, to be less than, equal to, or greater than the
     array member.

     The lsearch() and lfind() functions return a pointer into the array referenced
 by base where key is located.  If key does not exist, lfind()
     will return a null pointer and lsearch() will add it to the array.  When
     an element is added to the array by lsearch() the location referenced by
     the argument nelp is incremented by one.

SEE ALSO    [Toc]    [Back]

      
      
     bsearch(3), db(3)

BSD                              June 4, 1993                              BSD
[ Back ]
 Similar pages
Name OS Title
nismatch HP-UX utilities for searching NIS+ tables
nisgrep HP-UX utilities for searching NIS+ tables
DtEditorInvokeFindChangeDialog HP-UX display the DtEditor widget dialog for searching and replacing text
zgtsvx IRIX system of linear equations A * X = B, A**T * X = B, or A**H * X = B,
zgesvx IRIX system of linear equations A * X = B,
sgbsvx IRIX system of linear equations A * X = B, A**T * X = B, or A**H * X = B,
lfind FreeBSD linear search and append
sgesvx IRIX system of linear equations A * X = B,
zgbsvx IRIX system of linear equations A * X = B, A**T * X = B, or A**H * X = B,
cgbsvx IRIX system of linear equations A * X = B, A**T * X = B, or A**H * X = B,
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service