diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-01-22 18:02:21 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-01-22 18:02:21 +0000 |
commit | 7fe795010750d2e2889d7085abeaa1ee0926c69b (patch) | |
tree | b52138c43e052b09287afed0fb6351cd31249bda /lib/libcurses/base/keyok.c | |
parent | 85db479b2362c15a2266e01737d835e86cda1b1e (diff) |
Update to ncurses-5.2-20010114
Diffstat (limited to 'lib/libcurses/base/keyok.c')
-rw-r--r-- | lib/libcurses/base/keyok.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/lib/libcurses/base/keyok.c b/lib/libcurses/base/keyok.c index 24736fe8d93..5e4b5880e86 100644 --- a/lib/libcurses/base/keyok.c +++ b/lib/libcurses/base/keyok.c @@ -1,7 +1,7 @@ -/* $OpenBSD: keyok.c,v 1.2 1999/02/24 06:31:08 millert Exp $ */ +/* $OpenBSD: keyok.c,v 1.3 2001/01/22 18:01:37 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include <curses.priv.h> -MODULE_ID("$From: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") +MODULE_ID("$From: keyok.c,v 1.5 2000/12/10 02:43:26 tom Exp $") /* * Enable (or disable) ncurses' interpretation of a keycode by adding (or @@ -46,29 +46,30 @@ MODULE_ID("$From: keyok.c,v 1.3 1999/02/19 11:29:48 tom Exp $") * corresponding tree. */ -int keyok(int c, bool flag) +NCURSES_EXPORT(int) +keyok(int c, bool flag) { - int code = ERR; - int count = 0; - char *s; + int code = ERR; + int count = 0; + char *s; - T((T_CALLED("keyok(%d,%d)"), c, flag)); - if (flag) { - while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_key_ok), c)) { - _nc_add_to_try(&(SP->_keytry), s, c); - free(s); - code = OK; - count = 0; - } - } else { - while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 - && _nc_remove_key(&(SP->_keytry), c)) { - _nc_add_to_try(&(SP->_key_ok), s, c); - free(s); - code = OK; - count = 0; - } + T((T_CALLED("keyok(%d,%d)"), c, flag)); + if (flag) { + while ((s = _nc_expand_try(SP->_key_ok, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_key_ok), c)) { + _nc_add_to_try(&(SP->_keytry), s, c); + free(s); + code = OK; + count = 0; } - returnCode(code); + } else { + while ((s = _nc_expand_try(SP->_keytry, c, &count, 0)) != 0 + && _nc_remove_key(&(SP->_keytry), c)) { + _nc_add_to_try(&(SP->_key_ok), s, c); + free(s); + code = OK; + count = 0; + } + } + returnCode(code); } |