]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/list_keys.c
ncurses 6.2 - patch 20200321
[ncurses.git] / test / list_keys.c
index 92c8ba4f012f9e232e797dd2bfdd5d5fe7a89429..cdad60e928b6a92a9a77ce4cce74e9d3ff53234f 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2016-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+ * Copyright 2016,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            *
  *                                                                          *
  * 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.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: list_keys.c,v 1.24 2018/05/20 18:56:56 tom Exp $
+ * $Id: list_keys.c,v 1.26 2020/02/02 23:34:34 tom Exp $
  *
  * Author: Thomas E Dickey
  *
  *
  * Author: Thomas E Dickey
  *
@@ -88,7 +89,6 @@ static int
 show_key(const char *name, bool show)
 {
     int width = 0;
 show_key(const char *name, bool show)
 {
     int width = 0;
-    char buffer[10];
     NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name);
 
     if (show && t_opt)
     NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name);
 
     if (show && t_opt)
@@ -96,6 +96,7 @@ show_key(const char *name, bool show)
 
     if (value != 0 && value != (char *) -1) {
        while (*value != 0) {
 
     if (value != 0 && value != (char *) -1) {
        while (*value != 0) {
+           char buffer[10];
            int ch = UChar(*value++);
            switch (ch) {
            case '\177':
            int ch = UChar(*value++);
            switch (ch) {
            case '\177':
@@ -197,8 +198,8 @@ compare_keys(const void *a, const void *b)
 static void
 draw_line(int width)
 {
 static void
 draw_line(int width)
 {
-    int j;
     if (!t_opt) {
     if (!t_opt) {
+       int j;
        for (j = 0; j < width; ++j) {
            printf("-");
        }
        for (j = 0; j < width; ++j) {
            printf("-");
        }
@@ -285,8 +286,8 @@ list_keys(TERMINAL **terms, int count)
     }
 #if NCURSES_XNAMES
     if (x_opt) {
     }
 #if NCURSES_XNAMES
     if (x_opt) {
-       TERMTYPE *term;
        for (k = 0; k < count; ++k) {
        for (k = 0; k < count; ++k) {
+           TERMTYPE *term;
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            total += (size_t) (NUM_STRINGS(term) - STRCOUNT);
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            total += (size_t) (NUM_STRINGS(term) - STRCOUNT);
@@ -305,9 +306,11 @@ list_keys(TERMINAL **terms, int count)
     }
 #if NCURSES_XNAMES
     if (x_opt) {
     }
 #if NCURSES_XNAMES
     if (x_opt) {
-       TERMTYPE *term;
        int m, n;
        int m, n;
+
        for (k = 0; k < count; ++k) {
        for (k = 0; k < count; ++k) {
+           TERMTYPE *term;
+
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {