parse-utils.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
  3. *
  4. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation;
  8. * version 2.1 of the License (not later!)
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this program; if not, see <http://www.gnu.org/licenses>
  17. *
  18. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. */
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <stdarg.h>
  24. #include <errno.h>
  25. #define __weak __attribute__((weak))
  26. void __vwarning(const char *fmt, va_list ap)
  27. {
  28. if (errno)
  29. perror("trace-cmd");
  30. errno = 0;
  31. fprintf(stderr, " ");
  32. vfprintf(stderr, fmt, ap);
  33. fprintf(stderr, "\n");
  34. }
  35. void __warning(const char *fmt, ...)
  36. {
  37. va_list ap;
  38. va_start(ap, fmt);
  39. __vwarning(fmt, ap);
  40. va_end(ap);
  41. }
  42. void __weak warning(const char *fmt, ...)
  43. {
  44. va_list ap;
  45. va_start(ap, fmt);
  46. __vwarning(fmt, ap);
  47. va_end(ap);
  48. }
  49. void __vpr_stat(const char *fmt, va_list ap)
  50. {
  51. vprintf(fmt, ap);
  52. printf("\n");
  53. }
  54. void __pr_stat(const char *fmt, ...)
  55. {
  56. va_list ap;
  57. va_start(ap, fmt);
  58. __vpr_stat(fmt, ap);
  59. va_end(ap);
  60. }
  61. void __weak vpr_stat(const char *fmt, va_list ap)
  62. {
  63. __vpr_stat(fmt, ap);
  64. }
  65. void __weak pr_stat(const char *fmt, ...)
  66. {
  67. va_list ap;
  68. va_start(ap, fmt);
  69. __vpr_stat(fmt, ap);
  70. va_end(ap);
  71. }