1 /*
2 * libcaca Colour ASCII-Art library
3 * Copyright (c) 2006-2012 Sam Hocevar <sam@hocevar.net>
4 * All Rights Reserved
5 *
6 * This library is free software. It comes without any warranty, to
7 * the extent permitted by applicable law. You can redistribute it
8 * and/or modify it under the terms of the Do What the Fuck You Want
9 * to Public License, Version 2, as published by Sam Hocevar. See
10 * http://www.wtfpl.net/ for more details.
11 */
12
13 /*
14 * This file contains debugging functions.
15 */
16
17 #ifndef __CACA_DEBUG_H__
18 #define __CACA_DEBUG_H__
19
20 /* debug messages */
21 #if defined DEBUG && !defined __KERNEL__
22 # include <stdio.h>
23 # include <stdarg.h>
debug(const char * format,...)24 static inline void debug(const char *format, ...)
25 {
26 int saved_errno = geterrno();
27 va_list args;
28 va_start(args, format);
29 fprintf(stderr, "** libcaca debug ** ");
30 vfprintf(stderr, format, args);
31 fprintf(stderr, "\n");
32 va_end(args);
33 seterrno(saved_errno);
34 }
35 #else
36 # define debug(format, ...) do {} while(0)
37 #endif
38
39 #endif /* __CACA_DEBUG_H__ */
40
41