#include "char.h"
/*
* k_seek()
*
* k_ seek() finds a buffer based on the global variable
* 'keycheck'. the first match returns a pointer to the
* replacement string; the variable 'len' is also set to
* point to the length field. If no match, then it returns
* a null pointer
*/
char *k_seek()
{
for (kp = &kbuffer[ 0 ], k = 0; k < NKEYS; k++, kp++)
{
if (kp->keystroke == keycheck)
{
len = &(kp->length);
ptr = kp->buffer;
return ptr;
}
}
return ((char *) 0);
}
/*
* k_alloc()
*
* k_alloc() searches for an unallocated key buffer.
* It does so by searching for a zero keystroke field.
* Simple.
*/
char *k_alloc()
{
keycheck = 0;
return k_seek();
}