static const char version[] = "$Id$"; /* * See the COPYING file for the terms of usage and distribution. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifdef HAVE_STDARG_H # include #else # ifdef HAVE_VARARGS_H # include # endif #endif #include #include int sd_debug(const char *fmt, ...) { va_list args; int r; if (!getenv("SD_DEBUG")) return 0; r = fprintf(stderr, "[DEBUG] "); va_start(args, fmt); r += vfprintf(stderr, fmt, args); va_end(args); r += fprintf(stderr, "\n"); return r; } int sd_error(const char *fmt, ...) { va_list args; int r; if (!getenv("SD_ERROR")) return 0; r = fprintf(stderr, "[ERROR] "); va_start(args, fmt); r += vfprintf(stderr, fmt, args); va_end(args); r += fprintf(stderr, "\n"); return r; }