Detabbed
[AROS.git] / rom / dos / vfprintf.c
blob9ba719a89e81d5d3c43cc5a1b18e2f4681b80a65
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include <dos/dosextens.h>
10 #include <proto/dos.h>
11 #include <aros/asmcall.h>
12 #include "dos_intern.h"
14 AROS_UFH2(void,vfp_hook,
15 AROS_UFHA(UBYTE, chr, D0),
16 AROS_UFHA(struct vfp *, vfp, A3))
18 AROS_USERFUNC_INIT
20 struct DosLibrary *DOSBase = vfp->DOSBase;
22 if (vfp->count >= 0 && chr != '\0')
24 if (FPutC(vfp->file, chr) < 0)
26 vfp->count = -1;
28 return;
31 vfp->count++;
34 AROS_USERFUNC_EXIT
37 /*****************************************************************************
39 NAME */
40 #include <proto/dos.h>
42 AROS_LH3(LONG, VFPrintf,
44 /* SYNOPSIS */
45 AROS_LHA(BPTR, file, D1),
46 AROS_LHA(CONST_STRPTR, format, D2),
47 AROS_LHA(const IPTR *, argarray, D3),
49 /* LOCATION */
50 struct DosLibrary *, DOSBase, 59, Dos)
52 /* FUNCTION
53 Write a formatted (RawDoFmt) string to a specified file (buffered).
55 INPUTS
56 file - Filehandle to write to
57 format - RawDoFmt() style formatting string
58 argarray - Pointer to array of formatting values
60 RESULT
61 Number of bytes written or -1 for an error
63 NOTES
65 EXAMPLE
67 BUGS
69 SEE ALSO
71 INTERNALS
73 *****************************************************************************/
75 AROS_LIBFUNC_INIT
77 struct vfp vfp;
79 vfp.file = file;
80 vfp.count = 0;
81 vfp.DOSBase = DOSBase;
83 (void)RawDoFmt(format, (APTR)argarray,
84 (VOID_FUNC)AROS_ASMSYMNAME(vfp_hook), &vfp);
86 /* Remove the last character (which is a NUL character) */
88 if (vfp.count > 0)
90 vfp.count--;
91 ((struct FileHandle *)BADDR(file))->fh_Pos--;
95 return vfp.count;
97 AROS_LIBFUNC_EXIT
98 } /* VFPrintf */