選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

caca_debug.h 1.0 KiB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2006-2010 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://sam.zoy.org/wtfpl/COPYING for more details.
  11. */
  12. /*
  13. * This file contains debugging functions.
  14. */
  15. #ifndef __CACA_DEBUG_H__
  16. #define __CACA_DEBUG_H__
  17. /* debug messages */
  18. #if defined DEBUG && !defined __KERNEL__
  19. # include <stdio.h>
  20. # include <stdarg.h>
  21. static inline void debug(const char *format, ...)
  22. {
  23. int saved_errno = geterrno();
  24. va_list args;
  25. va_start(args, format);
  26. fprintf(stderr, "** libcaca debug ** ");
  27. vfprintf(stderr, format, args);
  28. fprintf(stderr, "\n");
  29. va_end(args);
  30. seterrno(saved_errno);
  31. }
  32. #else
  33. # define debug(format, ...) do {} while(0)
  34. #endif
  35. #endif /* __CACA_DEBUG_H__ */