c_qfind - Find the first occurrence of an object in a queue

SYNTAX

long FUNCTION c_qfind(q, objin, objout, compare, position)

     long q;       
     void *objin; 
     void **objout; 
     long (compare)();
     long *position;	

PARAMETERS

q (long, input)

The number of the queue to search. This number is returned by c_qcreate().

objin (void *, input)

A pointer to an object to find within the queue.

objout (void **, output)

A pointer to a pointer to the object that is found. The pointer to the object is set to NULL if the object is not found.

compare (long function, input)

A function used to compare two objects in the queue. This function should accept two pointers as arguments and return a value less than zero if the first object is less than the second, zero if the two objects are equal, and a value greater than zero if the first is greater than the second.

position (long *, output)

The position in the queue of the object that is found. It is set to zero if the object is not found.

DESCRIPTION

This routine is used to find an object in a queue. Each object in the queue is compared to objin using the compare() function. If a match is found, objout will point to the matching object in the queue and position will be the match's position within the queue. If a match is not found or the queue is empty, objout will be NULL and position will be set to zero.

After calling this function the current position is set to the object that was found in the queue.

RETURN VALUE

c_qfind() returns

      0 --> Successful completion.  This does not imply that a match 
            was found. 
     -1 --> Operation failed.  No such queue exists.