ref: 263b0e34b2cedd426d165fbf42437d2d45f80361
parent: f5fcf6688b6a8fe502e94e531ec4e17f5b108e6e
author: cinap_lenrek <[email protected]>
date: Mon Jan 4 13:35:04 EST 2016
mpc: use new strtomp() c-style prefixes to parse integer constants
--- a/sys/src/cmd/mpc.y
+++ b/sys/src/cmd/mpc.y
@@ -579,7 +579,9 @@
return nil;
if(f->c == NUM){
- m = strtomp(f->s->n, nil, 10, nil);
+ m = strtomp(f->s->n, nil, 0, nil);
+ if(m == nil)
+ diag(f, "bad constant");
if(mpcmp(m, mpzero) == 0){
f->c = NAME;
f->s = sym("mpzero");
@@ -643,7 +645,9 @@
switch(f->c){
case NUM:
- m = strtomp(f->s->n, nil, 10, nil);
+ m = strtomp(f->s->n, nil, 0, nil);
+ if(m == nil)
+ diag(f, "bad constant");
if(mpsignif(m) <= 32)
cprint("uitomp(%udUL, %N);\n", mptoui(m), t);
else if(mpsignif(m) <= 64)