debug.c 557 B

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. #include <stdarg.h>
  3. #include "debug.h"
  4. #include "debug-internal.h"
  5. static int __base_pr(const char *format, ...)
  6. {
  7. va_list args;
  8. int err;
  9. va_start(args, format);
  10. err = vfprintf(stderr, format, args);
  11. va_end(args);
  12. return err;
  13. }
  14. libapi_print_fn_t __pr_warning = __base_pr;
  15. libapi_print_fn_t __pr_info = __base_pr;
  16. libapi_print_fn_t __pr_debug;
  17. void libapi_set_print(libapi_print_fn_t warn,
  18. libapi_print_fn_t info,
  19. libapi_print_fn_t debug)
  20. {
  21. __pr_warning = warn;
  22. __pr_info = info;
  23. __pr_debug = debug;
  24. }