/*
* Author: Thomas E. Dickey
*
- * $Id: demo_terminfo.c,v 1.45 2017/03/18 22:03:07 tom Exp $
+ * $Id: demo_terminfo.c,v 1.48 2017/11/24 20:49:11 tom Exp $
*
* A simple demo of the terminfo interface.
*/
static bool n_opt = FALSE;
static bool q_opt = FALSE;
static bool s_opt = FALSE;
+#ifdef NCURSES_VERSION
static bool x_opt = FALSE;
static bool y_opt = FALSE;
+#endif
static char *d_opt;
static char *e_opt;
return result;
}
-#ifdef NO_LEAKS
+#if NO_LEAKS
static void
free_dblist(void)
{
return result;
}
+
+#if NO_LEAKS
+static void
+free_code_list(char **list)
+{
+ if (list) {
+ free(list[0]);
+ free(list);
+ }
+}
#endif
+#endif /* USE_CODE_LISTS */
static void
usage(void)
PLURAL(total_n_values),
PLURAL(total_s_values));
-#ifdef NO_LEAKS
+#if NO_LEAKS
free_dblist();
- if (my_blob != 0) {
- free(my_blob);
- free(my_boolcodes);
- free(my_numcodes);
- free(my_numvalues);
- free(my_strcodes);
- free(my_strvalues);
+ if (input_name != 0) {
+ if (my_blob != 0) {
+ free(my_blob);
+ free(my_boolcodes);
+ free(my_numcodes);
+ free(my_numvalues);
+ free(my_strcodes);
+ free(my_strvalues);
+ }
+ }
+#if USE_CODE_LISTS
+ else {
+ free_code_list(my_boolcodes);
+ free_code_list(my_numcodes);
+ free_code_list(my_strcodes);
}
#endif
+#endif /* NO_LEAKS */
ExitProgram(EXIT_SUCCESS);
}