/****************************************************************************
- * Copyright 2018-2021,2022 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* authorization. *
****************************************************************************/
/*
- * $Id: list_keys.c,v 1.30 2022/12/04 00:40:11 tom Exp $
+ * $Id: list_keys.c,v 1.33 2023/11/11 00:35:05 tom Exp $
*
* Author: Thomas E Dickey
*
static bool f_opt = FALSE;
static bool m_opt = FALSE;
static bool t_opt = FALSE;
+
+#if NCURSES_XNAMES || HAVE_USE_EXTENDED_NAMES
static bool x_opt = FALSE;
+#endif
typedef enum {
ktCursor
#define Type(n) list[n].type
#define Name(n) list[n].name
+static void
+failed(const char *msg)
+{
+ perror(msg);
+ ExitProgram(EXIT_FAILURE);
+}
+
static const char *
full_name(const char *name)
{
widths1 = (int) strlen(modifier);
for (k = 0; k < count; ++k) {
+ char *value;
set_curterm(terms[k]);
- check = (int) strlen(termname());
+ if ((value = termname()) == NULL)
+ failed("termname");
+ check = (int) strlen(value);
if (widths2 < check)
widths2 = check;
}
case 't':
t_opt = TRUE;
break;
-#ifdef NCURSES_VERSION
+#if NCURSES_XNAMES || HAVE_USE_EXTENDED_NAMES
case 'x':
x_opt = TRUE;
break;
#else
int
-main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+main(void)
{
printf("This program requires the terminfo arrays\n");
ExitProgram(EXIT_FAILURE);
#endif
#else /* !HAVE_TIGETSTR */
int
-main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+main(void)
{
printf("This program requires the terminfo functions such as tigetstr\n");
ExitProgram(EXIT_FAILURE);