- T((T_CALLED("keyok(%d,%d)"), c, flag));
- if (c >= 0) {
- unsigned ch = (unsigned) c;
- if (flag) {
- while ((s = _nc_expand_try(SP->_key_ok, ch, &count, 0)) != 0
- && _nc_remove_key(&(SP->_key_ok), ch)) {
- code = _nc_add_to_try(&(SP->_keytry), s, ch);
- free(s);
- count = 0;
- if (code != OK)
- break;
- }
- } else {
- while ((s = _nc_expand_try(SP->_keytry, ch, &count, 0)) != 0
- && _nc_remove_key(&(SP->_keytry), ch)) {
- code = _nc_add_to_try(&(SP->_key_ok), s, ch);
- free(s);
- count = 0;
- if (code != OK)
- break;
+ if (HasTerminal(SP_PARM)) {
+ T((T_CALLED("keyok(%p, %d,%d)"), (void *) SP_PARM, c, flag));
+#ifdef USE_TERM_DRIVER
+ code = CallDriver_2(sp, td_kyOk, c, flag);
+#else
+ T((T_CALLED("keyok(%d,%d)"), c, flag));
+ if (c >= 0) {
+ int count = 0;
+ char *s;
+ unsigned ch = (unsigned) c;
+
+ if (flag) {
+ while ((s = _nc_expand_try(SP_PARM->_key_ok,
+ ch, &count, (size_t) 0)) != 0) {
+ if (_nc_remove_key(&(SP_PARM->_key_ok), ch)) {
+ code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch);
+ free(s);
+ count = 0;
+ if (code != OK)
+ break;
+ } else {
+ free(s);
+ }
+ }
+ } else {
+ while ((s = _nc_expand_try(SP_PARM->_keytry,
+ ch, &count, (size_t) 0)) != 0) {
+ if (_nc_remove_key(&(SP_PARM->_keytry), ch)) {
+ code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch);
+ free(s);
+ count = 0;
+ if (code != OK)
+ break;
+ } else {
+ free(s);
+ }
+ }