Annotation of 43BSDReno/lib/libcompat/4.3/lsearch.3, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1989 The Regents of the University of California.
                      2: .\" All rights reserved.
                      3: .\"
                      4: .\" Redistribution and use in source and binary forms are permitted provided
                      5: .\" that: (1) source distributions retain this entire copyright notice and
                      6: .\" comment, and (2) distributions including binaries display the following
                      7: .\" acknowledgement:  ``This product includes software developed by the
                      8: .\" University of California, Berkeley and its contributors'' in the
                      9: .\" documentation or other materials provided with the distribution and in
                     10: .\" all advertising materials mentioning features or use of this software.
                     11: .\" Neither the name of the University nor the names of its contributors may
                     12: .\" be used to endorse or promote products derived from this software without
                     13: .\" specific prior written permission.
                     14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     17: .\"
                     18: .\"    @(#)lsearch.3   5.3 (Berkeley) 6/23/90
                     19: .\"
                     20: .TH LSEARCH 3 "June 23, 1990"
                     21: .UC 7
                     22: .SH NAME
                     23: lsearch, lfind, \- linear searching routines
                     24: .SH SYNOPSIS
                     25: .ft B
                     26: .nf
                     27: char *
                     28: lsearch(const void *key, const void *base,
                     29: size_t *nelp, size_t width, 
                     30: int (*compar) (void *, void *));
                     31: .sp
                     32: char *
                     33: lfind(const void *key, const void *base,
                     34: size_t *nelp, size_t width,
                     35: int (*compar) (void *, void *));
                     36: .ft R
                     37: .SH DESCRIPTION
                     38: .ft B
                     39: This interface was obsolete before it was written.
                     40: It is available from the compatibility library, libcompat.
                     41: .ft R
                     42: .PP
                     43: The functions
                     44: .IR lsearch ,
                     45: and
                     46: .IR lfind
                     47: provide basic linear searching functionality.
                     48: .PP
                     49: .I Base
                     50: is the pointer to the beginning of an array.
                     51: .I Nelp
                     52: is the current number of elements in the array, where each element
                     53: is
                     54: .I width
                     55: bytes long.
                     56: .I Compar
                     57: is a comparison routine which is used to compare two elements.
                     58: It is called with two arguments that point to the 
                     59: .I key
                     60: object and to an array member, in that order, and must return an integer
                     61: less than, equal to, or greater than zero if the 
                     62: .I key
                     63: object is considered, respectively, to be less than, equal to, or greater
                     64: than the array member.
                     65: .PP
                     66: .I Lsearch
                     67: and
                     68: .I lfind
                     69: return a pointer into the array referenced by
                     70: .I base
                     71: where
                     72: .I key
                     73: is located.
                     74: If
                     75: .I key
                     76: does not exist,
                     77: .I lfind
                     78: will return a NULL pointer and
                     79: .I lsearch
                     80: will add it to the array.
                     81: When an element is added to the array by
                     82: .I lsearch
                     83: the location referenced by the argument
                     84: .I nelp
                     85: is incremented by one.
                     86: .SH "SEE ALSO"
                     87: bsearch(3), hsearch(3), tsearch(3)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.