compiler/clib: Removed unused arosc_init.h file.
[AROS.git] / compiler / clib / vfprintf.c
blob13f1ad3f73d6a59eb04fa6fb500a2a8f3c007886
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Format a string and call a usercallback to output each char.
6 */
7 /* Original source from libnix */
10 #include <proto/dos.h>
11 #include <errno.h>
12 #include "__fdesc.h"
14 static int __putc(int c, void *fh);
16 /*****************************************************************************
18 NAME */
19 #include <stdio.h>
20 #include <stdarg.h>
22 int vfprintf (
24 /* SYNOPSIS */
25 FILE * stream,
26 const char * format,
27 va_list args)
29 /* FUNCTION
30 Format a list of arguments and print them on the specified stream.
32 INPUTS
33 stream - A stream on which one can write
34 format - A printf() format string.
35 args - A list of arguments for the format string.
37 RESULT
38 The number of characters written.
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 ******************************************************************************/
52 fdesc *fdesc = __getfdesc(stream->fd);
54 if (!fdesc)
56 errno = EBADF;
57 return 0;
60 return __vcformat ((void *)BADDR(fdesc->fcb->fh), __putc, format, args);
61 } /* vfprintf */
64 static int __putc(int c, void *fhp)
66 BPTR fh = MKBADDR(fhp);
67 if (FPutC(fh, c) == EOF)
69 errno = __arosc_ioerr2errno(IoErr());
70 return EOF;
73 return c;