X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;ds=sidebyside;f=test%2Fncurses.c;h=f50530ab63723e9b134ede62433829412f34921b;hb=ee8861cb4901d33fef9ad228b55a60ca4950e79c;hp=8ec2ba0eea366dd5094aba643e727a39d8d666c0;hpb=efa78d11c3ea7f51c7078b64a34c98b44ecb0e1a;p=ncurses.git diff --git a/test/ncurses.c b/test/ncurses.c index 8ec2ba0e..f50530ab 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 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 * @@ -40,7 +41,7 @@ AUTHOR Author: Eric S. Raymond 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.523 2020/08/29 16:22:03 juergen Exp $ ***************************************************************************/ @@ -210,7 +211,7 @@ wGetchar(WINDOW *win) } else { _nc_tracing = save_trace; } - trace(_nc_tracing); + curses_trace(_nc_tracing); if (_nc_tracing) Trace(("TOGGLE-TRACING ON")); } @@ -344,7 +345,7 @@ wGet_wchar(WINDOW *win, wint_t *result) } else { _nc_tracing = save_trace; } - trace(_nc_tracing); + curses_trace(_nc_tracing); if (_nc_tracing) Trace(("TOGGLE-TRACING ON")); } @@ -489,7 +490,7 @@ ShellOut(bool message) addstr("Shelling out..."); def_prog_mode(); endwin(); -#ifdef _WIN32 +#ifdef _NC_WINDOWS system("cmd.exe"); #else IGNORE_RC(system("sh")); @@ -3734,7 +3735,6 @@ show_box_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) 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 @@ -4282,7 +4282,6 @@ show_wbox_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) (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 @@ -4355,7 +4354,6 @@ show_utf8_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair) 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 */ @@ -6222,10 +6220,10 @@ static char * tracetrace(unsigned tlevel) { static char *buf; + static size_t need = 12; int n; if (buf == 0) { - 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); @@ -6345,7 +6343,7 @@ trace_set(bool recur GCC_UNUSED) 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, @@ -7332,7 +7330,7 @@ overlap_test(bool recur GCC_UNUSED) delwin(win2); delwin(win1); erase(); - exit_curses(); + stop_curses(); return OK; } @@ -7532,7 +7530,7 @@ x_overlap_test(bool recur GCC_UNUSED) delwin(win2); delwin(win1); erase(); - exit_curses(); + stop_curses(); return OK; } #endif /* USE_WIDEC_SUPPORT */ @@ -7620,9 +7618,11 @@ settings_test(bool recur GCC_UNUSED) #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; } @@ -7661,7 +7661,7 @@ usage(void) #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 @@ -7787,8 +7787,7 @@ main_menu(bool top) int (*doit) (bool); char command; - unsigned n; - + unsigned n; do { printf("This is the ncurses main menu (uppercase for wide-characters)\n"); for (n = 0; n < SIZEOF(cmds); ++n) { @@ -7815,11 +7814,13 @@ main_menu(bool top) 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))) { @@ -7962,7 +7963,7 @@ main(int argc, char *argv[]) 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; @@ -7990,10 +7991,10 @@ main(int argc, char *argv[]) #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 */