+ for (;;) {
+ static const struct option opt[] = {
+ { "radix", OPTF_ARGREQ, 0, 'r' },
+ { 0, 0, 0, 0 }
+ };
+ int i = mdwopt(argc, argv, "r:", opt, 0, 0, 0);
+ if (i < 0)
+ break;
+ switch (i) {
+ case 'r':
+ r = atoi(optarg);
+ if (r < 2 || r > 36)
+ die(EXIT_FAILURE, "bad radix `%s'", optarg);
+ break;
+ default:
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (optind + 1 != argc) {
+ pquis(stderr, "Usage: $ [-r radix] integer\n");