Detabbed
[AROS.git] / rom / dos / vprintf.c
blob54317e5cac4d819f3794c66080545c3b63b908a7
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <aros/debug.h>
10 #include <proto/exec.h>
11 #include <dos/dos.h>
12 #include <aros/asmcall.h>
13 #include "dos_intern.h"
15 AROS_UFP2(void, vfp_hook,
16 AROS_UFPA(UBYTE, chr, D0),
17 AROS_UFPA(struct vfp *, vfp, A3)
20 /*****************************************************************************
22 NAME */
23 #include <proto/dos.h>
25 AROS_LH2(LONG, VPrintf,
27 /* SYNOPSIS */
28 AROS_LHA(CONST_STRPTR, format, D1),
29 AROS_LHA(IPTR *, argarray, D2),
31 /* LOCATION */
32 struct DosLibrary *, DOSBase, 159, Dos)
34 /* FUNCTION
35 Writes a formatted string to standard output.
37 INPUTS
38 format - RawDoFmt like format string
39 argarray - Pointer to array of formatting values
41 RESULT
42 Number of bytes written or -1 for an error
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 struct vfp vfp;
59 struct Process *me = (struct Process *)FindTask(NULL);
60 BPTR file;
62 ASSERT_VALID_PROCESS(me);
64 file = me->pr_COS;
66 vfp.file = file;
67 vfp.count = 0;
68 vfp.DOSBase = DOSBase;
70 (void)RawDoFmt(format, argarray,
71 (VOID_FUNC)AROS_ASMSYMNAME(vfp_hook), &vfp);
73 /* Remove the last character (which is a NUL character) */
75 if (vfp.count > 0)
77 vfp.count--;
78 ((struct FileHandle *)BADDR(file))->fh_Pos--;
82 return vfp.count;
83 AROS_LIBFUNC_EXIT
84 } /* VPrintf */