Commit of the code which was suggested by Georg as a fix for:
[cake.git] / rom / dos / vprintf.c
blobfd6cd7e0ea029b083bff37423ebe7c3a4231caf4
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <proto/exec.h>
10 #include <dos/dos.h>
11 #include <aros/asmcall.h>
12 #include "dos_intern.h"
14 AROS_UFP2(void, vfp_hook,
15 AROS_UFPA(UBYTE, chr, D0),
16 AROS_UFPA(struct vfp *, vfp, A3)
19 /*****************************************************************************
21 NAME */
22 #include <proto/dos.h>
24 AROS_LH2(LONG, VPrintf,
26 /* SYNOPSIS */
27 AROS_LHA(CONST_STRPTR, format, D1),
28 AROS_LHA(IPTR *, argarray, D2),
30 /* LOCATION */
31 struct DosLibrary *, DOSBase, 159, Dos)
33 /* FUNCTION
35 INPUTS
37 RESULT
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 struct vfp vfp;
54 BPTR file = ((struct Process *)FindTask(NULL))->pr_COS;
56 vfp.file = file;
57 vfp.count = 0;
58 vfp.DOSBase = DOSBase;
60 (void)RawDoFmt(format, argarray,
61 (VOID_FUNC)AROS_ASMSYMNAME(vfp_hook), &vfp);
63 /* Remove the last character (which is a NUL character) */
65 if (vfp.count > 0)
67 vfp.count--;
68 ((struct FileHandle *)BADDR(file))->fh_Pos--;
72 return vfp.count;
73 AROS_LIBFUNC_EXIT
74 } /* VPrintf */