]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_terminfo.c
ncurses 6.0 - patch 20160206
[ncurses.git] / test / demo_terminfo.c
index b4466168fa6dc0710f354608bbd6fb0e0c8ae408..5a5631db7b9ad62b25197af3e746c48a089a2e5e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009-2013,2014 Free Software Foundation, Inc.              *
+ * Copyright (c) 2009-2014,2015 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            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_terminfo.c,v 1.37 2014/09/05 08:44:49 tom Exp $
+ * $Id: demo_terminfo.c,v 1.40 2015/10/10 20:52:41 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
@@ -46,6 +46,8 @@
 #endif
 #endif
 
+static void failed(const char *) GCC_NORETURN;
+
 static void
 failed(const char *msg)
 {
@@ -266,6 +268,10 @@ abcdefghijklmnopqrstuvwxyz_";
     if (!q_opt)
        printf("Terminal type \"%s\"\n", name);
     setupterm((NCURSES_CONST char *) name, 1, (int *) 0);
+    if (!q_opt) {
+       if (strcmp(name, ttytype))
+           printf("... actual \"%s\"\n", ttytype);
+    }
 
     for (length = 1; length <= MAX_FORCE; ++length) {
        /* set all digits to zeros */
@@ -453,6 +459,7 @@ parse_description(const char *input_name)
     if ((fp = fopen(input_name, "r")) == 0)
        failed("cannot open input-file");
     len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
+    my_blob[sb.st_size] = '\0';
     fclose(fp);
 
     /*
@@ -909,7 +916,7 @@ main(int argc, char *argv[])
 int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
-    printf("This program requires the terminfo functions such as tigetstr\n");
+    failed("This program requires the terminfo functions such as tigetstr");
     ExitProgram(EXIT_FAILURE);
 }
 #endif /* HAVE_TIGETSTR */