/*
* Author: Thomas E. Dickey - 2000
*
- * $Id: railroad.c,v 1.18 2009/10/10 16:14:42 tom Exp $
+ * $Id: railroad.c,v 1.20 2011/04/23 19:15:04 tom Exp $
*
* A simple demo of the termcap interface.
*/
static bool interrupted = FALSE;
-static int
-outc(TPUTS_ARG c)
+static
+TPUTS_PROTO(outc, c)
{
+ int rc = OK;
+
if (interrupted) {
char tmp = (char) c;
- write(STDOUT_FILENO, &tmp, 1);
+ if (write(STDOUT_FILENO, &tmp, 1) == -1)
+ rc = ERR;
} else {
- putc(c, stdout);
+ if (putc(c, stdout) == EOF)
+ rc = ERR;
}
- return 0;
+ TPUTS_RETURN(rc);
}
static void