home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_12
/
8n12045b
< prev
next >
Wrap
Text File
|
1990-10-15
|
939b
|
50 lines
/*
* KEY.C
*
* routines for manipulating the key reassignment buffers
*
*/
#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();
}