some fixes to accented characters
[tangerine.git] / rom / dos / vfprintf.c
blobf893d3a28664d7247d1bafdef9239e20fd1ae74d
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 <dos/filesystem.h>
11 #include <proto/dos.h>
12 #include <aros/asmcall.h>
13 #include "dos_intern.h"
15 AROS_UFH2(void,vfp_hook,
16 AROS_UFHA(UBYTE, chr, D0),
17 AROS_UFHA(struct vfp *, vfp, A3))
19 AROS_USERFUNC_INIT
21 struct DosLibrary *DOSBase = vfp->DOSBase;
23 if (vfp->count >= 0 && chr != '\0')
25 if (FPutC(vfp->file, chr) < 0)
27 vfp->count = -1;
29 return;
32 vfp->count++;
35 AROS_USERFUNC_EXIT
38 /*****************************************************************************
40 NAME */
41 #include <proto/dos.h>
43 AROS_LH3(LONG, VFPrintf,
45 /* SYNOPSIS */
46 AROS_LHA(BPTR, file, D1),
47 AROS_LHA(CONST_STRPTR, format, D2),
48 AROS_LHA(const IPTR *, argarray, D3),
50 /* LOCATION */
51 struct DosLibrary *, DOSBase, 59, Dos)
53 /* FUNCTION
54 Write a formatted (RawDoFmt) string to a specified file (buffered).
56 INPUTS
57 file - Filehandle to write to
58 format - RawDoFmt() style formatting string
59 argarray - Pointer to array of formatting values
61 RESULT
62 Number of bytes written or -1 for an error
64 NOTES
66 EXAMPLE
68 BUGS
70 SEE ALSO
72 INTERNALS
74 *****************************************************************************/
76 AROS_LIBFUNC_INIT
78 struct vfp vfp;
80 vfp.file = file;
81 vfp.count = 0;
82 vfp.DOSBase = DOSBase;
84 (void)RawDoFmt(format, argarray,
85 (VOID_FUNC)AROS_ASMSYMNAME(vfp_hook), &vfp);
87 /* Remove the last character (which is a NUL character) */
89 if (vfp.count > 0)
91 vfp.count--;
92 ((struct FileHandle *)BADDR(file))->fh_Pos--;
96 return vfp.count;
98 AROS_LIBFUNC_EXIT
99 } /* VFPrintf */