source: golgotha/src/max_plugin/debug.cc @ 484

Last change on this file since 484 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.2 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include <string.h>
10#include <stdarg.h>
11#include "debug.hh"
12
13m1_debugfile dbg;
14
15m1_debugfile::m1_debugfile(char *_name)
16{
17  if (!_name)
18    _name = "c:\\tmp\\debug.out";
19  strcpy(name,_name);
20  f = fopen(name,"wt");
21}
22
23m1_debugfile::~m1_debugfile()
24{
25  if (f)
26    fclose(f);
27}
28
29void m1_debugfile::restart()
30{
31  if (f)
32    fclose(f);
33  f = fopen(name,"wt");
34}
35
36void m1_debugfile::printf(char *format, ...)
37{
38  va_list arg;
39  char str[40960];
40 
41  va_start(arg, format);
42  vsprintf(str, format, arg);
43  fputs(str, f);
44  fflush(f);
45  va_end(arg);
46}
47
48void m1_debugfile::operator()(char *format,...)
49{
50  va_list arg;
51  char str[40960];
52 
53  va_start(arg, format);
54  vsprintf(str, format, arg);
55  fputs(str, f);
56  fflush(f);
57  va_end(arg);
58}
59
Note: See TracBrowser for help on using the repository browser.