/*																				*/
/*																				*/
/*				File:		  	 check.c										*/
/*				Returns:	  	 int - values:								*/
/*								 >0 - inded (-1) to key in record	*/
/*								 0 - key is above this record			*/
/*								 -1 - key does not exist				*/
/*								 -2 - key is below this record		*/
/*				Parameters:	 int key1,key2 - key to look for		*/
/*								 int k1[18], k2[18] - current rec	*/
/*																				*/
/*																				*/

#include "advm.h"


int check (key1, key2, k1, k2)
int key1;
int key2;
int k1[18];
int k2[18];

	{
	int i;

	if (k1[0] == -1) return (-1);
	if (k2[0] > key2 || (k2[0] == key2 && k1[0] > key1)) return (-2);
	for (i=0; i<18; i++)
		{
		trace1("check: i = %d\n",i);
		if (k1[i] == -1) return (-1);
		if (k2[i] < key2) continue;
		if (k2[i] > key2) return (-1);
		if (k1[i] > key1) return (-1);
		if (k1[i] == key1) return (i+1);
		}
	return (0);
	}

