home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name EDRETKEY -- Return an edit key record from the edit key
- * list.
- *
- * Synopsis presult = edretkey(pkey_sequence);
- *
- * ED_KEY *presult Pointer to the located edit key
- * record, or NIL if failure.
- * const KEY_SEQUENCE Character code and scan code of the
- * *pkey_sequence edit key to be located.
- *
- * Description This function searches the linked list of edit keys
- * looking for a record having the same character and
- * scan code (key_sequence) as specified. If one is
- * found, a pointer to it is returned. If no match is
- * found, NIL is returned. If the edit key list has not
- * yet been initialized, it is initialized before the
- * search.
- *
- * Returns *presult Pointer to the matching edit key
- * record from the linked list of
- * edit key key records, or NIL if
- * there is no match.
- * b_pkey_root Pointer to start of newly
- * initialized edit key list, if it
- * was not already initialized.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1989
- *
- **/
- #include <butil.h>
- #include <bedit.h>
-
-
- ED_KEY *edretkey(pkey_sequence)
- const KEY_SEQUENCE *pkey_sequence;
- {
- ED_LIST *pcurrent;
- int error_code;
-
- if (b_pkeys_init == 0)
- {
- error_code = edinitky();
- if (error_code != ED_NO_ERROR)
- return(NIL);
- }
-
- pcurrent = b_pkey_root;
-
- /* Do a sequential search of the linked list until the */
- /* key is found, or the list is exhausted. */
- while (pcurrent != NIL)
- if ((pcurrent->edit_key.key_sequence.character_code ==
- pkey_sequence->character_code) &&
- (pcurrent->edit_key.key_sequence.key_code ==
- pkey_sequence->key_code))
- break;
- else
- pcurrent = pcurrent->pnext;
-
- /* If the edit key was found, pcurrent points to it; */
- /* otherwise, pcurrent is NIL. */
- if (pcurrent != NIL)
- return(&pcurrent->edit_key);
- else
- return(NIL);
- }