]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/pair_content.c
ncurses 6.3 - patch 20220521
[ncurses.git] / test / pair_content.c
index 1c9e2ab91ebfe750b981abcd808a78e88d0e9dca..35e2fc4b44bde72233652c0191d3c2fc4630dfb2 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2018,2019 Free Software Foundation, Inc.                   *
+ * Copyright 2018-2020,2022 Thomas E. Dickey                                *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: pair_content.c,v 1.12 2019/01/21 01:05:22 tom Exp $
+ * $Id: pair_content.c,v 1.16 2022/05/15 15:46:28 tom Exp $
  */
 
 #define NEED_TIME_H
@@ -62,13 +62,20 @@ static struct timeval initial_time;
 static struct timeval finish_time;
 #endif
 
+static void
+finish(int code)
+{
+    free(expected);
+    ExitProgram(code);
+}
+
 static void
 failed(const char *msg)
 {
     printw("%s", msg);
     getch();
     endwin();
-    ExitProgram(EXIT_FAILURE);
+    finish(EXIT_FAILURE);
 }
 
 #if USE_EXTENDED_COLOR
@@ -115,6 +122,7 @@ random_color(void)
 static void
 setup_test(void)
 {
+    setlocale(LC_ALL, "");
     initscr();
     cbreak();
     noecho();
@@ -230,14 +238,13 @@ usage(void)
     size_t n;
     for (n = 0; n < SIZEOF(msg); n++)
        fprintf(stderr, "%s\n", msg[n]);
-    ExitProgram(EXIT_FAILURE);
+    finish(EXIT_FAILURE);
 }
 
 int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     int i;
-    int repeat;
 
     while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) {
        switch (i) {
@@ -291,6 +298,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
            }
        }
     } else {
+       int repeat;
 
        for (repeat = 0; repeat < r_opt; ++repeat) {
            run_test();
@@ -313,5 +321,5 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
        finish_test();
     }
 
-    ExitProgram(EXIT_SUCCESS);
+    finish(EXIT_SUCCESS);
 }