Ignore precision specifiers in printf code.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 5 Mar 2008 03:27:55 +0000 (22:27 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 5 Mar 2008 03:27:55 +0000 (22:27 -0500)
This at least allows the variable to be printed.

src/output.c

index 0dcd20d7c80e1dfe4baead9f65401c48a5684892..98517a0cc3214e2469c97c35e1a3ec73137d0571 100644 (file)
@@ -97,6 +97,12 @@ puthex(u16 action, u32 val)
     putsinglehex(action, (val >> 0) & 0xf);
 }
 
+static inline int
+isdigit(u8 c)
+{
+    return c - '0' < 10;
+}
+
 void
 bprintf(u16 action, const char *fmt, ...)
 {
@@ -112,7 +118,12 @@ bprintf(u16 action, const char *fmt, ...)
             continue;
         }
         const char *n = s+1;
-        c = GET_VAR(CS, (u8)*n);
+        for (;;) {
+            c = GET_VAR(CS, (u8)*n);
+            if (!isdigit(c))
+                break;
+            n++;
+        }
         s32 val;
         const char *sarg;
         switch (c) {