> Thanks for continuing with this.
> One general thing that might both improve
> and simplify the implementation, is to
> not to convert from string to int at all.
>
> I.E. when processing the arg, just validate like:
> if (strlen (optarg) != strspn (optarg, suffix_alphabet))
> error()
> else
> /* skip over any leading 0, and use this as the start directly. */
>
> Then the subsequent check for length and
> the initialization of the file name should be simplified.
This is more like my first implementation indeed. But since I didn't
know about the strspn() function the code was a little bit more complex
without converting to int.
I attached the new patch. I tried to make it as simple as possible but
feel free to comment.
> Also this removes the limitation of size of an unsigned int,
> though that's not really a practical concern I suppose.
Fair point. IMHO, even if it's not a really practical concern
it's stupid to have such an easy to avoid restriction.
> I've also attached some string and test cleanups,
> to --amend into your patch.
Applied.