parse-utils.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // SPDX-License-Identifier: LGPL-2.1
  2. /*
  3. * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
  4. *
  5. */
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <stdarg.h>
  10. #include <errno.h>
  11. #define __weak __attribute__((weak))
  12. void __vwarning(const char *fmt, va_list ap)
  13. {
  14. if (errno)
  15. perror("libtraceevent");
  16. errno = 0;
  17. fprintf(stderr, " ");
  18. vfprintf(stderr, fmt, ap);
  19. fprintf(stderr, "\n");
  20. }
  21. void __warning(const char *fmt, ...)
  22. {
  23. va_list ap;
  24. va_start(ap, fmt);
  25. __vwarning(fmt, ap);
  26. va_end(ap);
  27. }
  28. void __weak warning(const char *fmt, ...)
  29. {
  30. va_list ap;
  31. va_start(ap, fmt);
  32. __vwarning(fmt, ap);
  33. va_end(ap);
  34. }
  35. void __vpr_stat(const char *fmt, va_list ap)
  36. {
  37. vprintf(fmt, ap);
  38. printf("\n");
  39. }
  40. void __pr_stat(const char *fmt, ...)
  41. {
  42. va_list ap;
  43. va_start(ap, fmt);
  44. __vpr_stat(fmt, ap);
  45. va_end(ap);
  46. }
  47. void __weak vpr_stat(const char *fmt, va_list ap)
  48. {
  49. __vpr_stat(fmt, ap);
  50. }
  51. void __weak pr_stat(const char *fmt, ...)
  52. {
  53. va_list ap;
  54. va_start(ap, fmt);
  55. __vpr_stat(fmt, ap);
  56. va_end(ap);
  57. }