diff mbox

[kvm-unit-tests,v5,05/11] lib/printf: support the %u unsigned fmt field

Message ID 1438358041-18021-6-git-send-email-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée July 31, 2015, 3:53 p.m. UTC
---
 lib/printf.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox

Patch

diff --git a/lib/printf.c b/lib/printf.c
index 89308fb..5d83605 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -180,6 +180,19 @@  int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 		break;
 	    }
 	    break;
+	case 'u':
+	    switch (nlong) {
+	    case 0:
+		print_unsigned(&s, va_arg(va, unsigned), 10, props);
+		break;
+	    case 1:
+		print_unsigned(&s, va_arg(va, unsigned long), 10, props);
+		break;
+	    default:
+		print_unsigned(&s, va_arg(va, unsigned long long), 10, props);
+		break;
+	    }
+	    break;
 	case 'x':
 	    switch (nlong) {
 	    case 0: