AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
·�
BSEARCH ( 3C ) BSEARCH ( 3C ) NAME bsearch - binary search SYNOPSIS char * bsearch ( (char *) key, (char *) base, nel, sizeof (*key), compar) unsigned nel; int (*compar)( ); DESCRWTION Bsearch is a binary search routine generalized from Knuth (6.2.1) Algorithm B. It returns a pointer into a table indicating where a datum may be found. The table must be previously sorted in increasing order according to a provided comparison function. Key points to the datum to be sought in the table. Base points to the element at the base of the table. Net is the number of elements in the table. Compar is the name of the comparison function, which is called with two arguments that point to the elements being compared. The function must return an integer less than, equal to, or greater than zero according as the first argument is to be considered less than, equal to, or greater than the second. DIAGNOSTICS A NULL pointer IS returned if the key cannot be found in the table. NOTES The pointers to the key and the element at the base of the table should be of type pointer-to-element, and cast to type pointer-tocharacter. The comparison function need not compare every byte, so arbitrary data may be contained in the elements in addition to the values being compared. Although declared as type pointer-to-character, the value returned should be cast into type pointer-to-element. SEE ALSO lsearch(3C), hsearch(3C), qsort(3C), tsearch(3C). - 1 -
- Page 749 and 750: � ! SHMGET (2) SHMGET (2) NAME sh
- Page 751 and 752: SHMOP ( 2 ) SHMOP ( 2 ) NAME shmop
- Page 753 and 754: SIGNAL (2) SIGNAL (2) NAME signal -
- Page 755 and 756: SIGNAL (2) SIGNAL (2) Sig is an ill
- Page 757 and 758: STAT ( 2 ) STAT ( 2 ) NAME stat, fs
- Page 759 and 760: STIME(2) STIME(2) NAME stime - set
- Page 761 and 762: SYNC ( 2) SYNC (2) NAME sync - upda
- Page 763 and 764: SYSLOCAL ( 2) SYSLOCAL ( 2) NAME Sy
- Page 765: TIME ( 2) TIME(2) NAME time - get t
- Page 768 and 769: .�.· '··.· ·•. J '·· -,
- Page 771 and 772: UMASK( 2 ) UMASK ( 2 ) NAME umask -
- Page 773 and 774: UMOUNT (2) UMOUNT (2) NAME umount -
- Page 775: UNAME ( 2 ) UNAME (2) NAME uname -
- Page 779: USTAT (2) USTAT (2) NAME ustat - ge
- Page 783 and 784: WAIT ( 2 ) WAIT ( 2 ) NAME wait - w
- Page 785 and 786: WRITE(2) WRITE (2) NAME write - wri
- Page 787 and 788: INTR0 ( 3 ) INTR0 ( 3 ) NAME intro
- Page 789: A64L ( 3C ) A64L ( 3C ) NAME a641,
- Page 793: ABS (3C) ABS (3C) NAME abs - return
- Page 797: ATOF ( 3C ) ATOF ( 3C ) NAME atof -
- Page 803: CLOCK( 3C ) CLOCK( 3C ) NAME clock
- Page 806 and 807: J ··- � . ..._ __ .·
- Page 809: CTERMID ( 3S ) CTERMID ( 3S ) NAME
- Page 812 and 813: CTIME (3C) CTIME(3C) The external l
- Page 815 and 816: CURSES ( 3 ) CURSES ( 3 ) NAME curs
- Page 817 and 818: CUSERID ( 3S ) CUSERID ( 3S ) NAME
- Page 819 and 820: DIAL (3C) DIAL(3C) NAME dial - esta
- Page 821 and 822: DRAND48 ( 3C ) DRAND48 ( 3C ) NAME
- Page 823 and 824: DRAND48 ( 3C ) DRAND48 ( 3C ) have
- Page 825: ECVT (3C) ECVT (3C) NAME ecvt, fcvt
- Page 829 and 830: EPRINTF ( 3T ) ( AT&T UNIX PC only
- Page 831 and 832: ERF (3M) ERF (3M) NAME erf1 erfc -
- Page 833: EXP ( 3M ) EXP ( 3M ) NAME exp, log
- Page 837: FERROR (3S) FERROR (3S) NAME ferror
- Page 841 and 842: FOPEN(3S) FOPEN (3S) NAME fopen, fr
- Page 843 and 844: FORM ( 3T ) ( AT&T UNIX PC only ) F
- Page 845 and 846: FORM (3T) (AT&T UNIX PC only ) fiel
- Page 847 and 848: FORM (3T) }; (AT&T UNIX PC only ) F
- Page 849: FREAD ( 3S ) FREAD ( 3S ) NAME frea
BSEARCH ( 3C ) BSEARCH ( 3C )<br />
NAME<br />
bsearch - binary search<br />
SYNOPSIS<br />
char * bsearch ( (char *) key, (char *) base, nel, sizeof<br />
(*key), compar)<br />
unsigned nel;<br />
int (*compar)( );<br />
DESCRWTION<br />
Bsearch is a binary search routine generalized from Knuth (6.2.1)<br />
Algorithm B. It returns a pointer into a table indicating where a<br />
datum may be found. The table must be previously sorted in<br />
increasing order according to a provided comparison function.<br />
Key points to the datum to be sought in the table. Base points<br />
to the element at the base of the table. Net is the number of elements<br />
in the table. Compar is the name of the comparison function,<br />
which is called with two arguments that point to the elements<br />
being compared. The function must return an integer less<br />
than, equal to, or greater than zero according as the first argument<br />
is to be considered less than, equal to, or greater than the<br />
second.<br />
DIAGNOSTICS<br />
A NULL pointer IS returned if the key cannot be found in the<br />
table.<br />
NOTES<br />
The pointers to the key and the element at the base of the table<br />
should be of type pointer-to-element, and cast to type pointer-tocharacter.<br />
The comparison function need not compare every byte, so arbitrary<br />
data may be contained in the elements in addition to the<br />
values being compared.<br />
Although declared as type pointer-to-character, the value returned<br />
should be cast into type pointer-to-element.<br />
SEE ALSO<br />
lsearch(3C), hsearch(3C), qsort(3C), tsearch(3C).<br />
- 1 -