35int main(
int argc,
char *argv[]) {
42 fprintf(stderr,
"Usage: basecvt <ibase> <obase> <values>+\n");
46 in_rdx = atoi(argv[1]);
47 out_rdx = atoi(argv[2]);
51 "basecvt: input radix %u not allowed (minimum %u, maximum %u)\n",
57 "basecvt: output radix %u not allowed (minimum %u, maximum %u)\n",
63 fprintf(stderr,
"basecvt: out of memory\n");
67 for (ix = 3; ix < argc; ++ix) {
68 char *buf, *endp = NULL;
74 fprintf(stderr,
"basecvt: error reading argument %d: %s\n", ix,
77 }
else if (*endp !=
'\0') {
78 fprintf(stderr,
"basecvt: argument %d contains '%s' not in base %u\n",
90 if ((buf = malloc(len)) == NULL) {
91 fprintf(stderr,
"basecvt: out of memory\n");
102 fprintf(stderr,
"basecvt: error converting argument %d: %s\n", ix,
static mp_int MP_NUMER_P(mp_rat Q)
#define mp_rat_is_integer
#define mp_rat_string_len
#define mp_int_string_len
#define mp_rat_read_ustring