summaryrefslogtreecommitdiff
path: root/test/list_keys.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/list_keys.c')
-rw-r--r--test/list_keys.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/test/list_keys.c b/test/list_keys.c
index b616919f4653..f9c8b5a59e28 100644
--- a/test/list_keys.c
+++ b/test/list_keys.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2018-2022,2023 Thomas E. Dickey *
+ * Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,7 +27,7 @@
* authorization. *
****************************************************************************/
/*
- * $Id: list_keys.c,v 1.33 2023/11/11 00:35:05 tom Exp $
+ * $Id: list_keys.c,v 1.38 2025/07/05 15:21:56 tom Exp $
*
* Author: Thomas E Dickey
*
@@ -86,7 +86,7 @@ full_name(const char *name)
{
const char *result = name;
int n;
- for (n = 0; strnames[n] != 0; ++n) {
+ for (n = 0; strnames[n] != NULL; ++n) {
if (!strcmp(name, strnames[n])) {
result = strfnames[n];
break;
@@ -104,7 +104,7 @@ show_key(const char *name, bool show)
if (show && t_opt)
fputc('"', stdout);
- if (value != 0 && value != (char *) -1) {
+ if (value != NULL && value != (char *) -1) {
while (*value != 0) {
char buffer[10];
int ch = UChar(*value++);
@@ -297,7 +297,7 @@ list_keys(TERMINAL **terms, int count)
#if NCURSES_XNAMES
if (x_opt) {
for (k = 0; k < count; ++k) {
- TERMTYPE *term;
+ const TERMTYPE *term;
set_curterm(terms[k]);
term = (TERMTYPE *) cur_term;
total += (size_t) (NUM_STRINGS(term) - STRCOUNT);
@@ -348,7 +348,7 @@ list_keys(TERMINAL **terms, int count)
widths1 = (int) strlen(modifier);
for (k = 0; k < count; ++k) {
- char *value;
+ const char *value;
set_curterm(terms[k]);
if ((value = termname()) == NULL)
failed("termname");
@@ -356,7 +356,7 @@ list_keys(TERMINAL **terms, int count)
if (widths2 < check)
widths2 = check;
}
- for (j = 0; Name(j) != 0; ++j) {
+ for (j = 0; Name(j) != NULL; ++j) {
if (valid_key(Name(j), terms, count)) {
const char *label = f_opt ? full_name(Name(j)) : Name(j);
check = (int) strlen(label);
@@ -399,7 +399,7 @@ list_keys(TERMINAL **terms, int count)
widthsx = widths0 + ((count + 1) * widths2);
- for (j = 0; Name(j) != 0; ++j) {
+ for (j = 0; Name(j) != NULL; ++j) {
if (j == 0 || (Type(j) != Type(j - 1)))
draw_line(widthsx);
if (valid_key(Name(j), terms, count)) {
@@ -440,9 +440,9 @@ usage(int ok)
,""
,USAGE_COMMON
,"Options:"
- ," -f print full names"
+ ," -f print full terminfo names"
," -m print modifier-column for shift/control keys"
- ," -t print result as CSV table"
+ ," -t print the result as CSV table"
#ifdef NCURSES_VERSION
," -x print extended capabilities"
#endif
@@ -479,11 +479,8 @@ main(int argc, char *argv[])
x_opt = TRUE;
break;
#endif
- case OPTS_VERSION:
- show_version(argv);
- ExitProgram(EXIT_SUCCESS);
default:
- usage(ch == OPTS_USAGE);
+ CASE_COMMON;
/* NOTREACHED */
}
}
@@ -498,7 +495,7 @@ main(int argc, char *argv[])
int n;
for (n = optind; n < argc; ++n) {
setupterm((NCURSES_CONST char *) argv[n], 1, &status);
- if (status > 0 && cur_term != 0) {
+ if (status > 0 && cur_term != NULL) {
terms[found++] = cur_term;
}
}