+ fix some cppcheck warnings, mostly style, in ncurses test-programs.
34 files changed:
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3364 2019/08/17 21:47:27 tom Exp $
+-- $Id: NEWS,v 1.3366 2019/08/24 23:16:29 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20190824
+ + fix some cppcheck warnings, mostly style, in ncurses test-programs.
+
20190817
+ amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few
details where it still differed from SVr4.
20190817
+ amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few
details where it still differed from SVr4.
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.1301 2019/08/17 13:26:39 tom Exp $
+# $Id: dist.mk,v 1.1302 2019/08/24 13:12:23 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6
NCURSES_MINOR = 1
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6
NCURSES_MINOR = 1
-NCURSES_PATCH = 20190817
+NCURSES_PATCH = 20190824
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
-ncurses6 (6.1+20190817) unstable; urgency=low
+ncurses6 (6.1+20190824) unstable; urgency=low
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Aug 2019 09:26:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Aug 2019 09:12:23 -0400
ncurses6 (5.9-20131005) unstable; urgency=low
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (6.1+20190817) unstable; urgency=low
+ncurses6 (6.1+20190824) unstable; urgency=low
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Aug 2019 09:26:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Aug 2019 09:12:23 -0400
ncurses6 (5.9-20131005) unstable; urgency=low
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (6.1+20190817) unstable; urgency=low
+ncurses6 (6.1+20190824) unstable; urgency=low
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Aug 2019 09:26:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Aug 2019 09:12:23 -0400
ncurses6 (5.9-20120608) unstable; urgency=low
ncurses6 (5.9-20120608) unstable; urgency=low
-; $Id: mingw-ncurses.nsi,v 1.347 2019/08/17 13:26:39 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.348 2019/08/24 13:12:23 tom Exp $\r
\r
; TODO add examples\r
; TODO bump ABI to 6\r
\r
; TODO add examples\r
; TODO bump ABI to 6\r
!define VERSION_MAJOR "6"\r
!define VERSION_MINOR "1"\r
!define VERSION_YYYY "2019"\r
!define VERSION_MAJOR "6"\r
!define VERSION_MINOR "1"\r
!define VERSION_YYYY "2019"\r
-!define VERSION_MMDD "0817"\r
+!define VERSION_MMDD "0824"\r
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
\r
!define MY_ABI "5"\r
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
\r
!define MY_ABI "5"\r
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.1
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.1
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.1
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.1
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.1
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.1
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: demo_menus.c,v 1.68 2019/08/17 21:45:32 tom Exp $
+ * $Id: demo_menus.c,v 1.69 2019/08/24 21:41:50 tom Exp $
*
* Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9
*
* Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9
update_trace_menu(MENU * m)
{
ITEM **items;
update_trace_menu(MENU * m)
{
ITEM **items;
bool changed = FALSE;
items = menu_items(m);
i = current_item(m);
if (i == items[0]) {
if (item_value(i)) {
bool changed = FALSE;
items = menu_items(m);
i = current_item(m);
if (i == items[0]) {
if (item_value(i)) {
for (p = items + 1; *p != 0; p++)
if (item_value(*p)) {
set_item_value(*p, FALSE);
for (p = items + 1; *p != 0; p++)
if (item_value(*p)) {
set_item_value(*p, FALSE);
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2007-2017,2018 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2018,2019 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: demo_panels.c,v 1.42 2018/05/20 19:21:18 tom Exp $
+ * $Id: demo_panels.c,v 1.43 2019/08/24 23:11:01 tom Exp $
*
* Demonstrate a variety of functions from the panel library.
*/
*
* Demonstrate a variety of functions from the panel library.
*/
static void
my_create_panel(PANEL **pans, int which, FillPanel myFill)
{
static void
my_create_panel(PANEL **pans, int which, FillPanel myFill)
{
int code;
short pair = (short) which;
short fg = (short) ((pair == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK);
int code;
short pair = (short) which;
short fg = (short) ((pair == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK);
if (code > 0) {
int tly = MIN(y0, y1);
int tlx = MIN(x0, x1);
if (code > 0) {
int tly = MIN(y0, y1);
int tlx = MIN(x0, x1);
- pan = mkpanel(pair, ABS(y1 - y0) + 1, ABS(x1 - x0) + 1, tly, tlx);
+ PANEL *pan = mkpanel(pair,
+ ABS(y1 - y0) + 1,
+ ABS(x1 - x0) + 1,
+ tly, tlx);
/* finish */
myFill(pan);
pans[which] = pan;
/* finish */
myFill(pan);
pans[which] = pan;
-show_panels(PANEL *px[MAX_PANELS + 1])
{
static const char *help[] =
{
{
static const char *help[] =
{
" s - show the panel",
" t - put the panel on the top of the stack"
};
" s - show the panel",
" t - put the panel on the top of the stack"
};
+ int j;
+
+ for (j = 0; j < (int) SIZEOF(help); ++j) {
+ if (wprintw(win, "%s\n", help[j]) == ERR)
+ break;
+ }
+}
+static void
+show_panels(PANEL *px[MAX_PANELS + 1])
+{
struct {
bool valid;
bool hidden;
struct {
bool valid;
bool hidden;
} table[MAX_PANELS + 1];
WINDOW *win;
} table[MAX_PANELS + 1];
WINDOW *win;
int j;
memset(table, 0, sizeof(table));
int j;
memset(table, 0, sizeof(table));
}
if ((win = newwin(LINES - 1, COLS, 0, 0)) != 0) {
}
if ((win = newwin(LINES - 1, COLS, 0, 0)) != 0) {
keypad(win, TRUE);
if ((pan = new_panel(win)) != 0) {
werase(win);
keypad(win, TRUE);
if ((pan = new_panel(win)) != 0) {
werase(win);
- for (j = 0; j < (int) SIZEOF(help); ++j) {
- if (wprintw(win, "%s\n", help[j]) == ERR)
- break;
- }
wgetch(win);
del_panel(pan);
pflush();
wgetch(win);
del_panel(pan);
pflush();
{
int length = 0;
int y0, x0;
{
int length = 0;
int y0, x0;
WINDOW *win;
getyx(stdscr, y0, x0);
WINDOW *win;
getyx(stdscr, y0, x0);
}
(void) wgetch(win);
} else {
}
(void) wgetch(win);
} else {
if (ch == ERR || ch == QUIT || ch == ESCAPE) {
buffer[0] = '\0';
break;
if (ch == ERR || ch == QUIT || ch == ESCAPE) {
buffer[0] = '\0';
break;
/*
* Author: Thomas E. Dickey
*
/*
* Author: Thomas E. Dickey
*
- * $Id: demo_termcap.c,v 1.57 2019/01/21 22:50:46 tom Exp $
+ * $Id: demo_termcap.c,v 1.58 2019/08/24 21:47:19 tom Exp $
*
* A simple demo of the termcap interface.
*/
*
* A simple demo of the termcap interface.
*/
- printf("** %s\n", result);
+ if (result != 0)
+ printf("** %s\n", result);
static void
demo_termcap(NCURSES_CONST char *name)
{
static void
demo_termcap(NCURSES_CONST char *name)
{
- unsigned n;
- NCURSES_CONST char *cap;
char buffer[1024];
if (db_list) {
char buffer[1024];
if (db_list) {
if (!q_opt)
printf("Terminal type \"%s\"\n", name);
if (tgetent(buffer, name) >= 0) {
if (!q_opt)
printf("Terminal type \"%s\"\n", name);
if (tgetent(buffer, name) >= 0) {
+ NCURSES_CONST char *cap;
+ unsigned n;
if (b_opt) {
for (n = 0;; ++n) {
if (b_opt) {
for (n = 0;; ++n) {
size_t count;
size_t length = 1;
char **result = 0;
size_t count;
size_t length = 1;
char **result = 0;
char *unused = 0;
for (pass = 0; pass < 2; ++pass) {
char *unused = 0;
for (pass = 0; pass < 2; ++pass) {
+ char *blob = malloc(length);
result = typeCalloc(char *, count + 1);
unused = blob;
if (blob == 0 || result == 0)
result = typeCalloc(char *, count + 1);
unused = blob;
if (blob == 0 || result == 0)
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2009-2016,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 2009-2017,2019 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 *
/*
* Author: Thomas E. Dickey
*
/*
* Author: Thomas E. Dickey
*
- * $Id: demo_terminfo.c,v 1.48 2017/11/24 20:49:11 tom Exp $
+ * $Id: demo_terminfo.c,v 1.49 2019/08/24 23:11:01 tom Exp $
*
* A simple demo of the terminfo interface.
*/
*
* A simple demo of the terminfo interface.
*/
- printf("** %s\n", result);
+ if (result != 0)
+ printf("** %s\n", result);
}
#ifdef NCURSES_VERSION
if (x_opt && (my_blob == 0)) {
}
#ifdef NCURSES_VERSION
if (x_opt && (my_blob == 0)) {
if (y_opt) {
#if NCURSES_XNAMES
TERMTYPE *term = (TERMTYPE *) cur_term;
if (y_opt) {
#if NCURSES_XNAMES
TERMTYPE *term = (TERMTYPE *) cur_term;
"kLFT", "kNXT", "kPRV", "kRIT", "kUP",
};
for (n = 0; n < SIZEOF(xterm_keys); ++n) {
"kLFT", "kNXT", "kPRV", "kRIT", "kUP",
};
for (n = 0; n < SIZEOF(xterm_keys); ++n) {
for (mod = 0; mod < 8; ++mod) {
if (mod == 0) {
/* these happen to be standard - avoid duplicates */
for (mod = 0; mod < 8; ++mod) {
if (mod == 0) {
/* these happen to be standard - avoid duplicates */
size_t count;
size_t length = 1;
char **result = 0;
size_t count;
size_t length = 1;
char **result = 0;
char *unused = 0;
for (pass = 0; pass < 2; ++pass) {
char *unused = 0;
for (pass = 0; pass < 2; ++pass) {
+ char *blob = malloc(length);
result = typeCalloc(char *, count + 1);
unused = blob;
if (blob == 0 || result == 0)
result = typeCalloc(char *, count + 1);
unused = blob;
if (blob == 0 || result == 0)
/*
* Author: Thomas E. Dickey <dickey@clark.net> 1999
*
/*
* Author: Thomas E. Dickey <dickey@clark.net> 1999
*
- * $Id: dots.c,v 1.34 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots.c,v 1.35 2019/08/24 21:49:50 tom Exp $
*
* A simple demo of the terminfo interface.
*/
*
* A simple demo of the terminfo interface.
*/
main(int argc,
char *argv[])
{
main(int argc,
char *argv[])
{
double r;
double c;
int my_colors;
double r;
double c;
int my_colors;
size_t need;
char *my_env;
size_t need;
char *my_env;
- while ((x = getopt(argc, argv, "T:efm:s:")) != -1) {
- switch (x) {
+ while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) {
+ switch (ch) {
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
started = time((time_t *) 0);
while (!interrupted) {
started = time((time_t *) 0);
while (!interrupted) {
- x = (int) (c * ranf()) + m_option;
- y = (int) (r * ranf()) + m_option;
- p = (ranf() > 0.9) ? '*' : ' ';
+ int x = (int) (c * ranf()) + m_option;
+ int y = (int) (r * ranf()) + m_option;
+ int p = (ranf() > 0.9) ? '*' : ' ';
tputs(tparm3(cursor_address, y, x), 1, outc);
if (my_colors > 0) {
tputs(tparm3(cursor_address, y, x), 1, outc);
if (my_colors > 0) {
- z = (int) (ranf() * my_colors);
+ int z = (int) (ranf() * my_colors);
if (ranf() > 0.01) {
tputs(tparm2(set_a_foreground, z), 1, outc);
} else {
if (ranf() > 0.01) {
tputs(tparm2(set_a_foreground, z), 1, outc);
} else {
/*
* Author: Thomas E. Dickey
*
/*
* Author: Thomas E. Dickey
*
- * $Id: dots_curses.c,v 1.14 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_curses.c,v 1.15 2019/08/24 21:50:35 tom Exp $
*
* A simple demo of the curses interface used for comparison with termcap.
*/
*
* A simple demo of the curses interface used for comparison with termcap.
*/
int
main(int argc, char *argv[])
{
int
main(int argc, char *argv[])
{
int fg, bg;
double r;
double c;
int fg, bg;
double r;
double c;
size_t need;
char *my_env;
size_t need;
char *my_env;
- while ((x = getopt(argc, argv, "T:dem:s:")) != -1) {
- switch (x) {
+ while ((ch = getopt(argc, argv, "T:dem:s:")) != -1) {
+ switch (ch) {
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
fg = COLOR_WHITE;
bg = COLOR_BLACK;
while (!interrupted) {
fg = COLOR_WHITE;
bg = COLOR_BLACK;
while (!interrupted) {
- x = (int) (c * ranf()) + m_option;
- y = (int) (r * ranf()) + m_option;
- p = (ranf() > 0.9) ? '*' : ' ';
+ int x = (int) (c * ranf()) + m_option;
+ int y = (int) (r * ranf()) + m_option;
+ int p = (ranf() > 0.9) ? '*' : ' ';
move(y, x);
if (has_colors()) {
move(y, x);
if (has_colors()) {
- z = (int) (ranf() * COLORS);
+ int z = (int) (ranf() * COLORS);
if (ranf() > 0.01) {
set_colors(fg = z, bg);
attron(COLOR_PAIR(mypair(fg, bg)));
if (ranf() > 0.01) {
set_colors(fg = z, bg);
attron(COLOR_PAIR(mypair(fg, bg)));
/*
* Author: Thomas E. Dickey - 2007
*
/*
* Author: Thomas E. Dickey - 2007
*
- * $Id: dots_mvcur.c,v 1.20 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_mvcur.c,v 1.21 2019/08/24 22:19:28 tom Exp $
*
* A simple demo of the terminfo interface, and mvcur.
*/
*
* A simple demo of the terminfo interface, and mvcur.
*/
char *argv[]GCC_UNUSED)
{
int x0 = 1, y0 = 1;
char *argv[]GCC_UNUSED)
{
int x0 = 1, y0 = 1;
double r;
double c;
SCREEN *sp;
double r;
double c;
SCREEN *sp;
size_t need;
char *my_env;
size_t need;
char *my_env;
- while ((x = getopt(argc, argv, "T:efm:s:")) != -1) {
- switch (x) {
+ while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) {
+ switch (ch) {
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
started = time((time_t *) 0);
while (!interrupted) {
started = time((time_t *) 0);
while (!interrupted) {
- x = (int) (c * ranf()) + m_option;
- y = (int) (r * ranf()) + m_option;
- p = (ranf() > 0.9) ? '*' : ' ';
+ int x = (int) (c * ranf()) + m_option;
+ int y = (int) (r * ranf()) + m_option;
+ int p = (ranf() > 0.9) ? '*' : ' ';
if (mvcur(y0, x0, y, x) != ERR) {
x0 = x;
if (mvcur(y0, x0, y, x) != ERR) {
x0 = x;
- z = (int) (ranf() * my_colors);
+ int z = (int) (ranf() * my_colors);
if (ranf() > 0.01) {
tputs(tparm2(set_a_foreground, z), 1, outc);
} else {
if (ranf() > 0.01) {
tputs(tparm2(set_a_foreground, z), 1, outc);
} else {
/*
* Author: Thomas E. Dickey
*
/*
* Author: Thomas E. Dickey
*
- * $Id: dots_termcap.c,v 1.18 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_termcap.c,v 1.19 2019/08/24 22:25:55 tom Exp $
*
* A simple demo of the termcap interface.
*/
*
* A simple demo of the termcap interface.
*/
int
main(int argc, char *argv[])
{
int
main(int argc, char *argv[])
{
int num_colors;
int num_lines;
int num_columns;
int num_colors;
int num_lines;
int num_columns;
size_t need;
char *my_env;
size_t need;
char *my_env;
- while ((x = getopt(argc, argv, "T:em:s:")) != -1) {
- switch (x) {
+ while ((ch = getopt(argc, argv, "T:em:s:")) != -1) {
+ switch (ch) {
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
case 'T':
need = 6 + strlen(optarg);
my_env = malloc(need);
srand((unsigned) time(0));
srand((unsigned) time(0));
- InitAndCatch(z = tgetent(buffer, name), onsig);
- if (z < 0) {
+ InitAndCatch(ch = tgetent(buffer, name), onsig);
+ if (ch < 0) {
fprintf(stderr, "terminal description not found\n");
ExitProgram(EXIT_FAILURE);
} else {
fprintf(stderr, "terminal description not found\n");
ExitProgram(EXIT_FAILURE);
} else {
started = time((time_t *) 0);
while (!interrupted) {
started = time((time_t *) 0);
while (!interrupted) {
- x = (int) (c * ranf()) + m_option;
- y = (int) (r * ranf()) + m_option;
- p = (ranf() > 0.9) ? '*' : ' ';
+ int x = (int) (c * ranf()) + m_option;
+ int y = (int) (r * ranf()) + m_option;
+ int p = (ranf() > 0.9) ? '*' : ' ';
tputs(tgoto(t_cm, x, y), 1, outc);
if (num_colors > 0) {
tputs(tgoto(t_cm, x, y), 1, outc);
if (num_colors > 0) {
- z = (int) (ranf() * num_colors);
+ int z = (int) (ranf() * num_colors);
if (ranf() > 0.01) {
tputs(tgoto(t_AF, 0, z), 1, outc);
} else {
if (ranf() > 0.01) {
tputs(tgoto(t_AF, 0, z), 1, outc);
} else {
/*
* Author: Thomas E. Dickey
*
/*
* Author: Thomas E. Dickey
*
- * $Id: dots_xcurses.c,v 1.17 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_xcurses.c,v 1.18 2019/08/24 22:31:43 tom Exp $
*
* A simple demo of the wide-curses interface used for comparison with termcap.
*/
*
* A simple demo of the wide-curses interface used for comparison with termcap.
*/
int
main(int argc, char *argv[])
{
int
main(int argc, char *argv[])
{
int fg, bg, ch;
wchar_t wch[2];
int fg, bg, ch;
wchar_t wch[2];
double r;
double c;
#if HAVE_USE_DEFAULT_COLORS
double r;
double c;
#if HAVE_USE_DEFAULT_COLORS
{
for (fg = 0; fg < COLORS; fg++) {
for (bg = 0; bg < COLORS; bg++) {
{
for (fg = 0; fg < COLORS; fg++) {
for (bg = 0; bg < COLORS; bg++) {
if (interrupted) {
cleanup();
ExitProgram(EXIT_FAILURE);
if (interrupted) {
cleanup();
ExitProgram(EXIT_FAILURE);
fg = COLOR_WHITE;
bg = COLOR_BLACK;
fg = COLOR_WHITE;
bg = COLOR_BLACK;
wch[1] = 0;
while (!interrupted) {
wch[1] = 0;
while (!interrupted) {
- x = (int) (c * ranf()) + m_option;
- y = (int) (r * ranf()) + m_option;
- p = (ranf() > 0.9) ? '*' : ' ';
+ int x = (int) (c * ranf()) + m_option;
+ int y = (int) (r * ranf()) + m_option;
+ int p = (ranf() > 0.9) ? '*' : ' ';
move(y, x);
if (has_colors()) {
move(y, x);
if (has_colors()) {
- z = (int) (ranf() * COLORS);
+ int z = (int) (ranf() * COLORS);
if (ranf() > 0.01) {
set_colors(fg = z, bg);
} else {
if (ranf() > 0.01) {
set_colors(fg = z, bg);
} else {
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2006-2014,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2017,2019 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: echochar.c,v 1.18 2017/10/18 23:04:52 tom Exp $
+ * $Id: echochar.c,v 1.19 2019/08/24 23:11:01 tom Exp $
*
* Demonstrate the echochar function (compare to dots.c).
* Thomas Dickey - 2006/11/4
*
* Demonstrate the echochar function (compare to dots.c).
* Thomas Dickey - 2006/11/4
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
double r;
double c;
bool use_colors;
double r;
double c;
bool use_colors;
started = time((time_t *) 0);
while (!interrupted) {
started = time((time_t *) 0);
while (!interrupted) {
- x = (int) (c * ranf()) + 2;
- y = (int) (r * ranf()) + 2;
- p = (ranf() > 0.9) ? '*' : ' ';
+ int x = (int) (c * ranf()) + 2;
+ int y = (int) (r * ranf()) + 2;
+ int p = (ranf() > 0.9) ? '*' : ' ';
move(y, x);
if (use_colors > 0) {
move(y, x);
if (use_colors > 0) {
- z = (int) (ranf() * COLORS);
+ int z = (int) (ranf() * COLORS);
if (ranf() > 0.01) {
set_color(my_pairs, z, last_bg);
last_fg = z;
if (ranf() > 0.01) {
set_color(my_pairs, z, last_bg);
last_fg = z;
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: extended_color.c,v 1.13 2019/01/21 14:59:34 tom Exp $
+ * $Id: extended_color.c,v 1.14 2019/08/24 23:09:18 tom Exp $
*/
#include <test.priv.h>
*/
#include <test.priv.h>
printw("Drawing soft-key tabs with pair 2\n");
slk_attrset(A_BOLD); /* reverse-video is hard to see */
printw("Drawing soft-key tabs with pair 2\n");
slk_attrset(A_BOLD); /* reverse-video is hard to see */
- i = if_opt_s(extended_slk_color_sp(sp, 2),
- extended_slk_color(2));
+ (void) if_opt_s(extended_slk_color_sp(sp, 2),
+ extended_slk_color(2));
for (i = 1; i <= 8; ++i) {
char temp[80];
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "(SLK-%d)", i);
for (i = 1; i <= 8; ++i) {
char temp[80];
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "(SLK-%d)", i);
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2019 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 *
/*
* Author: Thomas E. Dickey 1998
*
/*
* Author: Thomas E. Dickey 1998
*
- * $Id: filter.c,v 1.32 2017/09/28 23:40:39 tom Exp $
+ * $Id: filter.c,v 1.33 2019/08/24 23:11:01 tom Exp $
*
* An example of the 'filter()' function in ncurses, this program prompts
* for commands and executes them (like a command shell). It illustrates
*
* An example of the 'filter()' function in ncurses, this program prompts
* for commands and executes them (like a command shell). It illustrates
new_command(char *buffer, int length, int underline, bool clocked, bool polled)
{
int code = OK;
new_command(char *buffer, int length, int underline, bool clocked, bool polled)
{
int code = OK;
if (polled) {
bool done = FALSE;
if (polled) {
bool done = FALSE;
timeout(20); /* no one types 50CPS... */
while (!done) {
timeout(20); /* no one types 50CPS... */
while (!done) {
int ch = getch();
buffer[used] = '\0';
int ch = getch();
buffer[used] = '\0';
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2006-2017,2018 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2018,2019 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 *
/*
* Author: Thomas E. Dickey, 2006
*
/*
* Author: Thomas E. Dickey, 2006
*
- * $Id: foldkeys.c,v 1.7 2018/12/29 17:53:03 tom Exp $
+ * $Id: foldkeys.c,v 1.8 2019/08/24 23:11:01 tom Exp $
*
* Demonstrate a method for altering key definitions at runtime.
*
*
* Demonstrate a method for altering key definitions at runtime.
*
log_last_line(WINDOW *win)
{
FILE *fp;
log_last_line(WINDOW *win)
{
FILE *fp;
- int y, x, n;
- char temp[256];
if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
+ char temp[256];
+ int y, x, n;
int need = sizeof(temp) - 1;
if (need > COLS)
need = COLS;
int need = sizeof(temp) - 1;
if (need > COLS)
need = COLS;
{
int ch;
#if HAVE_GETTIMEOFDAY
{
int ch;
#if HAVE_GETTIMEOFDAY
- int secs, msecs;
- struct timeval current, previous;
+ struct timeval previous;
#endif
if (newterm(0, stdout, stdin) == 0) {
#endif
if (newterm(0, stdout, stdin) == 0) {
const char *name = keyname(escaped ? (ch - MY_KEYS) : ch);
#if HAVE_GETTIMEOFDAY
const char *name = keyname(escaped ? (ch - MY_KEYS) : ch);
#if HAVE_GETTIMEOFDAY
+ int secs, msecs;
+ struct timeval current;
+
gettimeofday(¤t, 0);
secs = (int) (current.tv_sec - previous.tv_sec);
msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000);
gettimeofday(¤t, 0);
secs = (int) (current.tv_sec - previous.tv_sec);
msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000);
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2017,2019 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 *
* modified 10-18-89 for curses (jrl)
* 10-18-89 added signal handling
*
* modified 10-18-89 for curses (jrl)
* 10-18-89 added signal handling
*
- * $Id: gdc.c,v 1.51 2017/09/30 18:10:05 tom Exp $
+ * $Id: gdc.c,v 1.52 2019/08/24 23:11:01 tom Exp $
*/
#include <test.priv.h>
*/
#include <test.priv.h>
drawbox(bool scrolling)
{
chtype bottom[XLENGTH + 1];
drawbox(bool scrolling)
{
chtype bottom[XLENGTH + 1];
if (hascolor)
(void) attrset(AttrArg(COLOR_PAIR(PAIR_FRAMES), 0));
if (hascolor)
(void) attrset(AttrArg(COLOR_PAIR(PAIR_FRAMES), 0));
MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER);
if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) {
MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER);
if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) {
for (n = 0; n < XLENGTH; n++) {
if (!scrolling)
bottom[n] &= ~A_COLOR;
for (n = 0; n < XLENGTH; n++) {
if (!scrolling)
bottom[n] &= ~A_COLOR;
if (optind < argc) {
count = atoi(argv[optind++]);
assert(count >= 0);
if (optind < argc) {
count = atoi(argv[optind++]);
assert(count >= 0);
+ if (optind < argc)
+ usage();
- if (optind < argc)
- usage();
InitAndCatch({
if (redirected) {
InitAndCatch({
if (redirected) {
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2007-2010,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2017,2019 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: inch_wide.c,v 1.9 2017/04/29 22:03:21 tom Exp $
+ * $Id: inch_wide.c,v 1.10 2019/08/24 23:11:01 tom Exp $
*/
/*
int in_wch(cchar_t *wcval);
*/
/*
int in_wch(cchar_t *wcval);
int j;
int txt_x = 0, txt_y = 0;
int base_y;
int j;
int txt_x = 0, txt_y = 0;
int base_y;
cchar_t ch;
cchar_t text[MAX_COLS];
cchar_t ch;
cchar_t text[MAX_COLS];
}
while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
}
while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
switch (j) {
case KEY_DOWN:
case 'j':
switch (j) {
case KEY_DOWN:
case 'j':
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2007-2012,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2017,2019 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: inchs.c,v 1.16 2017/09/06 09:20:42 tom Exp $
+ * $Id: inchs.c,v 1.17 2019/08/24 23:11:01 tom Exp $
*
* Author: Thomas E Dickey
*/
*
* Author: Thomas E Dickey
*/
int ch, j;
int txt_x = 0, txt_y = 0;
int base_y;
int ch, j;
int txt_x = 0, txt_y = 0;
int base_y;
chtype text[MAX_COLS];
if (argv[level] == 0) {
chtype text[MAX_COLS];
if (argv[level] == 0) {
}
while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
}
while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
switch (j) {
case KEY_DOWN:
case 'j':
switch (j) {
case KEY_DOWN:
case 'j':
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2008-2014,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 2008-2017,2019 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: insdelln.c,v 1.12 2017/09/07 08:24:24 tom Exp $
+ * $Id: insdelln.c,v 1.13 2019/08/24 23:11:01 tom Exp $
*
* test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
*/
*
* test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
*/
- static bool first = TRUE;
const char *result = 0;
if (has_colors()) {
const char *result = 0;
if (has_colors()) {
+ static bool first = TRUE;
* Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support
* added September 20th 1995.
*
* Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support
* added September 20th 1995.
*
- * $Id: knight.c,v 1.45 2019/04/20 20:34:55 tom Exp $
+ * $Id: knight.c,v 1.46 2019/08/24 22:40:52 tom Exp $
*/
#include <test.priv.h>
*/
#include <test.priv.h>
static bool
find_next_move(SQUARES squares, HISTORY * doneData, int doneSize, int *y, int *x)
{
static bool
find_next_move(SQUARES squares, HISTORY * doneData, int doneSize, int *y, int *x)
{
- unsigned j, k;
- int found = -1;
- int first = -1;
- int next = -1;
- int oldy, oldx;
- int newy, newx;
bool result = FALSE;
if (doneSize > 1) {
bool result = FALSE;
if (doneSize > 1) {
- oldy = doneData[doneSize - 1].y;
- oldx = doneData[doneSize - 1].x;
+ unsigned j;
+ int oldy = doneData[doneSize - 1].y;
+ int oldx = doneData[doneSize - 1].x;
+ int found = -1;
+ int first = -1;
+ int next = -1;
+
for (j = 0; j < MAX_OFFSET * 2; j++) {
for (j = 0; j < MAX_OFFSET * 2; j++) {
- k = j % MAX_OFFSET;
- newy = oldy + offsets[k].y;
- newx = oldx + offsets[k].x;
+ unsigned k = j % MAX_OFFSET;
+ int newy = oldy + offsets[k].y;
+ int newx = oldx + offsets[k].x;
if (isUnusedYX(squares, newy, newx)) {
if (first < 0)
first = (int) k;
if (isUnusedYX(squares, newy, newx)) {
if (first < 0)
first = (int) k;
int result;
if (total < maxmoves) {
int result;
if (total < maxmoves) {
unsigned k;
for (k = 0; k < MAX_OFFSET; k++) {
unsigned k;
for (k = 0; k < MAX_OFFSET; k++) {
- try_x = x + offsets[k].x;
- try_y = y + offsets[k].y;
+ int try_x = x + offsets[k].x;
+ int try_y = y + offsets[k].y;
if (isUnusedYX(squares, try_y, try_x)) {
++test_test;
squares[try_y][try_x] = total + 1;
if (isUnusedYX(squares, try_y, try_x)) {
++test_test;
squares[try_y][try_x] = total + 1;
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2016-2017,2018 Free Software Foundation, Inc. *
+ * Copyright (c) 2016-2018,2019 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: list_keys.c,v 1.24 2018/05/20 18:56:56 tom Exp $
+ * $Id: list_keys.c,v 1.25 2019/08/24 23:11:01 tom Exp $
*
* Author: Thomas E Dickey
*
*
* Author: Thomas E Dickey
*
show_key(const char *name, bool show)
{
int width = 0;
show_key(const char *name, bool show)
{
int width = 0;
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)
if (value != 0 && value != (char *) -1) {
while (*value != 0) {
if (value != 0 && value != (char *) -1) {
while (*value != 0) {
int ch = UChar(*value++);
switch (ch) {
case '\177':
int ch = UChar(*value++);
switch (ch) {
case '\177':
static void
draw_line(int width)
{
static void
draw_line(int width)
{
for (j = 0; j < width; ++j) {
printf("-");
}
for (j = 0; j < width; ++j) {
printf("-");
}
}
#if NCURSES_XNAMES
if (x_opt) {
}
#if NCURSES_XNAMES
if (x_opt) {
for (k = 0; k < count; ++k) {
for (k = 0; k < count; ++k) {
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);
}
#if NCURSES_XNAMES
if (x_opt) {
}
#if NCURSES_XNAMES
if (x_opt) {
for (k = 0; k < count; ++k) {
for (k = 0; k < count; ++k) {
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) {
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.516 2019/08/10 19:38:41 tom Exp $
+$Id: ncurses.c,v 1.517 2019/08/24 23:09:03 tom Exp $
***************************************************************************/
***************************************************************************/
static void
wGetstring(WINDOW *win, char *buffer, int limit)
{
static void
wGetstring(WINDOW *win, char *buffer, int limit)
{
bool done = FALSE;
echo();
bool done = FALSE;
echo();
x = (int) strlen(buffer);
while (!done) {
x = (int) strlen(buffer);
while (!done) {
if (x > (int) strlen(buffer))
x = (int) strlen(buffer);
wmove(win, y0, x0);
if (x > (int) strlen(buffer))
x = (int) strlen(buffer);
wmove(win, y0, x0);
static void
show_mouse(WINDOW *win)
{
static void
show_mouse(WINDOW *win)
{
MEVENT event;
bool outside;
bool show_loc;
MEVENT event;
bool outside;
bool show_loc;
show_loc = wmouse_trafo(win, &event.y, &event.x, FALSE);
if (show_loc) {
show_loc = wmouse_trafo(win, &event.y, &event.x, FALSE);
if (show_loc) {
getyx(win, y, x);
wmove(win, event.y, event.x);
waddch(win, '*');
getyx(win, y, x);
wmove(win, event.y, event.x);
waddch(win, '*');
{
char buf[BUFSIZ];
int first_y, first_x;
{
char buf[BUFSIZ];
int first_y, first_x;
int incount = 0;
GetchFlags flags;
int incount = 0;
GetchFlags flags;
scrollok(win, TRUE);
for (;;) {
scrollok(win, TRUE);
for (;;) {
while ((c = wGetchar(win)) == ERR) {
incount++;
if (blocking_getch(flags, delay)) {
while ((c = wGetchar(win)) == ERR) {
incount++;
if (blocking_getch(flags, delay)) {
wint_t c;
int incount = 0;
GetchFlags flags;
wint_t c;
int incount = 0;
GetchFlags flags;
char *temp;
init_getch(win, flags, delay);
char *temp;
init_getch(win, flags, delay);
scrollok(win, TRUE);
for (;;) {
scrollok(win, TRUE);
for (;;) {
while ((code = wGet_wchar(win, &c)) == ERR) {
incount++;
if (blocking_getch(flags, delay)) {
while ((code = wGet_wchar(win, &c)) == ERR) {
incount++;
if (blocking_getch(flags, delay)) {
{
char save = attr_test_string[0];
int first = ((int) UChar(save)) + adjust;
{
char save = attr_test_string[0];
int first = ((int) UChar(save)) + adjust;
if (first >= ATTRSTRING_1ST) {
if (first >= ATTRSTRING_1ST) {
for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
if (k > ATTRSTRING_END)
break;
for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
if (k > ATTRSTRING_END)
break;
werase(win);
if (attr & A_ALTCHARSET) {
const char *s;
werase(win);
if (attr & A_ALTCHARSET) {
const char *s;
for (s = attr_test_string; *s != '\0'; ++s) {
for (s = attr_test_string; *s != '\0'; ++s) {
(void) waddch(win, ch | attr);
}
} else {
(void) waddch(win, ch | attr);
}
} else {
NCURSES_COLOR_T bg = COLOR_BLACK;
NCURSES_COLOR_T tx = -1;
int ac = 0;
NCURSES_COLOR_T bg = COLOR_BLACK;
NCURSES_COLOR_T tx = -1;
int ac = 0;
WINDOW *my_wins[SIZEOF(attrs_to_test)];
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
unsigned my_size = init_attr_list(my_list, termattrs());
if (my_size > 1) {
WINDOW *my_wins[SIZEOF(attrs_to_test)];
ATTR_TBL my_list[SIZEOF(attrs_to_test)];
unsigned my_size = init_attr_list(my_list, termattrs());
if (my_size > 1) {
for (j = 0; j < my_size; ++j) {
my_wins[j] = subwin(stdscr,
1, LEN_ATTRSTRING,
for (j = 0; j < my_size; ++j) {
my_wins[j] = subwin(stdscr,
1, LEN_ATTRSTRING,
{
wchar_t save = wide_attr_test_string[0];
int first = ((int) normal_wchar(save)) + adjust;
{
wchar_t save = wide_attr_test_string[0];
int first = ((int) normal_wchar(save)) + adjust;
if (first >= ATTRSTRING_1ST) {
if (first >= ATTRSTRING_1ST) {
for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
if (k > ATTRSTRING_END)
break;
for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
if (k > ATTRSTRING_END)
break;
attr_t attr;
cchar_t ch;
NCURSES_PAIRS_T pair;
attr_t attr;
cchar_t ch;
NCURSES_PAIRS_T pair;
- wchar_t wch[CCHARW_MAX];
memset(&ch, 0, sizeof(ch));
if (getbkgrnd(&ch) != ERR) {
memset(&ch, 0, sizeof(ch));
if (getbkgrnd(&ch) != ERR) {
+ wchar_t wch[CCHARW_MAX];
+
if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) {
result = attr;
}
if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) {
result = attr;
}
NCURSES_COLOR_T bg = COLOR_BLACK;
NCURSES_COLOR_T tx = -1;
int ac = 0;
NCURSES_COLOR_T bg = COLOR_BLACK;
NCURSES_COLOR_T tx = -1;
int ac = 0;
W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)];
WINDOW *my_wins[SIZEOF(w_attrs_to_test)];
unsigned my_size = init_w_attr_list(my_list, term_attrs());
if (my_size > 1) {
W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)];
WINDOW *my_wins[SIZEOF(w_attrs_to_test)];
unsigned my_size = init_w_attr_list(my_list, term_attrs());
if (my_size > 1) {
for (j = 0; j < my_size; ++j) {
my_wins[j] = subwin(stdscr,
1, LEN_ATTRSTRING,
for (j = 0; j < my_size; ++j) {
my_wins[j] = subwin(stdscr,
1, LEN_ATTRSTRING,
int width = 8;
if (wide || zoom) {
int width = 8;
if (wide || zoom) {
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"%02d", color);
if (wide)
width = 4;
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"%02d", color);
if (wide)
width = 4;
- if ((have = (int) strlen(temp)) >= width) {
+ if ((int) strlen(temp) >= width) {
int pwr2 = 0;
while ((1 << pwr2) < color)
++pwr2;
int pwr2 = 0;
while ((1 << pwr2) < color)
++pwr2;
int base_row = 0;
int grid_top = top + 3;
int page_size = (LINES - grid_top);
int base_row = 0;
int grid_top = top + 3;
int page_size = (LINES - grid_top);
- int pairs_max = (unsigned short) (-1);
int colors_max = COLORS;
int col_limit;
int row_limit;
int colors_max = COLORS;
int col_limit;
int row_limit;
*/
if (xterm_colors) {
int n;
*/
if (xterm_colors) {
int n;
char result[BUFSIZ];
int check_n;
unsigned check_r, check_g, check_b;
raw();
noecho();
char result[BUFSIZ];
int check_n;
unsigned check_r, check_g, check_b;
raw();
noecho();
for (n = 0; n < MaxColors; ++n) {
for (n = 0; n < MaxColors; ++n) {
fprintf(stderr, "\033]4;%d;?\007", n);
got = (int) read(0, result, sizeof(result) - 1);
if (got < 0)
fprintf(stderr, "\033]4;%d;?\007", n);
got = (int) read(0, result, sizeof(result) - 1);
if (got < 0)
char *temp = strdup(s);
size_t used = strlen(temp);
size_t want = SLKLEN;
char *temp = strdup(s);
size_t used = strlen(temp);
size_t want = SLKLEN;
#ifndef state_unused
mbstate_t state;
#endif
buf[0] = L'\0';
while (want > 0 && used != 0) {
#ifndef state_unused
mbstate_t state;
#endif
buf[0] = L'\0';
while (want > 0 && used != 0) {
reset_mbytes(state);
test = count_mbytes(base, 0, &state);
if (test == (size_t) -1) {
reset_mbytes(state);
test = count_mbytes(base, 0, &state);
if (test == (size_t) -1) {
static cchar_t *
merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair)
{
static cchar_t *
merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair)
{
TEST_CCHAR(src, count, {
attr |= (test_attrs & A_ALTCHARSET);
setcchar(dst, test_wch, attr, pair, NULL);
TEST_CCHAR(src, count, {
attr |= (test_attrs & A_ALTCHARSET);
setcchar(dst, test_wch, attr, pair, NULL);
wchar_t codes[10];
char tmp[80];
int count = repeat;
wchar_t codes[10];
char tmp[80];
int count = repeat;
_nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp))
"%3ld (0x%lx)", (long) code, (long) code);
_nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp))
"%3ld (0x%lx)", (long) code, (long) code);
setcchar(&temp, codes, attr, pair, 0);
do {
setcchar(&temp, codes, attr, pair, 0);
do {
/*
* Give non-spacing characters something to combine with. If we
* don't, they'll bunch up in a heap on the space after the ":".
/*
* Give non-spacing characters something to combine with. If we
* don't, they'll bunch up in a heap on the space after the ":".
bool do_keypad = HaveKeypad(curp);
bool do_scroll = HaveScroll(curp);
char buf[BUFSIZ];
move(LINES - 4, 0);
bool do_keypad = HaveKeypad(curp);
bool do_scroll = HaveScroll(curp);
char buf[BUFSIZ];
move(LINES - 4, 0);
for (n = 0; n < SIZEOF(legend); n++) {
for (n = 0; n < SIZEOF(legend); n++) {
switch (legend[n].code) {
default:
_nc_STRCPY(buf, legend[n].msg, sizeof(buf));
switch (legend[n].code) {
default:
_nc_STRCPY(buf, legend[n].msg, sizeof(buf));
case CTRL('X'): /* resize window */
if (current) {
pair *tmp, ul, lr;
case CTRL('X'): /* resize window */
if (current) {
pair *tmp, ul, lr;
wclrtobot(current->wind);
wmove(current->wind, lr.y, lr.x);
}
wclrtobot(current->wind);
wmove(current->wind, lr.y, lr.x);
}
- if (mx > tmp->x - ul.x)
+ if (mx > tmp->x - ul.x) {
+ int i;
for (i = 0; i < my; i++) {
wmove(current->wind, i, tmp->x - ul.x + 1);
wclrtoeol(current->wind);
}
for (i = 0; i < my; i++) {
wmove(current->wind, i, tmp->x - ul.x + 1);
wclrtoeol(current->wind);
}
wnoutrefresh(current->wind);
memcpy(&lr, tmp, sizeof(pair));
wnoutrefresh(current->wind);
memcpy(&lr, tmp, sizeof(pair));
{
static int count;
static int last;
{
static int count;
static int last;
if ((pending_pan = (count > 0)) != FALSE) {
count--;
pending_pan = (count != 0);
} else {
for (;;) {
if ((pending_pan = (count > 0)) != FALSE) {
count--;
pending_pan = (count != 0);
} else {
for (;;) {
switch (c = wGetchar(win)) {
case '!':
ShellOut(FALSE);
switch (c = wGetchar(win)) {
case '!':
ShellOut(FALSE);
tracetrace(unsigned tlevel)
{
static char *buf;
tracetrace(unsigned tlevel)
{
static char *buf;
- static size_t need = 12;
+ static size_t need = 12;
for (n = 0; t_tbl[n].name != 0; n++)
need += strlen(t_tbl[n].name) + 2;
buf = typeMalloc(char, need);
for (n = 0; t_tbl[n].name != 0; n++)
need += strlen(t_tbl[n].name) + 2;
buf = typeMalloc(char, need);
size_t have = (source ? strlen(source) : 0) + 1;
size_t need = 80 + have;
char *temp = malloc(need);
size_t have = (source ? strlen(source) : 0) + 1;
size_t need = 80 + have;
char *temp = malloc(need);
_nc_STRNCPY(temp, source ? source : "", have + 1);
len = (size_t) (char *) field_userptr(me);
if (c <= KEY_MAX) {
_nc_STRNCPY(temp, source ? source : "", have + 1);
len = (size_t) (char *) field_userptr(me);
if (c <= KEY_MAX) {
static int mode = REQ_INS_MODE;
int c = wGetchar(w);
static int mode = REQ_INS_MODE;
int c = wGetchar(w);
FIELD *me = current_field(f);
bool current = TRUE;
FIELD *me = current_field(f);
bool current = TRUE;
for (n = 0; n < SIZEOF(lookup); n++) {
if (lookup[n].code == c) {
c = lookup[n].result;
for (n = 0; n < SIZEOF(lookup); n++) {
if (lookup[n].code == c) {
c = lookup[n].result;
static int
form_test(bool recur GCC_UNUSED)
{
static int
form_test(bool recur GCC_UNUSED)
{
FORM *form;
FIELD *f[12], *secure;
FIELDTYPE *fty_middle = new_fieldtype(mi_field_check, mi_char_check);
FIELDTYPE *fty_passwd = new_fieldtype(pw_field_check, pw_char_check);
FORM *form;
FIELD *f[12], *secure;
FIELDTYPE *fty_middle = new_fieldtype(mi_field_check, mi_char_check);
FIELDTYPE *fty_passwd = new_fieldtype(pw_field_check, pw_char_check);
unsigned n = 0;
#ifdef NCURSES_MOUSE_VERSION
unsigned n = 0;
#ifdef NCURSES_MOUSE_VERSION
f[n] = (FIELD *) 0;
if ((form = new_form(f)) != 0) {
f[n] = (FIELD *) 0;
if ((form = new_form(f)) != 0) {
+ WINDOW *w;
+ int finished = 0;
static int
overlap_help(int state, int flavors[OVERLAP_FLAVORS])
{
static int
overlap_help(int state, int flavors[OVERLAP_FLAVORS])
{
int item;
int limit[OVERLAP_FLAVORS];
int item;
int limit[OVERLAP_FLAVORS];
char msg[80];
if (state < 0)
char msg[80];
if (state < 0)
assert(state >= 0 && state < OVERLAP_FLAVORS);
for (item = 0; item < (2 * OVERLAP_FLAVORS); ++item) {
assert(state >= 0 && state < OVERLAP_FLAVORS);
for (item = 0; item < (2 * OVERLAP_FLAVORS); ++item) {
- row = item / 2;
- col = item % 2;
- ths = col ? "B" : "A";
- tht = col ? "A" : "B";
+ int row = item / 2;
+ int col = item % 2;
+ const char *ths = col ? "B" : "A";
+ const char *tht = col ? "A" : "B";
switch ((otBASE) row) {
case otBASE_refresh:
switch ((otBASE) row) {
case otBASE_refresh:
* newdemo.c - A demo program using PDCurses. The program illustrate
* the use of colours for text output.
*
* newdemo.c - A demo program using PDCurses. The program illustrate
* the use of colours for text output.
*
- * $Id: newdemo.c,v 1.45 2017/09/30 15:43:08 tom Exp $
+ * $Id: newdemo.c,v 1.46 2019/08/24 23:02:49 tom Exp $
*/
#include <test.priv.h>
*/
#include <test.priv.h>
WaitForUser(WINDOW *win)
{
time_t t;
WaitForUser(WINDOW *win)
{
time_t t;
nodelay(win, TRUE);
t = time((time_t *) 0);
nodelay(win, TRUE);
t = time((time_t *) 0);
if ((int) (key = (chtype) wgetch(win)) != ERR) {
if (key == 'q' || key == 'Q')
return 1;
if ((int) (key = (chtype) wgetch(win)) != ERR) {
if (key == 'q' || key == 'Q')
return 1;
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
WINDOW *win;
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
WINDOW *win;
char buffer[SIZEOF(messages) * 80];
char buffer[SIZEOF(messages) * 80];
int width, height;
chtype save[80];
int width, height;
chtype save[80];
+ int w;
+ int j;
+ chtype c;
+ const char *message;
+
set_colors(win, 1, COLOR_WHITE, COLOR_BLUE);
werase(win);
set_colors(win, 1, COLOR_WHITE, COLOR_BLUE);
werase(win);
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: pair_content.c,v 1.12 2019/01/21 01:05:22 tom Exp $
+ * $Id: pair_content.c,v 1.13 2019/08/24 23:02:49 tom Exp $
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
int i;
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
int i;
while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) {
switch (i) {
while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) {
switch (i) {
for (repeat = 0; repeat < r_opt; ++repeat) {
run_test();
for (repeat = 0; repeat < r_opt; ++repeat) {
run_test();
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: picsmap.c,v 1.129 2019/04/20 20:33:51 tom Exp $
+ * $Id: picsmap.c,v 1.130 2019/08/24 23:07:34 tom Exp $
*
* Author: Thomas E. Dickey
*
*
* Author: Thomas E. Dickey
*
if (is_file(filename, &sb)) {
size_t size = (size_t) sb.st_size;
char *blob = typeCalloc(char, size + 1);
if (is_file(filename, &sb)) {
size_t size = (size_t) sb.st_size;
char *blob = typeCalloc(char, size + 1);
unsigned k = 0;
result = typeCalloc(char *, size + 1);
unsigned k = 0;
result = typeCalloc(char *, size + 1);
FILE *fp = fopen(filename, "r");
if (fp != 0) {
logmsg("opened %s", filename);
FILE *fp = fopen(filename, "r");
if (fp != 0) {
logmsg("opened %s", filename);
if (fread(blob, sizeof(char), size, fp) == size) {
if (fread(blob, sizeof(char), size, fp) == size) {
+ bool had_line = TRUE;
+ unsigned j;
+
for (j = 0; (size_t) j < size; ++j) {
if (blob[j] == '\0' ||
(UChar(blob[j]) < 32 &&
for (j = 0; (size_t) j < size; ++j) {
if (blob[j] == '\0' ||
(UChar(blob[j]) < 32 &&
if ((power2 != COLORS) || ((shift % 3) != 0)) {
if (all_colors == 0) {
init_palette(getenv("TERM"));
if ((power2 != COLORS) || ((shift % 3) != 0)) {
if (all_colors == 0) {
init_palette(getenv("TERM"));
- }
- if (all_colors == 0) {
- giveup("With %d colors, you need a palette-file", COLORS);
+ if (all_colors == 0) {
+ giveup("With %d colors, you need a palette-file", COLORS);
+ }
arg1[cpp] = '\0';
result = 1;
} else {
arg1[cpp] = '\0';
result = 1;
} else {
const char *s = skip_cs(source);
size_t have = strlen(source);
const char *s = skip_cs(source);
size_t have = strlen(source);
memcpy(arg1, s, (size_t) cpp);
s += cpp;
while (*s++ == '\t') {
memcpy(arg1, s, (size_t) cpp);
s += cpp;
while (*s++ == '\t') {
for (t = arg2; (*s != '\0') && strchr("\t\"", *s) == 0;) {
if (*s == ' ') {
s = skip_cs(s);
for (t = arg2; (*s != '\0') && strchr("\t\"", *s) == 0;) {
if (*s == ' ') {
s = skip_cs(s);
/* subsequent lines begin "col,row: (r,g,b,a) #RGB" */
int r, g, b, nocolor;
unsigned check;
/* subsequent lines begin "col,row: (r,g,b,a) #RGB" */
int r, g, b, nocolor;
unsigned check;
char *t;
char *s = t = strchr(buffer, '#');
char *t;
char *s = t = strchr(buffer, '#');
if (s != 0) {
/* after the "#RGB", there are differences - just ignore */
while (*s != '\0' && !isspace(UChar(*s)))
if (s != 0) {
/* after the "#RGB", there are differences - just ignore */
while (*s != '\0' && !isspace(UChar(*s)))
&col, &row,
&r, &g, &b, &nocolor,
&check)) {
&col, &row,
&r, &g, &b, &nocolor,
&check)) {
if ((s - t) > 8) /* 6 hex digits vs 8 */
check /= 256;
if (r > MaxRGB ||
if ((s - t) > 8) /* 6 hex digits vs 8 */
check /= 256;
if (r > MaxRGB ||
debugmsg("called show_picture");
logmsg("...using %dx%d screen", LINES, COLS);
debugmsg("called show_picture");
logmsg("...using %dx%d screen", LINES, COLS);
if (has_colors()) {
logmsg("...using %d colors", pics->colors);
for (n = 0; n < pics->colors; ++n) {
if (has_colors()) {
logmsg("...using %d colors", pics->colors);
for (n = 0; n < pics->colors; ++n) {
- my_pair = (n + 1);
- my_color = map_color(fg_color(pics, n));
+ int my_pair = (n + 1);
+ int my_color = map_color(fg_color(pics, n));
#if USE_EXTENDED_COLORS
if (use_extended_pairs) {
init_extended_pair(my_pair, my_color, my_color);
#if USE_EXTENDED_COLORS
if (use_extended_pairs) {
init_extended_pair(my_pair, my_color, my_color);
if (y >= LINES)
break;
move(y, 0);
if (y >= LINES)
break;
move(y, 0);
for (x = 0; x < pics->wide; ++x) {
for (x = 0; x < pics->wide; ++x) {
if (x >= COLS)
break;
n = (y * pics->wide + x);
if (x >= COLS)
break;
n = (y * pics->wide + x);
static void
report_colors(PICS_HEAD * pics)
{
static void
report_colors(PICS_HEAD * pics)
{
- int j, k;
- int high;
- int wide = 4;
int shift;
int total;
char buffer[256];
int shift;
int total;
char buffer[256];
*/
if (debugging && (pics->colors < 1000)) {
int digits = 0;
*/
if (debugging && (pics->colors < 1000)) {
int digits = 0;
+ int high;
+ int wide = 4;
for (j = pics->colors; j != 0; j /= 10) {
++digits;
if (j < 10)
for (j = pics->colors; j != 0; j /= 10) {
++digits;
if (j < 10)
logmsg("These colors were used:");
high = (pics->colors + wide - 1) / wide;
for (j = 0; j < high && j < pics->colors; ++j) {
logmsg("These colors were used:");
high = (pics->colors + wide - 1) / wide;
for (j = 0; j < high && j < pics->colors; ++j) {
char *s = buffer;
*s = '\0';
for (k = 0; k < wide; ++k) {
char *s = buffer;
*s = '\0';
for (k = 0; k < wide; ++k) {
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2000-2013,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 2000-2017,2019 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 *
/*
* Author: Thomas E. Dickey - 2000
*
/*
* Author: Thomas E. Dickey - 2000
*
- * $Id: railroad.c,v 1.22 2017/09/30 17:55:22 tom Exp $
+ * $Id: railroad.c,v 1.23 2019/08/24 23:11:01 tom Exp $
*
* A simple demo of the termcap interface.
*/
*
* A simple demo of the termcap interface.
*/
ShowSign(char *string)
{
char *base = string;
ShowSign(char *string)
{
char *base = string;
if (moveit != 0) {
tputs(tgoto(moveit, 0, height - 1), 1, outc);
if (moveit != 0) {
tputs(tgoto(moveit, 0, height - 1), 1, outc);
if (ch != ' ') {
if (moveit != 0) {
for (first = length - 2; first >= (string - base); first--) {
if (ch != ' ') {
if (moveit != 0) {
for (first = length - 2; first >= (string - base); first--) {