X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_getch.c;h=bf2115dd0641c69e479ad8ead4a9b43489af281b;hp=5bfeb24d85632aa6b167619151983f4d57708bfc;hb=460005b642d978c6d4b48810803514bd36a6245b;hpb=5da4544722decdeb2bfd0c7c4581af0ea62148f9 diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c index 5bfeb24d..bf2115dd 100644 --- a/ncurses/base/lib_getch.c +++ b/ncurses/base/lib_getch.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2016,2018 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2015,2016 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 * @@ -42,7 +43,7 @@ #include -MODULE_ID("$Id: lib_getch.c,v 1.137 2018/06/24 00:06:37 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.139 2020/02/02 23:34:34 tom Exp $") #include @@ -69,16 +70,20 @@ NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (NCURSES_SP_DCLx int value) { int code = OK; -#if USE_REENTRANT - if (SP_PARM) { - SET_ESCDELAY(value); - } else { + if (value < 0) { code = ERR; - } + } else { +#if USE_REENTRANT + if (SP_PARM) { + SET_ESCDELAY(value); + } else { + code = ERR; + } #else - (void) SP_PARM; - ESCDELAY = value; + (void) SP_PARM; + ESCDELAY = value; #endif + } return code; } @@ -87,12 +92,16 @@ NCURSES_EXPORT(int) set_escdelay(int value) { int code; + if (value < 0) { + code = ERR; + } else { #if USE_REENTRANT - code = NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value); + code = NCURSES_SP_NAME(set_escdelay) (CURRENT_SCREEN, value); #else - ESCDELAY = value; - code = OK; + ESCDELAY = value; + code = OK; #endif + } return code; } #endif