On 23/01/30 04:16, Andrii Nakryiko wrote: > On Fri, Jan 27, 2023 at 10:14 AM Anton Protopopov <aspsk@xxxxxxxxxxxxx> wrote: > > > [...] > > + > > + switch (key) { > > + case ARG_KEY_SIZE: > > + ret = strtol(arg, NULL, 10); > > + if (ret < 1 || ret > MAX_KEY_SIZE) { > > + fprintf(stderr, "invalid key_size"); > > + argp_usage(state); > > + } > > + args.key_size = ret; > > + break; > > + case ARG_MAP_FLAGS: > > + if (!strncasecmp(arg, "0x", 2)) > > + ret = strtol(arg, NULL, 0x10); > > + else > > + ret = strtol(arg, NULL, 10); > > if you pass base as zero, strtol() will do this for you Thanks, I didn't remeber this! > > + if (ret < 0 || ret > UINT_MAX) { > > + fprintf(stderr, "invalid map_flags"); > > + argp_usage(state); > > + } > > + args.map_flags = ret; > > + break; > > [...]