Skip to content
Snippets Groups Projects
Commit 962a43cc authored by Sjoerd Simons's avatar Sjoerd Simons Committed by Simon Glass
Browse files

lib/tiny-printf.c: Implement vprintf


Implement both printf and vprintf for a bit more flexibility, e.g.
allows the panic() function to work with tiny-printf.

Signed-off-by: default avatarSjoerd Simons <sjoerd.simons@collabora.co.uk>
parent 4363de63
No related branches found
No related tags found
No related merge requests found
......@@ -40,17 +40,14 @@ static void div_out(unsigned int *num, unsigned int div)
out_dgt(dgt);
}
int printf(const char *fmt, ...)
int vprintf(const char *fmt, va_list va)
{
va_list va;
char ch;
char *p;
unsigned int num;
char buf[12];
unsigned int div;
va_start(va, fmt);
while ((ch = *(fmt++))) {
if (ch != '%') {
putc(ch);
......@@ -117,6 +114,17 @@ int printf(const char *fmt, ...)
}
abort:
va_end(va);
return 0;
}
int printf(const char *fmt, ...)
{
va_list va;
int ret;
va_start(va, fmt);
ret = vprintf(fmt, va);
va_end(va);
return ret;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment