X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Fdefine_key.c;fp=ncurses%2Fbase%2Fdefine_key.c;h=0c8bc48debe25ad34133b76ddafaf57f8f0ad130;hp=7fc885f8d9b30288d7c056e30df4fc0616245d9c;hb=a8987e73ec254703634802b4f7ee30d3a485524d;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/ncurses/base/define_key.c b/ncurses/base/define_key.c index 7fc885f8..0c8bc48d 100644 --- a/ncurses/base/define_key.c +++ b/ncurses/base/define_key.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2003 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 * @@ -32,11 +32,10 @@ #include -MODULE_ID("$Id: define_key.c,v 1.6 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: define_key.c,v 1.8 2003/05/17 23:28:05 tom Exp $") NCURSES_EXPORT(int) -define_key -(char *str, int keycode) +define_key(const char *str, int keycode) { int code = ERR; @@ -49,8 +48,12 @@ define_key code = OK; } if (str != 0) { - (void) _nc_add_to_try(&(SP->_keytry), str, keycode); - code = OK; + if (key_defined(str) == 0) { + (void) _nc_add_to_try(&(SP->_keytry), str, keycode); + code = OK; + } else { + code = ERR; + } } } else { while (_nc_remove_string(&(SP->_keytry), str))