LSEARCH man page on 4.4BSD

Man page or keyword search:  
man Server   1065 pages
apropos Keyword Search (all sections)
Output format
4.4BSD logo
[printable version]

LSEARCH(3)		 BSD Library Functions Manual		    LSEARCH(3)

     lsearch, lfind, — linear searching routines

     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 *));

     This interface was obsolete before it was written.	 It is available from
     the compatibility library, libcompat.

     The functions lsearch(), and lfind() provide basic linear searching func‐

     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 con‐
     sidered, respectively, to be less than, equal to, or greater than the
     array member.

     The lsearch() and lfind() functions return a pointer into the array ref‐
     erenced 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.

     bsearch(3), db(3)

BSD				 June 4, 1993				   BSD

List of man pages available for 4.4BSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net