Revised several variables and deleted unused variables.
[AROS.git] / compiler / posixc / vfprintf.c
blobc741243871db454e95fe9ebe39997d877acf353d
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function vfprintf()
6 */
7 /* Original source from libnix */
10 #include <proto/dos.h>
11 #include <errno.h>
12 #include <stdarg.h>
13 #include "__fdesc.h"
14 #include "__stdio.h"
16 static int __putc(int c, void *fh);
18 /*****************************************************************************
20 NAME */
21 #include <stdio.h>
23 int vfprintf (
25 /* SYNOPSIS */
26 FILE * stream,
27 const char * format,
28 va_list args)
30 /* FUNCTION
31 Format a list of arguments and print them on the specified stream.
33 INPUTS
34 stream - A stream on which one can write
35 format - A printf() format string.
36 args - A list of arguments for the format string.
38 RESULT
39 The number of characters written.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 ******************************************************************************/
53 fdesc *fdesc = __getfdesc(stream->fd);
55 if (!fdesc)
57 errno = EBADF;
58 return 0;
61 return __vcformat ((void *)BADDR(fdesc->fcb->handle), __putc, format, args);
62 } /* vfprintf */
65 static int __putc(int c, void *fhp)
67 BPTR fh = MKBADDR(fhp);
68 if (FPutC(fh, c) == EOF)
70 errno = __stdc_ioerr2errno(IoErr());
71 return EOF;
74 return c;