git: 9front

Download patch

ref: f21a6dc9a7d54d181d008d5034837df86867888d
parent: 7291f87568b953b34e49b3517cdc0ad39ec2e6dc
author: aiju <devnull@localhost>
date: Mon Sep 19 12:45:15 EDT 2016

pc(1): if the input base is not 10, print the 0d prefix before decimal numbers; this way, all output is always valid input (for the current mode)

--- a/sys/src/cmd/pc.y
+++ b/sys/src/cmd/pc.y
@@ -299,7 +299,7 @@
 	if(mpcmp(n, mpzero) != 0)
 		switch(b){
 		case 16: *--q = 'x'; *--q = '0'; break;
-		case 10: if(outbase != 0 && outbase != 10) {*--q = 'd'; *--q = '0';} break;
+		case 10: if(outbase != 0 && outbase != 10 || inbase != 10) {*--q = 'd'; *--q = '0';} break;
 		case 8: *--q = '0'; break;
 		case 2: *--q = 'b'; *--q = '0'; break;
 		}
--