1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- * See the COPYING file for the terms of usage and distribution.
- */
- #ifdef HAVE_CONFIG_H
- #include "config.h"
- #endif
- #include <tchar.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #ifdef HAVE_STDARG_H
- # include <stdarg.h>
- #else
- # ifdef HAVE_VARARGS_H
- # include <varargs.h>
- # endif
- #endif
- #include "sd/error.h"
- #include "sd/sd_xplatform.h"
- static const TCHAR version[] = _T("$Id$");
- int sd_debug(const TCHAR *fmt, ...)
- {
- va_list args;
- int r;
- if (!_tgetenv(_T("SD_DEBUG")))
- return 0;
- r = _ftprintf(stderr, _T("[DEBUG] "));
- va_start(args, fmt);
- r += _vftprintf(stderr, fmt, args);
- va_end(args);
- r += _ftprintf(stderr, _T("\n"));
- return r;
- }
- int sd_error(const TCHAR *fmt, ...)
- {
- va_list args;
- int r;
- if (!_tgetenv(_T("SD_ERROR")))
- return 0;
- r = _ftprintf(stderr, _T("[ERROR] "));
- va_start(args, fmt);
- r += _vftprintf(stderr, fmt, args);
- va_end(args);
- r += _ftprintf(stderr, _T("\n"));
- return r;
- }
|