subr_prf.c 1.0 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. #include <linux/kernel.h>
  14. #include <linux/string.h>
  15. #include <stdarg.h>
  16. #include "nonstdio.h"
  17. extern int xmon_write(void *, void *, int);
  18. void
  19. xmon_vfprintf(void *f, const char *fmt, va_list ap)
  20. {
  21. static char xmon_buf[2048];
  22. int n;
  23. n = vsprintf(xmon_buf, fmt, ap);
  24. xmon_write(f, xmon_buf, n);
  25. }
  26. void
  27. xmon_printf(const char *fmt, ...)
  28. {
  29. va_list ap;
  30. va_start(ap, fmt);
  31. xmon_vfprintf(stdout, fmt, ap);
  32. va_end(ap);
  33. }
  34. void
  35. xmon_fprintf(void *f, const char *fmt, ...)
  36. {
  37. va_list ap;
  38. va_start(ap, fmt);
  39. xmon_vfprintf(f, fmt, ap);
  40. va_end(ap);
  41. }
  42. void
  43. xmon_puts(char *s)
  44. {
  45. xmon_write(stdout, s, strlen(s));
  46. }