summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2015-12-04 23:27:37 +0100
committerSimon Glass <sjg@chromium.org>2015-12-13 17:07:30 -0700
commit962a43cc9628fcfc048c563e0fd295b8743e0504 (patch)
tree1727598ade0dac6e0793a43a71e517ea2ec3e0fd /lib
parent4363de63a88f3e9490cb46ce4c92e7c2d2497ba8 (diff)
downloadu-boot-imx-962a43cc9628fcfc048c563e0fd295b8743e0504.zip
u-boot-imx-962a43cc9628fcfc048c563e0fd295b8743e0504.tar.gz
u-boot-imx-962a43cc9628fcfc048c563e0fd295b8743e0504.tar.bz2
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: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/tiny-printf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 6766a8f..403b134 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -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;
+}