coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as


From: Jérémy Compostella
Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix.
Date: Fri, 17 Feb 2012 18:56:54 +0100

> 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.

Cheers,

Jérémy

Attachment: 0001-split-numeric-suffixes-new-optional-from-argument-bu.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]