projects
/
ncurses.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ncurses 5.9 - patch 20130209
[ncurses.git]
/
test
/
demo_terminfo.c
diff --git
a/test/demo_terminfo.c
b/test/demo_terminfo.c
index 8b64869f1c2aae4e35e3540a5a7ae36abc475f3e..28c79f964100abe2315aab08343879cd6ef19ff7 100644
(file)
--- a/
test/demo_terminfo.c
+++ b/
test/demo_terminfo.c
@@
-1,5
+1,5
@@
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2009-201
0,2012
Free Software Foundation, Inc. *
+ * Copyright (c) 2009-201
2,2013
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 *
@@
-29,7
+29,7
@@
/*
* Author: Thomas E. Dickey
*
/*
* Author: Thomas E. Dickey
*
- * $Id: demo_terminfo.c,v 1.1
3 2012/07/07 23:37:13
tom Exp $
+ * $Id: demo_terminfo.c,v 1.1
6 2013/01/19 19:30:58
tom Exp $
*
* A simple demo of the terminfo interface.
*/
*
* A simple demo of the terminfo interface.
*/
@@
-283,7
+283,7
@@
demo_terminfo(char *name)
}
#endif
} else {
}
#endif
} else {
- char temp[
1
0];
+ char temp[
8
0];
static const char *xterm_keys[] =
{
"kDC", "kDN", "kEND", "kHOM", "kIC",
static const char *xterm_keys[] =
{
"kDC", "kDN", "kEND", "kHOM", "kIC",
@@
-292,9
+292,9
@@
demo_terminfo(char *name)
for (n = 0; n < SIZEOF(xterm_keys); ++n) {
for (mod = 0; mod < 8; ++mod) {
if (mod == 0)
for (n = 0; n < SIZEOF(xterm_keys); ++n) {
for (mod = 0; mod < 8; ++mod) {
if (mod == 0)
- s
trcpy(temp
, xterm_keys[n]);
+ s
printf(temp, "%.*s", 8
, xterm_keys[n]);
else
else
- sprintf(temp, "%
s%d"
, xterm_keys[n], mod);
+ sprintf(temp, "%
.*s%d", 8
, xterm_keys[n], mod);
dumpit(temp);
}
}
dumpit(temp);
}
}
@@
-325,6
+325,7
@@
usage(void)
" -s print string-capabilities",
#ifdef NCURSES_VERSION
" -x print extended capabilities",
" -s print string-capabilities",
#ifdef NCURSES_VERSION
" -x print extended capabilities",
+ " -y disable extended capabilities",
#endif
};
unsigned n;
#endif
};
unsigned n;
@@
-341,8
+342,11
@@
main(int argc, char *argv[])
int repeat;
char *name;
int r_opt = 1;
int repeat;
char *name;
int r_opt = 1;
+#ifdef NCURSES_VERSION
+ bool xy_opt = TRUE; /* by default, use_extended_names is true */
+#endif
- while ((n = getopt(argc, argv, "bd:e:fnqr:sx")) != -1) {
+ while ((n = getopt(argc, argv, "bd:e:fnqr:sx
y
")) != -1) {
switch (n) {
case 'b':
b_opt = TRUE;
switch (n) {
case 'b':
b_opt = TRUE;
@@
-372,7
+376,10
@@
main(int argc, char *argv[])
#ifdef NCURSES_VERSION
case 'x':
x_opt = TRUE;
#ifdef NCURSES_VERSION
case 'x':
x_opt = TRUE;
- use_extended_names(TRUE);
+ xy_opt = TRUE;
+ break;
+ case 'y':
+ xy_opt = FALSE;
break;
#endif
default:
break;
#endif
default:
@@
-381,6
+388,10
@@
main(int argc, char *argv[])
}
}
}
}
+#ifdef NCURSES_VERSION
+ use_extended_names(xy_opt);
+#endif
+
if (!(b_opt || n_opt || s_opt || x_opt)) {
b_opt = TRUE;
n_opt = TRUE;
if (!(b_opt || n_opt || s_opt || x_opt)) {
b_opt = TRUE;
n_opt = TRUE;