mirror of
https://github.com/Aigor44/ncursesw-morphos.git
synced 2025-01-18 15:03:58 +08:00
ncurses 6.0 - patch 20160604
+ correct logic for -f option in test/demo_terminfo.c + add test/list_keys.c
This commit is contained in:
parent
76a4793373
commit
bf66beed16
1
MANIFEST
1
MANIFEST
@ -1111,6 +1111,7 @@
|
||||
./test/knight.c
|
||||
./test/linedata.h
|
||||
./test/linux-color.dat
|
||||
./test/list_keys.c
|
||||
./test/listused.sh
|
||||
./test/lrtest.c
|
||||
./test/make-tar.sh
|
||||
|
6
NEWS
6
NEWS
@ -25,7 +25,7 @@
|
||||
-- sale, use or other dealings in this Software without prior written --
|
||||
-- authorization. --
|
||||
-------------------------------------------------------------------------------
|
||||
-- $Id: NEWS,v 1.2611 2016/05/29 00:37:27 tom Exp $
|
||||
-- $Id: NEWS,v 1.2614 2016/06/04 23:20:36 tom Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This is a log of changes that ncurses has gone through since Zeyd started
|
||||
@ -45,6 +45,10 @@ See the AUTHORS file for the corresponding full names.
|
||||
Changes through 1.9.9e did not credit all contributions;
|
||||
it is not possible to add this information.
|
||||
|
||||
20160604
|
||||
+ correct logic for -f option in test/demo_terminfo.c
|
||||
+ add test/list_keys.c
|
||||
|
||||
20160528
|
||||
+ further workaround for PIE/PIC breakage which causes gpm to not link.
|
||||
+ fix most cppcheck warnings, mostly style, in ncurses library.
|
||||
|
@ -28,14 +28,14 @@ dnl***************************************************************************
|
||||
dnl
|
||||
dnl Author: Thomas E. Dickey 1995-on
|
||||
dnl
|
||||
dnl $Id: configure.in,v 1.630 2016/05/21 22:02:18 tom Exp $
|
||||
dnl $Id: configure.in,v 1.631 2016/06/04 22:47:54 tom Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl See http://invisible-island.net/autoconf/ for additional information.
|
||||
dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_PREREQ(2.52.20030208)
|
||||
AC_REVISION($Revision: 1.630 $)
|
||||
AC_REVISION($Revision: 1.631 $)
|
||||
AC_INIT(ncurses/base/lib_initscr.c)
|
||||
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
|
||||
|
||||
@ -1018,6 +1018,7 @@ if test "x$with_ext_funcs" = xyes ; then
|
||||
AC_DEFINE(HAVE_RESIZE_TERM,1,[Define to 1 to enable resize_term() function])
|
||||
AC_DEFINE(HAVE_TERM_ENTRY_H,1,[Define to 1 to enable term_entry() function])
|
||||
AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 to enable use_default_colors() function])
|
||||
AC_DEFINE(HAVE_USE_EXTENDED_NAMES,1,[Define to 1 to enable use_extended_names() function])
|
||||
AC_DEFINE(HAVE_USE_SCREEN,1,[Define to 1 to enable use_screen() function])
|
||||
AC_DEFINE(HAVE_USE_WINDOW,1,[Define to 1 to enable use_window() function])
|
||||
AC_DEFINE(HAVE_WRESIZE,1,[Define to 1 to enable wresize() function])
|
||||
|
4
dist.mk
4
dist.mk
@ -25,7 +25,7 @@
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
# $Id: dist.mk,v 1.1108 2016/05/28 14:10:12 tom Exp $
|
||||
# $Id: dist.mk,v 1.1109 2016/06/04 11:00:51 tom Exp $
|
||||
# Makefile for creating ncurses distributions.
|
||||
#
|
||||
# This only needs to be used directly as a makefile by developers, but
|
||||
@ -37,7 +37,7 @@ SHELL = /bin/sh
|
||||
# These define the major/minor/patch versions of ncurses.
|
||||
NCURSES_MAJOR = 6
|
||||
NCURSES_MINOR = 0
|
||||
NCURSES_PATCH = 20160528
|
||||
NCURSES_PATCH = 20160604
|
||||
|
||||
# We don't append the patch to the version, since this only applies to releases
|
||||
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
|
||||
|
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.0+20160528) unstable; urgency=low
|
||||
ncurses6 (6.0+20160604) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 28 May 2016 10:10:12 -0400
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 04 Jun 2016 07:00:51 -0400
|
||||
|
||||
ncurses6 (5.9-20131005) unstable; urgency=low
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.0+20160528) unstable; urgency=low
|
||||
ncurses6 (6.0+20160604) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 28 May 2016 10:10:12 -0400
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 04 Jun 2016 07:00:51 -0400
|
||||
|
||||
ncurses6 (5.9-20131005) unstable; urgency=low
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
ncurses6 (6.0+20160528) unstable; urgency=low
|
||||
ncurses6 (6.0+20160604) unstable; urgency=low
|
||||
|
||||
* latest weekly patch
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 28 May 2016 10:10:12 -0400
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 04 Jun 2016 07:00:51 -0400
|
||||
|
||||
ncurses6 (5.9-20120608) unstable; urgency=low
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
; $Id: mingw-ncurses.nsi,v 1.160 2016/05/28 14:10:12 tom Exp $
|
||||
; $Id: mingw-ncurses.nsi,v 1.161 2016/06/04 11:00:51 tom Exp $
|
||||
|
||||
; TODO add examples
|
||||
; TODO bump ABI to 6
|
||||
@ -10,7 +10,7 @@
|
||||
!define VERSION_MAJOR "6"
|
||||
!define VERSION_MINOR "0"
|
||||
!define VERSION_YYYY "2016"
|
||||
!define VERSION_MMDD "0528"
|
||||
!define VERSION_MMDD "0604"
|
||||
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
|
||||
|
||||
!define MY_ABI "5"
|
||||
|
@ -3,7 +3,7 @@
|
||||
Summary: shared libraries for terminal handling
|
||||
Name: mingw32-ncurses6
|
||||
Version: 6.0
|
||||
Release: 20160528
|
||||
Release: 20160604
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: shared libraries for terminal handling
|
||||
Name: ncurses6
|
||||
Version: 6.0
|
||||
Release: 20160528
|
||||
Release: 20160604
|
||||
License: X11
|
||||
Group: Development/Libraries
|
||||
Source: ncurses-%{version}-%{release}.tgz
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2009-2014,2015 Free Software Foundation, Inc. *
|
||||
* Copyright (c) 2009-2015,2016 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 *
|
||||
@ -29,7 +29,7 @@
|
||||
/*
|
||||
* Author: Thomas E. Dickey
|
||||
*
|
||||
* $Id: demo_terminfo.c,v 1.40 2015/10/10 20:52:41 tom Exp $
|
||||
* $Id: demo_terminfo.c,v 1.41 2016/06/04 23:19:32 tom Exp $
|
||||
*
|
||||
* A simple demo of the terminfo interface.
|
||||
*/
|
||||
@ -90,7 +90,7 @@ static long total_n_values;
|
||||
static long total_s_values;
|
||||
|
||||
#define FCOLS 8
|
||||
#define FNAME(type) "%s %-*s = ", #type, FCOLS
|
||||
#define FNAME(type) "%s %-*s = ", #type, f_opt ? 24 : FCOLS
|
||||
|
||||
static char *
|
||||
make_dbitem(char *p, char *q)
|
||||
@ -166,7 +166,7 @@ free_dblist(void)
|
||||
#endif
|
||||
|
||||
static void
|
||||
dumpit(NCURSES_CONST char *cap)
|
||||
dumpit(NCURSES_CONST char *cap, const char *show)
|
||||
{
|
||||
const char *str;
|
||||
int num;
|
||||
@ -175,7 +175,7 @@ dumpit(NCURSES_CONST char *cap)
|
||||
total_values++;
|
||||
total_s_values++;
|
||||
if (!q_opt) {
|
||||
printf(FNAME(str), cap);
|
||||
printf(FNAME(str), show ? show : cap);
|
||||
while (*str != 0) {
|
||||
int ch = UChar(*str++);
|
||||
switch (ch) {
|
||||
@ -228,14 +228,14 @@ dumpit(NCURSES_CONST char *cap)
|
||||
total_values++;
|
||||
total_n_values++;
|
||||
if (!q_opt) {
|
||||
printf(FNAME(num), cap);
|
||||
printf(FNAME(num), show ? show : cap);
|
||||
printf(" %d\n", num);
|
||||
}
|
||||
} else if ((num = tigetflag(cap)) >= 0) {
|
||||
total_values++;
|
||||
total_b_values++;
|
||||
if (!q_opt) {
|
||||
printf(FNAME(flg), cap);
|
||||
printf(FNAME(flg), show ? show : cap);
|
||||
printf("%s\n", num ? "true" : "false");
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ abcdefghijklmnopqrstuvwxyz_";
|
||||
cap[j] = legal[item[j]];
|
||||
}
|
||||
cap[length] = '\0';
|
||||
dumpit(cap);
|
||||
dumpit(cap, NULL);
|
||||
|
||||
k = length - 1;
|
||||
do {
|
||||
@ -312,12 +312,6 @@ abcdefghijklmnopqrstuvwxyz_";
|
||||
del_curterm(cur_term);
|
||||
}
|
||||
|
||||
#if USE_CODE_LISTS
|
||||
#define fullname(type,n) f_opt ? type##fnames[n] : my_##type##codes[n]
|
||||
#else
|
||||
#define fullname(type,n) my_##type##codes[n]
|
||||
#endif
|
||||
|
||||
static void
|
||||
demo_terminfo(char *name)
|
||||
{
|
||||
@ -333,28 +327,28 @@ demo_terminfo(char *name)
|
||||
|
||||
if (b_opt) {
|
||||
for (n = 0;; ++n) {
|
||||
cap = fullname(bool, n);
|
||||
cap = my_boolcodes[n];
|
||||
if (cap == 0)
|
||||
break;
|
||||
dumpit(cap);
|
||||
dumpit(cap, f_opt ? boolfnames[n] : cap);
|
||||
}
|
||||
}
|
||||
|
||||
if (n_opt) {
|
||||
for (n = 0;; ++n) {
|
||||
cap = fullname(num, n);
|
||||
cap = my_numcodes[n];
|
||||
if (cap == 0)
|
||||
break;
|
||||
dumpit(cap);
|
||||
dumpit(cap, f_opt ? numfnames[n] : cap);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_opt) {
|
||||
for (n = 0;; ++n) {
|
||||
cap = fullname(str, n);
|
||||
cap = my_strcodes[n];
|
||||
if (cap == 0)
|
||||
break;
|
||||
dumpit(cap);
|
||||
dumpit(cap, f_opt ? strfnames[n] : cap);
|
||||
}
|
||||
}
|
||||
#ifdef NCURSES_VERSION
|
||||
@ -368,13 +362,13 @@ demo_terminfo(char *name)
|
||||
|| (NUM_NUMBERS(term) != NUMCOUNT)
|
||||
|| (NUM_STRINGS(term) != STRCOUNT))) {
|
||||
for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) {
|
||||
dumpit(ExtBoolname(term, (int) n, boolnames));
|
||||
dumpit(ExtBoolname(term, (int) n, boolnames), NULL);
|
||||
}
|
||||
for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) {
|
||||
dumpit(ExtNumname(term, (int) n, numnames));
|
||||
dumpit(ExtNumname(term, (int) n, numnames), NULL);
|
||||
}
|
||||
for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
|
||||
dumpit(ExtStrname(term, (int) n, strnames));
|
||||
dumpit(ExtStrname(term, (int) n, strnames), NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -400,7 +394,7 @@ demo_terminfo(char *name)
|
||||
} else {
|
||||
sprintf(temp, "%.*s%d", 8, xterm_keys[n], mod);
|
||||
}
|
||||
dumpit(temp);
|
||||
dumpit(temp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -894,8 +888,12 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
printf("%ld values (%ld booleans, %ld numbers, %ld strings)\n",
|
||||
total_values, total_b_values, total_n_values, total_s_values);
|
||||
#define PLURAL(n) n, (n != 1) ? "s" : ""
|
||||
printf("%ld value%s (%ld boolean%s, %ld number%s, %ld string%s)\n",
|
||||
PLURAL(total_values),
|
||||
PLURAL(total_b_values),
|
||||
PLURAL(total_n_values),
|
||||
PLURAL(total_s_values));
|
||||
|
||||
#ifdef NO_LEAKS
|
||||
free_dblist();
|
||||
|
347
test/list_keys.c
Normal file
347
test/list_keys.c
Normal file
@ -0,0 +1,347 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2016 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 *
|
||||
* "Software"), to deal in the Software without restriction, including *
|
||||
* without limitation the rights to use, copy, modify, merge, publish, *
|
||||
* distribute, distribute with modifications, sublicense, and/or sell *
|
||||
* copies of the Software, and to permit persons to whom the Software is *
|
||||
* furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included *
|
||||
* in all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
||||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* Except as contained in this notice, the name(s) of the above copyright *
|
||||
* holders shall not be used in advertising or otherwise to promote the *
|
||||
* sale, use or other dealings in this Software without prior written *
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
/*
|
||||
* $Id: list_keys.c,v 1.4 2016/06/04 22:39:47 tom Exp $
|
||||
*
|
||||
* Author: Thomas E Dickey
|
||||
*
|
||||
* List function keys for one or more terminals.
|
||||
*/
|
||||
|
||||
#define USE_TINFO
|
||||
#include <test.priv.h>
|
||||
|
||||
#if NCURSES_XNAMES
|
||||
#if HAVE_TERM_ENTRY_H
|
||||
#include <term_entry.h>
|
||||
#else
|
||||
#undef NCURSES_XNAMES
|
||||
#define NCURSES_XNAMES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_TIGETSTR
|
||||
#if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES)
|
||||
|
||||
static bool f_opt = FALSE;
|
||||
static bool t_opt = FALSE;
|
||||
static bool x_opt = FALSE;
|
||||
|
||||
static const char *
|
||||
full_name(const char *name)
|
||||
{
|
||||
const char *result = name;
|
||||
int n;
|
||||
for (n = 0; strnames[n] != 0; ++n) {
|
||||
if (!strcmp(name, strnames[n])) {
|
||||
result = strfnames[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
show_key(const char *name, bool show)
|
||||
{
|
||||
int width = 0;
|
||||
char buffer[10];
|
||||
char *value = tigetstr(name);
|
||||
|
||||
if (show && t_opt)
|
||||
fputc('"', stdout);
|
||||
|
||||
if (value != 0 && value != (char *) -1) {
|
||||
while (*value != 0) {
|
||||
int ch = UChar(*value++);
|
||||
switch (ch) {
|
||||
case '\177':
|
||||
strcpy(buffer, "^?");
|
||||
break;
|
||||
case '\033':
|
||||
strcpy(buffer, "\\E");
|
||||
break;
|
||||
case '\b':
|
||||
strcpy(buffer, "\\b");
|
||||
break;
|
||||
case '\f':
|
||||
strcpy(buffer, "\\f");
|
||||
break;
|
||||
case '\n':
|
||||
strcpy(buffer, "\\n");
|
||||
break;
|
||||
case '\r':
|
||||
strcpy(buffer, "\\r");
|
||||
break;
|
||||
case ' ':
|
||||
strcpy(buffer, "\\s");
|
||||
break;
|
||||
case '\t':
|
||||
strcpy(buffer, "\\t");
|
||||
break;
|
||||
case '^':
|
||||
strcpy(buffer, "\\^");
|
||||
break;
|
||||
case ':':
|
||||
strcpy(buffer, "\\072");
|
||||
break;
|
||||
case '\\':
|
||||
strcpy(buffer, "\\\\");
|
||||
break;
|
||||
default:
|
||||
if (t_opt && ch == '"') {
|
||||
strcpy(buffer, "\"\"");
|
||||
} else if (isgraph(ch)) {
|
||||
sprintf(buffer, "%c", ch);
|
||||
} else if (ch < 32) {
|
||||
sprintf(buffer, "^%c", ch + '@');
|
||||
} else {
|
||||
sprintf(buffer, "\\%03o", ch);
|
||||
}
|
||||
break;
|
||||
}
|
||||
width += (int) strlen(buffer);
|
||||
if (show)
|
||||
fputs(buffer, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
if (show && t_opt)
|
||||
fputc('"', stdout);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
static bool
|
||||
valid_key(const char *name, TERMINAL ** terms, int count)
|
||||
{
|
||||
bool result = FALSE;
|
||||
if (*name == 'k') {
|
||||
int k;
|
||||
for (k = 0; k < count; ++k) {
|
||||
set_curterm(terms[k]);
|
||||
if (show_key(name, FALSE)) {
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
list_keys(TERMINAL ** terms, int count)
|
||||
{
|
||||
int j, k;
|
||||
int widths0 = 0;
|
||||
int widths1 = 0;
|
||||
int check;
|
||||
int total = 0;
|
||||
const char *name = f_opt ? "strfname" : "strname";
|
||||
const char **list;
|
||||
|
||||
for (total = 0; strnames[total]; ++total) {
|
||||
;
|
||||
}
|
||||
#if NCURSES_XNAMES
|
||||
if (x_opt) {
|
||||
TERMTYPE *term;
|
||||
for (k = 0; k < count; ++k) {
|
||||
set_curterm(terms[k]);
|
||||
term = &(cur_term->type);
|
||||
total += NUM_STRINGS(term) - STRCOUNT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
list = typeCalloc(const char *, total + 1);
|
||||
for (j = 0; strnames[j]; ++j) {
|
||||
list[j] = strnames[j];
|
||||
}
|
||||
#if NCURSES_XNAMES
|
||||
if (x_opt) {
|
||||
TERMTYPE *term;
|
||||
int m, n;
|
||||
for (k = 0; k < count; ++k) {
|
||||
set_curterm(terms[k]);
|
||||
term = &(cur_term->type);
|
||||
for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
|
||||
bool found = FALSE;
|
||||
const char *estr = ExtStrname(term, (int) n, strnames);
|
||||
for (m = STRCOUNT; m < j; ++m) {
|
||||
if (!strcmp(estr, list[m])) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
list[j++] = estr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
widths0 = (int) strlen(name);
|
||||
for (k = 0; k < count; ++k) {
|
||||
set_curterm(terms[k]);
|
||||
check = (int) strlen(name);
|
||||
if (widths1 < check)
|
||||
widths1 = check;
|
||||
}
|
||||
for (j = 0; list[j] != 0; ++j) {
|
||||
if (valid_key(list[j], terms, count)) {
|
||||
const char *label = f_opt ? full_name(list[j]) : list[j];
|
||||
check = (int) strlen(label);
|
||||
if (widths0 < check)
|
||||
widths0 = check;
|
||||
for (k = 0; k < count; ++k) {
|
||||
set_curterm(terms[k]);
|
||||
check = show_key(list[j], FALSE);
|
||||
if (widths1 < check)
|
||||
widths1 = check;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (t_opt) {
|
||||
printf("\"%s\"", name);
|
||||
} else {
|
||||
printf("%-*s", widths0, name);
|
||||
}
|
||||
for (k = 0; k < count; ++k) {
|
||||
set_curterm(terms[k]);
|
||||
if (t_opt) {
|
||||
printf(",\"%s\"", termname());
|
||||
} else if (k + 1 >= count) {
|
||||
printf(" %s", termname());
|
||||
} else {
|
||||
printf(" %-*s", widths1, termname());
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
for (j = 0; list[j] != 0; ++j) {
|
||||
if (valid_key(list[j], terms, count)) {
|
||||
const char *label = f_opt ? full_name(list[j]) : list[j];
|
||||
if (t_opt) {
|
||||
printf("\"%s\"", label);
|
||||
} else {
|
||||
printf("%-*s", widths0, label);
|
||||
}
|
||||
for (k = 0; k < count; ++k) {
|
||||
printf(t_opt ? "," : " ");
|
||||
set_curterm(terms[k]);
|
||||
check = show_key(list[j], TRUE);
|
||||
if (!t_opt) {
|
||||
if (k + 1 < count) {
|
||||
printf("%*s", widths1 + 1 - check, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
static const char *msg[] =
|
||||
{
|
||||
"Usage: list_keys [options] [terminal [terminal2 [...]]]",
|
||||
"",
|
||||
"Print capabilities for terminal special keys.",
|
||||
"",
|
||||
"Options:",
|
||||
" -f print full names",
|
||||
" -t print result as CSV table",
|
||||
#ifdef NCURSES_VERSION
|
||||
" -x print extended capabilities",
|
||||
#endif
|
||||
};
|
||||
unsigned n;
|
||||
for (n = 0; n < SIZEOF(msg); ++n) {
|
||||
fprintf(stderr, "%s\n", msg[n]);
|
||||
}
|
||||
ExitProgram(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int n;
|
||||
TERMINAL **terms = typeCalloc(TERMINAL *, argc);
|
||||
|
||||
while ((n = getopt(argc, argv, "ftx")) != -1) {
|
||||
switch (n) {
|
||||
case 'f':
|
||||
f_opt = TRUE;
|
||||
break;
|
||||
case 't':
|
||||
t_opt = TRUE;
|
||||
break;
|
||||
#ifdef NCURSES_VERSION
|
||||
case 'x':
|
||||
x_opt = TRUE;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_USE_EXTENDED_NAMES
|
||||
use_extended_names(x_opt);
|
||||
#endif
|
||||
|
||||
for (n = optind; n < argc; ++n) {
|
||||
setupterm((NCURSES_CONST char *) argv[n], 1, (int *) 0);
|
||||
terms[n - optind] = cur_term;
|
||||
}
|
||||
list_keys(terms, argc - optind);
|
||||
|
||||
ExitProgram(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#else
|
||||
int
|
||||
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
|
||||
{
|
||||
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)
|
||||
{
|
||||
printf("This program requires the terminfo functions such as tigetstr\n");
|
||||
ExitProgram(EXIT_FAILURE);
|
||||
}
|
||||
#endif /* HAVE_TIGETSTR */
|
@ -1,6 +1,6 @@
|
||||
# $Id: modules,v 1.53 2015/11/21 16:05:48 tom Exp $
|
||||
# $Id: modules,v 1.54 2016/06/04 17:47:08 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. #
|
||||
# Copyright (c) 1998-2015,2016 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 "Software"), #
|
||||
@ -70,6 +70,7 @@ inserts progs $(srcdir) $(HEADER_DEPS) $(srcdir)/linedata.h
|
||||
key_names progs $(srcdir) $(HEADER_DEPS)
|
||||
keynames progs $(srcdir) $(HEADER_DEPS)
|
||||
knight progs $(srcdir) $(HEADER_DEPS)
|
||||
list_keys progs $(srcdir) $(HEADER_DEPS)
|
||||
lrtest progs $(srcdir) $(HEADER_DEPS)
|
||||
movewindow progs $(srcdir) $(HEADER_DEPS)
|
||||
ncurses progs $(srcdir) $(HEADER_DEPS) ../include/panel.h ../include/menu.h ../include/form.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
# $Id: programs,v 1.27 2015/11/21 16:06:12 tom Exp $
|
||||
# $Id: programs,v 1.28 2016/06/04 17:47:41 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright (c) 2006-2014,2015 Free Software Foundation, Inc. #
|
||||
# Copyright (c) 2006-2015,2016 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 "Software"), #
|
||||
@ -67,6 +67,7 @@ inserts $(LDFLAGS_CURSES) $(LOCAL_LIBS) inserts
|
||||
key_names $(LDFLAGS_CURSES) $(LOCAL_LIBS) key_names
|
||||
keynames $(LDFLAGS_CURSES) $(LOCAL_LIBS) keynames
|
||||
knight $(LDFLAGS_CURSES) $(LOCAL_LIBS) knight
|
||||
list_keys $(LDFLAGS_TINFO) $(LOCAL_LIBS) list_keys
|
||||
lrtest $(LDFLAGS_CURSES) $(LOCAL_LIBS) lrtest
|
||||
movewindow $(LDFLAGS_CURSES) $(LOCAL_LIBS) movewindow
|
||||
ncurses $(LDFLAGS_DEFAULT) $(LOCAL_LIBS) ncurses
|
||||
|
Loading…
Reference in New Issue
Block a user