4 #include <gpxe/vsprintf.h>
9 * MuCurses printing functions
14 * Add a single-byte character and rendition to a window and advance
17 * @v *win window to be rendered in
18 * @v ch character to be added at cursor
19 * @ret rc return status code
21 int waddch ( WINDOW *win, const chtype ch ) {
22 _wputch( win, ch, WRAP );
27 * Add string of single-byte characters to a window
29 * @v *win window to be rendered in
30 * @v *str standard c-style string
31 * @v n max number of chars from string to render
32 * @ret rc return status code
34 int waddnstr ( WINDOW *win, const char *str, int n ) {
35 _wputstr( win, str, WRAP, n );
39 struct printw_context {
40 struct printf_context ctx;
44 static void _printw_handler ( struct printf_context *ctx, unsigned int c ) {
45 struct printw_context *wctx =
46 container_of ( ctx, struct printw_context, ctx );
48 _wputch( wctx->win, c | wctx->win->attrs, WRAP );
52 * Print formatted output in a window
54 * @v *win subject window
55 * @v *fmt formatted string
56 * @v varglist argument list
57 * @ret rc return status code
59 int vw_printw ( WINDOW *win, const char *fmt, va_list varglist ) {
60 struct printw_context wctx;
63 wctx.ctx.handler = _printw_handler;
64 vcprintf ( &(wctx.ctx), fmt, varglist );
69 * Print formatted output to a window
71 * @v *win subject window
72 * @v *fmt formatted string
73 * @v ... string arguments
74 * @ret rc return status code
76 int wprintw ( WINDOW *win, const char *fmt, ... ) {
80 va_start ( args, fmt );
81 i = vw_printw ( win, fmt, args );