home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / vfprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.5 KB  |  122 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: vfprintf.c,v 1.8 1997/01/27 00:36:33 ldp Exp $
  4.     $Log: vfprintf.c,v $
  5.     Revision 1.8  1997/01/27 00:36:33  ldp
  6.     Polish
  7.  
  8.     Revision 1.7  1996/12/09 13:53:49  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.6  1996/11/18 13:20:14  aros
  14.     Compile assembler files with CPP
  15.  
  16.     New macros: AROS_ASMSYMNAME() (replaces AROS_ASMFUNC_NAME()) and
  17.     AROS_CSYMNAME() which must be used to access assembler symbols from C and C
  18.     symbols from assembler.
  19.  
  20.     Revision 1.5  1996/10/24 15:50:38  aros
  21.     Use the official AROS macros over the __AROS versions.
  22.  
  23.     Revision 1.4  1996/09/13 17:50:09  digulla
  24.     Use IPTR
  25.  
  26.     Revision 1.3  1996/08/13 13:52:52  digulla
  27.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  28.     Replaced AROS_LA by AROS_LHA
  29.  
  30.     Revision 1.2  1996/08/01 17:40:59  digulla
  31.     Added standard header for all files
  32.  
  33.     Desc:
  34.     Lang: english
  35. */
  36. #include <proto/exec.h>
  37. #include <dos/dosextens.h>
  38. #include <dos/filesystem.h>
  39. #include <proto/dos.h>
  40. #include <aros/asmcall.h>
  41. #include "dos_intern.h"
  42.  
  43. AROS_UFH2(void,vfp_hook,
  44.     AROS_UFHA(UBYTE,        chr, D0),
  45.     AROS_UFHA(struct vfp *, vfp, A3)
  46. )
  47. {
  48.     AROS_LIBFUNC_INIT
  49.     extern struct DosLibrary *DOSBase;
  50.     if(vfp->count>=0)
  51.     {
  52.     if(FPUTC(vfp->file,chr)<0)
  53.     {
  54.         vfp->count=-1;
  55.         return;
  56.     }
  57.     vfp->count++;
  58.     }
  59.     AROS_LIBFUNC_EXIT
  60. }
  61.  
  62. /*****************************************************************************
  63.  
  64.     NAME */
  65. #include <proto/dos.h>
  66.  
  67.     AROS_LH3(LONG, VFPrintf,
  68.  
  69. /*  SYNOPSIS */
  70.     AROS_LHA(BPTR,   file,     D1),
  71.     AROS_LHA(STRPTR, format,   D2),
  72.     AROS_LHA(IPTR *, argarray, D3),
  73.  
  74. /*  LOCATION */
  75.     struct DosLibrary *, DOSBase, 59, Dos)
  76.  
  77. /*  FUNCTION
  78.  
  79.     INPUTS
  80.  
  81.     RESULT
  82.  
  83.     NOTES
  84.  
  85.     EXAMPLE
  86.  
  87.     BUGS
  88.  
  89.     SEE ALSO
  90.  
  91.     INTERNALS
  92.  
  93.     HISTORY
  94.     29-10-95    digulla automatically created from
  95.                 dos_lib.fd and clib/dos_protos.h
  96.  
  97. *****************************************************************************/
  98. {
  99.     AROS_LIBFUNC_INIT
  100.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  101.  
  102.     struct vfp vfp;
  103.  
  104.     vfp.file=file;
  105.     vfp.count=0;
  106.  
  107.     (void) RawDoFmt (format,
  108.     argarray,
  109.     (VOID_FUNC)AROS_ASMSYMNAME(vfp_hook),
  110.     &vfp
  111.     );
  112.  
  113.     /* Remove the last character (which is a NUL character) */
  114.     if(vfp.count>0)
  115.     {
  116.     vfp.count--;
  117.     ((struct FileHandle *)BADDR(file))->fh_Pos--;
  118.     }
  119.     return vfp.count;
  120.     AROS_LIBFUNC_EXIT
  121. } /* VFPrintf */
  122.