added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / all-unix / exec / rawputchar.c
blob571066827b4c641c8950905fd0a2cc75867a4b1a
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Emit one character via raw IO
6 Lang: english
7 */
8 #include <unistd.h>
10 /*****i***********************************************************************
12 NAME */
13 #include <proto/exec.h>
15 AROS_LH1(void, RawPutChar,
17 /* SYNOPSIS */
18 AROS_LHA(UBYTE, chr, D0),
20 /* LOCATION */
21 struct ExecBase *, SysBase, 86, Exec)
23 /* FUNCTION
24 Emits a single character.
26 INPUTS
27 chr - The character to emit
29 RESULT
30 None.
32 NOTES
33 This function is for very low level debugging only.
35 EXAMPLE
37 BUGS
39 SEE ALSO
40 RawIOInit(), RawPutChar(), RawMayGetChar()
42 INTERNALS
44 HISTORY
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
50 /* Don't write 0 bytes */
51 if (chr)
53 /* Write char to stderr */
54 write (STDERR_FILENO, &chr, 1);
56 /* Make sure it makes it to the user. Slow but save.
57 On Linux this gives an error (stderr is already unbuffered) */
58 #if !(defined(__linux__) || defined(__FreeBSD__))
59 fsync (STDERR_FILENO);
60 #endif
63 AROS_LIBFUNC_EXIT
64 } /* RawPutChar */