From 11e40fc6b456b96dfc3cfc22f8efba07b3f1038c Mon Sep 17 00:00:00 2001 From: aiju Date: Mon, 19 Sep 2016 16:45:15 +0000 Subject: 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) --- sys/src/cmd/pc.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/cmd/pc.y b/sys/src/cmd/pc.y index d6db26bba..73eb30110 100644 --- a/sys/src/cmd/pc.y +++ b/sys/src/cmd/pc.y @@ -299,7 +299,7 @@ numprint(Num *n) 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; } -- cgit v1.2.3