aboutsummaryrefslogtreecommitdiff
path: root/test/demo_keyok.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2020-02-07 08:36:41 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2020-02-07 08:36:41 +0000
commitf0179cb6083cc92e5947ae56e6a0a5c5328aead0 (patch)
treebcee0ba9c2149b71f0bfc036df1e61e3105bf980 /test/demo_keyok.c
parentcea297eb34d2361e79529034397465068ae34ecd (diff)
downloadsrc-f0179cb6083cc92e5947ae56e6a0a5c5328aead0.tar.gz
src-f0179cb6083cc92e5947ae56e6a0a5c5328aead0.zip
Vendor import ncurses 6.1-20200118vendor/ncurses/6.1-20200118
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=357645 svn path=/vendor/ncurses/6.1-20200118/; revision=357646; tag=vendor/ncurses/6.1-20200118
Diffstat (limited to 'test/demo_keyok.c')
-rw-r--r--test/demo_keyok.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/demo_keyok.c b/test/demo_keyok.c
index 8724d9819ea0..ea9604efe8d2 100644
--- a/test/demo_keyok.c
+++ b/test/demo_keyok.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002-2003,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2006,2017 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 *
@@ -26,7 +26,7 @@
* authorization. *
****************************************************************************/
/*
- * $Id: demo_keyok.c,v 1.5 2006/11/04 20:09:51 tom Exp $
+ * $Id: demo_keyok.c,v 1.6 2017/04/10 00:37:08 tom Exp $
*
* Demonstrate the keyok() function.
* Thomas Dickey - 2002/11/23
@@ -39,6 +39,7 @@ int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
int lastch = ERR;
+ int prior = ERR;
int ch;
WINDOW *win;
@@ -57,6 +58,9 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
while ((ch = wgetch(win)) != ERR) {
const char *name = keyname(ch);
+ if (ch == ESCAPE && prior == ch)
+ break;
+ prior = ch;
wprintw(win, "Keycode %d, name %s\n",
ch,
name != 0 ? name : "<null>");