Add altos platform
[fw/pdclib] / platform / altos / functions / _PDCLIB / flushbuffer.c
diff --git a/platform/altos/functions/_PDCLIB/flushbuffer.c b/platform/altos/functions/_PDCLIB/flushbuffer.c
new file mode 100644 (file)
index 0000000..2c54ce0
--- /dev/null
@@ -0,0 +1,52 @@
+/* $Id$ */
+
+/* _PDCLIB_flushbuffer( struct _PDCLIB_file_t * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is an example implementation of _PDCLIB_flushbuffer() fit for
+   use with POSIX kernels.
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+
+/* The number of attempts to complete an output buffer flushing before giving
+ *    up.
+ *    */
+#define _PDCLIB_IO_RETRIES 1
+
+/* What the system should do after an I/O operation did not succeed, before   */
+/* trying again. (Empty by default.)                                          */
+#define _PDCLIB_IO_RETRY_OP( stream )
+
+/* Must be provided by host system */
+extern void outbyte(char c);
+
+int _PDCLIB_flushbuffer( struct _PDCLIB_file_t * stream )
+{
+       char *c = stream->buffer;
+       int i = stream->bufidx;
+       while (i--)
+               outbyte(*c++);
+       return 0;
+}
+
+#endif
+
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by ftell.c */
+    return TEST_RESULTS;
+}
+
+#endif
+