]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/key_names.c
ncurses 6.2 - patch 20200321
[ncurses.git] / test / key_names.c
index 579f02fc4537128a3f685a9daf824b98d4a4463b..69c95d638db04b8712d0e45e280438399465cf55 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2007-2008,2014 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2007-2014,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 +27,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: key_names.c,v 1.5 2014/08/02 17:24:55 tom Exp $
+ * $Id: key_names.c,v 1.8 2020/02/02 23:34:34 tom Exp $
  */
 
 #include <test.priv.h>
@@ -77,7 +78,8 @@ main(int argc, char *argv[])
        endwin();
     }
     for (n = -1; n < KEY_MAX + 512; n++) {
-       const char *result = key_name((wchar_t) n);
+       int check = wcwidth((wchar_t) n);
+       const char *result = check >= 0 ? key_name((wchar_t) n) : "?";
        if (result != 0)
            printf("%d(%5o):%s\n", n, n, result);
     }