/* --- Read an initial character --- */
ch = ops->get(p);
- while (isspace(ch))
- ch = ops->get(p);
+ if (radix >= 0) {
+ while (isspace(ch))
+ ch = ops->get(p);
+ }
/* --- Handle an initial sign --- */
int rc;
if (MP_EQ(m, MP_ZERO))
- return (ops->put("0", 1, p));
+ return (ops->put(radix > 0 ? "0" : "\0", 1, p));
/* --- Set various things up --- */
/* --- If the number is negative, sort that out --- */
if (MP_NEGP(m)) {
+ assert(radix > 0);
if (ops->put("-", 1, p))
return (EOF);
m->f &= ~MP_NEG;