/****************************************************************************
- * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. *
+ * Copyright 2018-2020,2021 Thomas E. Dickey *
+ * Copyright 1998-2016,2017 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 *
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.517 2019/08/24 23:09:03 tom Exp $
+$Id: ncurses.c,v 1.527 2021/09/04 10:31:03 tom Exp $
***************************************************************************/
#endif
static void main_menu(bool);
-static void failed(const char *s) GCC_NORETURN;
+static GCC_NORETURN void failed(const char *s);
static void
failed(const char *s)
} else {
_nc_tracing = save_trace;
}
- trace(_nc_tracing);
+ curses_trace(_nc_tracing);
if (_nc_tracing)
Trace(("TOGGLE-TRACING ON"));
}
} else {
_nc_tracing = save_trace;
}
- trace(_nc_tracing);
+ curses_trace(_nc_tracing);
if (_nc_tracing)
Trace(("TOGGLE-TRACING ON"));
}
addstr("Shelling out...");
def_prog_mode();
endwin();
-#ifdef _WIN32
+#ifdef _NC_WINDOWS
system("cmd.exe");
#else
IGNORE_RC(system("sh"));
setup_getch(win, flags);
wgetch_help(win, flags);
} else if (c == 'g') {
- waddstr(win, "getstr test: ");
+ waddstr(win, "wgetnstr test: ");
echo();
c = wgetnstr(win, buf, sizeof(buf) - 1);
noecho();
setup_getch(win, flags);
wgetch_help(win, flags);
} else if (c == 'g') {
- waddstr(win, "getstr test: ");
+ waddstr(win, "wgetn_str test: ");
echo();
code = wgetn_wstr(win, wint_buf, BUFSIZ - 1);
noecho();
MvAddCh(LINES / 2, 0, colored_chtype(ACS_LTEE, attr, pair));
MvAddCh(LINES / 2, COLS - 1, colored_chtype(ACS_RTEE, attr, pair));
/* *INDENT-ON* */
-
}
static int
(void) mvadd_wch(LINES / 2, 0, MERGE_ATTR(0, WACS_LTEE));
(void) mvadd_wch(LINES / 2, COLS - 1, MERGE_ATTR(0, WACS_RTEE));
/* *INDENT-ON* */
-
}
#undef MERGE_ATTR
n = SHOW_UTF8(n, "WACS_S7", "\342\216\274");
(void) SHOW_UTF8(n, "WACS_S9", "\342\216\275");
/* *INDENT-ON* */
-
}
/* display the wide-ACS character set */
"Number repeats. Toggle legend:? filler:a timer:t scrollmark:s."
};
int n = ((int) SIZEOF(legend) - (LINES - line));
- if (n >= 0) {
+ if (n >= 0 && n < (int) SIZEOF(legend)) {
if (move(line, 0) != ERR) {
if (show_panner_legend)
printw("%s", legend[n]);
}
_nc_SPRINTF(buf, _nc_SLIMIT(need) "0x%02x = {", tlevel);
if (tlevel == 0) {
- _nc_STRCAT(buf, t_tbl[0].name, need);
+ _nc_STRCAT(buf, t_tbl[0].name ? t_tbl[0].name : "", need);
_nc_STRCAT(buf, ", ", need);
} else {
for (n = 1; t_tbl[n].name != 0; n++)
for (ip = menu_items(m); *ip; ip++)
if (item_value(*ip))
newtrace |= t_tbl[item_index(*ip)].mask;
- trace(newtrace);
+ curses_trace(newtrace);
Trace(("trace level interactively set to %s", tracetrace(_nc_tracing)));
MvPrintw(LINES - 2, 0,
overlap_test_0(win2, win1);
break;
- case 'c': /* fill window A so it's visible */
+ case 'c': /* fill window A so it is visible */
overlap_test_1(flavor[otBASE_fill], 0, win1, 'A');
break;
- case 'd': /* fill window B so it's visible */
+ case 'd': /* fill window B so it is visible */
overlap_test_1(flavor[otBASE_fill], 1, win2, 'B');
break;
delwin(win2);
delwin(win1);
erase();
- exit_curses();
+ stop_curses();
return OK;
}
overlap_test_0(win2, win1);
break;
- case 'c': /* fill window A so it's visible */
+ case 'c': /* fill window A so it is visible */
x_overlap_test_1(flavor[otBASE_fill], 0, win1, WIDE_A);
break;
- case 'd': /* fill window B so it's visible */
+ case 'd': /* fill window B so it is visible */
x_overlap_test_1(flavor[otBASE_fill], 1, win2, WIDE_B);
break;
delwin(win2);
delwin(win1);
erase();
- exit_curses();
+ stop_curses();
return OK;
}
#endif /* USE_WIDEC_SUPPORT */
#if HAVE_COLOR_CONTENT
show_boolean_setting("can_change_color", can_change_color());
#endif
+ show_setting_name("LINES");
+ printw("%d\n", LINES);
+ show_setting_name("COLS");
+ printw("%d\n", COLS);
Pause();
erase();
- exit_curses();
+ stop_curses();
return OK;
}
#if USE_LIBPANEL
," -s msec specify nominal time for panel-demo (default: 1, to hold)"
#endif
-#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_WIN32)
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_NC_WINDOWS)
," -T call use_tioctl(TRUE) to allow SIGWINCH to override environment"
#endif
#ifdef TRACE
int (*doit) (bool);
char command;
unsigned n;
-
do {
printf("This is the ncurses main menu (uppercase for wide-characters)\n");
for (n = 0; n < SIZEOF(cmds); ++n) {
for (;;) {
char ch = '\0';
if (read(fileno(stdin), &ch, (size_t) 1) <= 0) {
- if (command == 0)
- command = 'q';
- if (errno == EINTR) {
+ int save_err = errno;
+ perror("\nOOPS");
+ if (save_err == EINTR) {
clearerr(stdin);
continue;
+ } else if (command == 0) {
+ command = 'q';
}
break;
} else if (command == 0 && !isspace(UChar(ch))) {
if (doit != NULL && doit(FALSE) == OK) {
/*
- * This may be overkill; it's intended to reset everything back
+ * This may be overkill; it is intended to reset everything back
* to the initial terminal modes so that tests don't get in
* each other's way.
*/
nap_msec = (int) atol(optarg);
break;
#endif
-#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_WIN32)
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_NC_WINDOWS)
case 'T':
use_tioctl(TRUE);
break;
#ifdef TRACE
/* enable debugging */
#if !USE_LIBMENU
- trace(save_trace);
+ curses_trace(save_trace);
#else
if (!isatty(fileno(stdin)))
- trace(save_trace);
+ curses_trace(save_trace);
#endif /* USE_LIBMENU */
#endif /* TRACE */