]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/echochar.c
ncurses 5.6 - patch 20080203
[ncurses.git] / test / echochar.c
index 9f2d11c5bb9476796ac87a67c2f43ba0e0cbd535..a8203821075b8c0b8d53c29b9296355f04acbd1e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2006 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2006,2007 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            *
  *                                                                          *
  * 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.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: echochar.c,v 1.3 2006/12/03 00:14:29 tom Exp $
+ * $Id: echochar.c,v 1.5 2007/07/21 17:41:55 tom Exp $
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
@@ -89,7 +89,7 @@ main(
     int last_fg = 0;
     int last_bg = 0;
 
     int last_fg = 0;
     int last_bg = 0;
 
-    while ((ch = getopt(argc, argv, "r")) != EOF) {
+    while ((ch = getopt(argc, argv, "r")) != -1) {
        switch (ch) {
        case 'r':
            opt_r = TRUE;
        switch (ch) {
        case 'r':
            opt_r = TRUE;
@@ -107,7 +107,7 @@ main(
     if (use_colors) {
        start_color();
        if (COLOR_PAIRS > 0) {
     if (use_colors) {
        start_color();
        if (COLOR_PAIRS > 0) {
-           my_pairs = calloc(COLOR_PAIRS, sizeof(*my_pairs));
+           my_pairs = calloc((unsigned) COLOR_PAIRS, sizeof(*my_pairs));
        }
        use_colors = (my_pairs != 0);
     }
        }
        use_colors = (my_pairs != 0);
     }
@@ -146,10 +146,10 @@ main(
            }
        }
        if (opt_r) {
            }
        }
        if (opt_r) {
-           addch(p);
+           addch(UChar(p));
            refresh();
        } else {
            refresh();
        } else {
-           echochar(p);
+           echochar(UChar(p));
        }
        ++total_chars;
     }
        }
        ++total_chars;
     }