summaryrefslogtreecommitdiff
path: root/sys/ddb/db_output.h
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-05-14 16:12:34 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-05-14 16:12:34 +0000
commit35b5cf41ece181531dfe61c047144502b2323573 (patch)
tree8fee2d27305ae926be331ef2177f247b4f2d6891 /sys/ddb/db_output.h
parenta4cfbd718676369b886f401ff8cd7d67f0155a8a (diff)
db_printf has three non-standard formats that are not supported by
printf. Since we want to be able to have some ddb functions use db_printf or normal printf, provide a new way to acheive the same kind of formatting. The new function is called db_format and can emulate all variations of how the nonstandard db_printf formats are used. Note that this doesn't (yet?) mean that we want to convert all the non-standard formats, we just want to have that option. miod@ ok.
Diffstat (limited to 'sys/ddb/db_output.h')
-rw-r--r--sys/ddb/db_output.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h
index 545cb09fade..e2dbc4c2bf4 100644
--- a/sys/ddb/db_output.h
+++ b/sys/ddb/db_output.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_output.h,v 1.10 2002/03/14 01:26:51 millert Exp $ */
+/* $OpenBSD: db_output.h,v 1.11 2002/05/14 16:12:33 art Exp $ */
/* $NetBSD: db_output.h,v 1.9 1996/04/04 05:13:50 cgd Exp $ */
/*
@@ -39,3 +39,21 @@ int db_print_position(void);
int db_printf(const char *, ...)
__kprintf_attribute__((__format__(__kprintf__,1,2)));
void db_end_line(int);
+
+/*
+ * This is a replacement for the non-standard %z, %n and %r printf formats
+ * in db_printf.
+ *
+ * db_format(buf, bufsize, val, format, alt, width)
+ *
+ * val is the value we want printed.
+ * format is one of DB_FORMAT_[ZRN]
+ * alt specifies if we should provide an "alternate" format (# in the printf
+ * format).
+ * width is the field width. 0 is the same as no width specifier.
+ */
+#define DB_FORMAT_Z 1
+#define DB_FORMAT_R 2
+#define DB_FORMAT_N 3
+#define DB_FORMAT_BUF_SIZE 64 /* should be plenty for all formats */
+char *db_format(char *, size_t, long, int, int, int);