qsearch(3C)
_________________________________________________________________
qsearch function
Search a queue for an element meeting a given condition.
_________________________________________________________________
Calling Sequence
#include <queue.h>
struct element *qsearch(), *ptr, *first;
struct queue *header;
int type, offset, value;
ptr = qsearch(header, type, offset, value, first);
where header is a pointer to a queue header built with one
of the insert_ functions.
ptr is the address of the element which either meets
the search condition or is 0 (null) if the search
condition fails.
type is an integer value from 0 to 31 specifying the
type of search to perform. (Consult The ECLIPSE
32-Bit Systems Principles of Operation for details.)
offset is the value of a word offset from the
beginning of the structure. The search will test
this value against the integer value you specify.
value is the integer that the function will test
against the word at the offset.
first is a pointer to the first element to be
searched, or -1 (QNULL) if the search is to start at
the first element of the list.
Description
The qsearch function enables you to search a queue for an element
that meets a specified condition. You must have defined the
element, whose first two double words are reserved for forward
and backward pointers. For example:
struct theelement {
int *forwardptr;
int *backwardptr;
char dataobj;
} *ptr;
This function uses the hardware representation of queues. For
more detail, see The ECLIPSE 32-Bit Systems Principles of
Operation.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
qsearch(3C)
Returns
The qsearch function returns a pointer to the address of the
element, or 0 if the search fails.
Related Functions
See also the insert_after, insert_before, insert_head,
insert_tail, remove_element, remove_head, and remove_tail
functions.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)