// Debug stuff
#include "standard.h"

FILE * db;
char err_out[] = "KCON:////DEBUG";
static BOOL debug;

initialise_debug(BOOL debug_arg)
 {
  debug = debug_arg;
  if(!debug)
	return;

  if((db=fopen(err_out,"w")) == NULL) 
	{
	fprintf(stderr,"ERROR Debug option failed."
			" Do you have KCON installed?");
	debug=FALSE;
	return;
	}

  REM("Debug On");
 }

close_debug()
 {
  if(debug)
	fclose(db);
 }

dbug(char * msg, int line,char * file)
 {
  static int i = 1;
  char text[256];
  if(!debug)
        return;

  fprintf(db,"DEBUG %3d\t%s\n",i,msg);
  fprintf(db,"\tLine: %d  \tFile: %s\n\n%",line,file);
  fflush(db);i++;
 }

dwait()
 {
  if(!debug)
	return;

  REM("** pause: press return **");
  getchar();
 }
