]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/dots_mvcur.c
ncurses 5.7 - patch 20100116
[ncurses.git] / test / dots_mvcur.c
index f02302382fc654be2b27780144e6c46e053115a7..611964c1eae823279eb412acefcba70218179970 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2008,2009 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 - 2007
  *
- * $Id: dots_mvcur.c,v 1.2 2008/02/09 18:08:57 tom Exp $
+ * $Id: dots_mvcur.c,v 1.4 2009/10/10 16:14:24 tom Exp $
  *
  * A simple demo of the terminfo interface, and mvcur.
  */
@@ -49,13 +49,17 @@ 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);
+       if (putc(c, stdout) == EOF)
+           rc = EOF;
     }
-    return 0;
+    return rc;
 }
 
 static bool