root/trunk/src/debug.c

Revision 918, 1.2 kB (checked in by takkaria, 3 months ago)

Use consistent newlines everywhere, and also set the svn:eol-style property to native on all text files.

  • Property svn:eol-style set to native
Line 
1 /*
2  * File: debug.c
3  * Purpose: Simple debugging functions
4  *
5  * Copyright (c) 2007 Andrew Sidwell
6  *
7  * This work is free software; you can redistribute it and/or modify it
8  * under the terms of either:
9  *
10  * a) the GNU General Public License as published by the Free Software
11  *    Foundation, version 2, or
12  *
13  * b) the "Angband licence":
14  *    This software may be copied and distributed for educational, research,
15  *    and not for profit purposes provided that this copyright and statement
16  *    are included in all such copies.  Other copyrights may also apply.
17  */
18 #include "angband.h"
19 #include "debug.h"
20
21 typedef void debug_hook(const char *);
22
23 static void to_stderr(const char *out);
24
25 static debug_hook *d_out = to_stderr;
26
27 /*
28  * Simple printing to stderr
29  */
30 static void to_stderr(const char *out)
31 {
32         fputs(out, stderr);
33         fputs("\n", stderr);
34 }
35
36 /*
37  * Output some text.
38  *
39  * Amongst other things, this should use the z-msg package so that ports can
40  * display e.g. a debugging window, or send the output to file.
41  */
42 void debug(const char *format, ...)
43 {
44         va_list vp;
45         char buffer[1024] = "";
46
47         va_start(vp, format);
48         vstrnfmt(buffer, sizeof(buffer), format, vp);
49         va_end(vp);
50
51         d_out(buffer);
52
53         /* We are done */
54         return;
55 }
Note: See TracBrowser for help on using the browser.