Changeset View
Changeset View
Standalone View
Standalone View
stand/libsa/printf.c
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
#define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1) | #define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1) | ||||
typedef void (kvprintf_fn_t)(int, void *); | typedef void (kvprintf_fn_t)(int, void *); | ||||
static char *ksprintn (char *buf, uintmax_t num, int base, int *len, int upper); | static char *ksprintn (char *buf, uintmax_t num, int base, int *len, int upper); | ||||
static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap); | static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap); | ||||
__weak_symbol void | |||||
putchar_device(int c __unused, void *ptr __unused) | |||||
{ | |||||
} | |||||
int | |||||
diag_printf(const char *fmt, ...) | |||||
{ | |||||
va_list ap; | |||||
int retval; | |||||
char *diag; | |||||
diag = getenv("diag-device"); | |||||
va_start(ap, fmt); | |||||
retval = kvprintf(fmt, putchar_device, diag, 10, ap); | |||||
va_end(ap); | |||||
return retval; | |||||
} | |||||
static void | static void | ||||
putchar_wrapper(int cc, void *arg) | putchar_wrapper(int cc, void *arg) | ||||
{ | { | ||||
putchar(cc); | putchar(cc); | ||||
} | } | ||||
int | int | ||||
▲ Show 20 Lines • Show All 504 Lines • Show Last 20 Lines |