]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/dots.c
ncurses 5.7 - patch 20100731
[ncurses.git] / test / dots.c
index 2d6471853e08f7daaba00b2c9dce745e76288e73..1fdcff95e101de85835ad7b067c054af2bba5cf2 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1999-2009,2010 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 <dickey@clark.net> 1999
  *
- * $Id: dots.c,v 1.17 2008/02/09 18:08:50 tom Exp $
+ * $Id: dots.c,v 1.20 2010/05/01 22:04:08 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
@@ -49,13 +49,16 @@ static time_t started;
 static int
 outc(TPUTS_ARG c)
 {
+    int rc = c;
+
     if (interrupted) {
-       char tmp = c;
-       write(STDOUT_FILENO, &tmp, 1);
+       char tmp = (char) c;
+       if (write(STDOUT_FILENO, &tmp, 1) == -1)
+           rc = EOF;
     } else {
-       putc(c, stdout);
+       rc = putc(c, stdout);
     }
-    return 0;
+    return rc;
 }
 
 static bool