subr_prf.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Written by Cort Dougan to replace the version originally used
  3. * by Paul Mackerras, which came from NetBSD and thus had copyright
  4. * conflicts with Linux.
  5. *
  6. * This file makes liberal use of the standard linux utility
  7. * routines to reduce the size of the binary. We assume we can
  8. * trust some parts of Linux inside the debugger.
  9. * -- Cort (cort@cs.nmt.edu)
  10. *
  11. * Copyright (C) 1999 Cort Dougan.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License
  15. * as published by the Free Software Foundation; either version
  16. * 2 of the License, or (at your option) any later version.
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/string.h>
  20. #include <stdarg.h>
  21. #include "nonstdio.h"
  22. extern int xmon_write(void *, void *, int);
  23. void
  24. xmon_vfprintf(void *f, const char *fmt, va_list ap)
  25. {
  26. static char xmon_buf[2048];
  27. int n;
  28. n = vsprintf(xmon_buf, fmt, ap);
  29. xmon_write(f, xmon_buf, n);
  30. }
  31. void
  32. xmon_printf(const char *fmt, ...)
  33. {
  34. va_list ap;
  35. va_start(ap, fmt);
  36. xmon_vfprintf(stdout, fmt, ap);
  37. va_end(ap);
  38. }
  39. void
  40. xmon_fprintf(void *f, const char *fmt, ...)
  41. {
  42. va_list ap;
  43. va_start(ap, fmt);
  44. xmon_vfprintf(f, fmt, ap);
  45. va_end(ap);
  46. }