Skip to content

Commit

Permalink
'show_col.c' now also tests insstr() (see commit 3f8dfa9; I tried it …
Browse files Browse the repository at this point in the history
…with a smaller MAX_WSTR in winsnstr() to verify that overflow was properly handled). Also fixed prototype for main() (see preceding commit 9ce8d3c).
  • Loading branch information
Bill-Gray committed Jun 19, 2024
1 parent 9ce8d3c commit 18ef78d
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/show_col.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
#include <curses.h>
#include <stdlib.h>
#include <locale.h>

/* Small test program to show default color table, then to test
the ability of printw() to handle longer strings */
the ability of printw() to handle longer strings, then to check
insstr(). */

int main( void)
#define INTENTIONALLY_UNUSED_PARAMETER( param) (void)(param)

int main( const int argc, const char **argv)
{
int i;
SCREEN *screen_pointer = newterm(NULL, stdout, stdin);
SCREEN *screen_pointer;
char *buff = (char *)malloc( 1001);
#ifdef WACS_S1
const char *russian = "январь февраль март апрель май июнь июль август сентябрь";
const char *caption = "^ Names of some months in Russian should be inserted here ^";

if( !setlocale( LC_CTYPE, "C.UTF-8"))
setlocale( LC_CTYPE, "en_US.utf8");
#endif
INTENTIONALLY_UNUSED_PARAMETER( argc);
INTENTIONALLY_UNUSED_PARAMETER( argv);
screen_pointer = newterm(NULL, stdout, stdin);
noecho();
start_color();
for( i = 0; i < COLORS && i < LINES * (COLS / 7); i++)
Expand All @@ -28,6 +41,12 @@ int main( void)
free( buff);
printw( "\n Return value : %d (should be 1000) ", i);
getch( );
#ifdef WACS_S1
color_set( 1, NULL);
mvinsstr( 0, 10, russian);
mvinsstr( 1, 10, caption);
getch( );
#endif
endwin( );
/* Not really needed, but ensures Valgrind */
delscreen( screen_pointer); /* says all memory was freed */
Expand Down

0 comments on commit 18ef78d

Please sign in to comment.