File: /usr/src/linux/arch/ppc/xmon/subr_prf.c
1 /*
2 * BK Id: SCCS/s.subr_prf.c 1.5 05/17/01 18:14:23 cort
3 */
4 /*
5 * Written by Cort Dougan to replace the version originally used
6 * by Paul Mackerras, which came from NetBSD and thus had copyright
7 * conflicts with Linux.
8 *
9 * This file makes liberal use of the standard linux utility
10 * routines to reduce the size of the binary. We assume we can
11 * trust some parts of Linux inside the debugger.
12 * -- Cort (cort@cs.nmt.edu)
13 *
14 * Copyright (C) 1999 Cort Dougan.
15 */
16
17 #include <linux/kernel.h>
18 #include <linux/string.h>
19 #include <stdarg.h>
20 #include "nonstdio.h"
21
22 extern int xmon_write(void *, void *, int);
23
24 void
25 xmon_vfprintf(void *f, const char *fmt, va_list ap)
26 {
27 static char xmon_buf[2048];
28 int n;
29
30 n = vsprintf(xmon_buf, fmt, ap);
31 xmon_write(f, xmon_buf, n);
32 }
33
34 void
35 xmon_printf(const char *fmt, ...)
36 {
37 va_list ap;
38
39 va_start(ap, fmt);
40 xmon_vfprintf(stdout, fmt, ap);
41 va_end(ap);
42 }
43
44 void
45 xmon_fprintf(void *f, const char *fmt, ...)
46 {
47 va_list ap;
48
49 va_start(ap, fmt);
50 xmon_vfprintf(f, fmt, ap);
51 va_end(ap);
52 }
53
54