shithub: mc

Download patch

ref: 09590fbbd807b431a55c7ba5e96414ad50a0b86a
parent: ce5e4f1f12efc1dd7bbc31d03ed295d19e1d8104
author: Ori Bernstein <[email protected]>
date: Tue Aug 7 21:57:54 EDT 2012

Don't skip zeros when formatting numbers.

--- a/fmt.myr
+++ b/fmt.myr
@@ -95,6 +95,9 @@
 	i = 0
 	if val < 0
 		isneg = true
+	elif val == 0
+		b[0] = '0'
+		i++
 	;;
 	while val != 0
 		b[i] = digits[val % base]
--- a/test.myr
+++ b/test.myr
@@ -25,7 +25,8 @@
 	;;
 	std.write(1, "Hello, 世界\n")
 	chartypes()
-	std.put("format output %i %i %s\n", 123, 321, "asdf")
+	std.put("format output %i %i %i %s\n", 123, 321, 0, "asdf")
+	std.put("format with no args\n")
 }
 
 const chartypes = {