summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2006-05-22 17:41:01 +0200
committerMichael Brown2006-05-22 17:41:01 +0200
commit84a493b88d88268dd0387d7d281a1c40fcc98680 (patch)
tree6cfcc56d92937f8c2281df2e4411ff976e97974e /src/include
parent- fixes to _wputch to get positioning and wrap working properly (diff)
downloadipxe-84a493b88d88268dd0387d7d281a1c40fcc98680.tar.gz
ipxe-84a493b88d88268dd0387d7d281a1c40fcc98680.tar.xz
ipxe-84a493b88d88268dd0387d7d281a1c40fcc98680.zip
Allow vcprintf() to be called by external code such as the curses library.
Also trim another eight bytes from vsprintf.o. :)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/vsprintf.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/include/vsprintf.h b/src/include/vsprintf.h
index 99d6683e1..d5018d7cc 100644
--- a/src/include/vsprintf.h
+++ b/src/include/vsprintf.h
@@ -35,6 +35,35 @@
#define PRINTF_NO_LENGTH ( ( size_t ) -1 )
+/**
+ * A printf context
+ *
+ * Contexts are used in order to be able to share code between
+ * vprintf() and vsnprintf(), without requiring the allocation of a
+ * buffer for vprintf().
+ */
+struct printf_context {
+ /**
+ * Character handler
+ *
+ * @v ctx Context
+ * @v c Character
+ *
+ * This method is called for each character written to the
+ * formatted string.
+ */
+ void ( * handler ) ( struct printf_context *ctx, unsigned int c );
+ /** Length of formatted string
+ *
+ * When handler() is called, @len will be set to the number of
+ * characters written so far (i.e. zero for the first call to
+ * handler()).
+ */
+ size_t len;
+};
+
+extern size_t vcprintf ( struct printf_context *ctx, const char *fmt,
+ va_list args );
extern int vsnprintf ( char *buf, size_t size, const char *fmt, va_list args );
extern int vprintf ( const char *fmt, va_list args );