/* ======================================================================== */
/* = Programmname    : SimpleOp_Subs V11.3                                = */
/* =                                                                      = */
/* ======================================================================== */
/* = Autor/Copyright : (c) 1990-95 by Andreas Ralph Kleinert.             = */
/* =                   All rights reserved.                               = */
/* ======================================================================== */
/* = Funktion        : Sub-Routines for SimpleOp V11.3                    = */
/* =                                                                      = */
/* ======================================================================== */
/* = Compiler        : SAS/C V6.55                                        = */
/* =                                                                      = */
/* ======================================================================== */

#include <dos.h> /* to prevent multiple inclusion, include this at FIRST ! */

#include <exec/types.h>
#include <exec/memory.h>

#include <proto/exec.h>
#include <proto/dos.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define N (NULL) /* as usual */


void __stdargs K_Printf(char *formatstring, ...);


/* *************************************************** */
/* *                                                 * */
/* * K_Printf : Replacement for printf()-Output      * */
/* *                                                 * */
/* *************************************************** */

#define KIP_BUFLEN (1200)

extern void Fmt(void);

void __stdargs K_Printf(char *formatstring, ...)
{
 UBYTE *buffer;

 if(!Output()) return;

 buffer = (UBYTE *) AllocMem(KIP_BUFLEN, MEMF_CLEAR|MEMF_PUBLIC);
 if(buffer)
  {
   RawDoFmt((APTR) formatstring, (APTR) (((ULONG *)&formatstring)+1), (APTR) &Fmt, (APTR) buffer);

   Write(Output(), buffer, strlen(buffer));

   FreeMem(buffer, KIP_BUFLEN);
  }
}
