From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 14 18:34:05 2011 Received: (at submit) by debbugs.gnu.org; 14 Jul 2011 22:34:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhUTp-0003eh-E4 for submit@debbugs.gnu.org; Thu, 14 Jul 2011 18:34:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhUHO-0003Mp-K6 for submit@debbugs.gnu.org; Thu, 14 Jul 2011 18:21:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhUHF-0005ff-5f for submit@debbugs.gnu.org; Thu, 14 Jul 2011 18:21:05 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HS_INDEX_PARAM, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:56958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhUHF-0005fb-4A for submit@debbugs.gnu.org; Thu, 14 Jul 2011 18:21:01 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhUHA-0005Ay-H7 for bug-coreutils@gnu.org; Thu, 14 Jul 2011 18:21:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhUH6-0005el-3w for bug-coreutils@gnu.org; Thu, 14 Jul 2011 18:20:56 -0400 Received: from smtp12.hushmail.com ([65.39.178.135]:34906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhUH5-0005eR-T8 for bug-coreutils@gnu.org; Thu, 14 Jul 2011 18:20:52 -0400 Received: from smtp12.hushmail.com (localhost.localdomain [127.0.0.1]) by smtp12.hushmail.com (Postfix) with SMTP id 5F912C02E7 for ; Thu, 14 Jul 2011 22:20:47 +0000 (UTC) X-Hush-Verified-Domain: hush.ai Received: from smtp.hushmail.com (w5.hushmail.com [65.39.178.80]) by smtp12.hushmail.com (Postfix) with ESMTP; Thu, 14 Jul 2011 22:20:46 +0000 (UTC) Received: from [192.168.1.65] (unknown [65.39.178.78]) by smtp.hushmail.com (Postfix) with ESMTP id 3BA93E6726; Thu, 14 Jul 2011 22:20:46 +0000 (UTC) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-2--485124648" Mime-Version: 1.0 (Apple Message framework v1084) Subject: 'split' feature request: an option to uses e.g. '.001' as first suffix. From: SciFi X-Priority: 5 Date: Thu, 14 Jul 2011 17:20:40 -0500 Content-Transfer-Encoding: 7bit Message-Id: To: bug-coreutils@gnu.org X-Pgp-Agent: GPGMail 1.3.3 X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 14 Jul 2011 18:34:00 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-2--485124648 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 [Originally posted at on Tue 05 = Feb 2008 07:51:09 AM GMT:] To create UseNet binary postings to match those made by others as close = as possible, we need to create split files with 3-digit numeric = suffixes. The problem comes when 'split --numeric-suffixes --suffix-length=3D3' = starts naming the files with .000 as the first suffix. This causes = great confusion among much of the UseNet userbase esp'ly those running = M$ systems. It seems the .000 file is reserved as some kind of index = for their apps [MasterSplitter and others], and 'split's .000 file is = rejected as "unknown format". I know... I know... UNIX=AE was here well-before Mr Gates & company, but = trying to explain to those users what to do (simply 'cat' or 'copy /b' = all of the files in numeric order) is a chore. We who use *ix-based = systems (mine's OSX) do not furnish DOS .bat files for those users. Yes = I've received some public flack about this; I have no idea if those = users ever were able to reconstruct the original files. I'd like to suggest an option be added to 'split' that would let us = begin naming the files with a suffix e.g. .001 or settable by a = command-line option. I don't know what would be a good name for this = option (and whether it'd follow POSIX standards etc.). I'm hoping by the absence of a .000 file in our UseNet posts, where the = .001 file is really "the beginning", this would cause the M$-based tools = to follow suit. As an aside, most of us normally post several .par2 files, and some of = us construct them in such a way that simply running a par2repair utility = will recreate the original file automatically. So, at least for my = posts, that's what I'm telling users to do: just run your favorite par2 = util, you don't need to 'copy /b' beforehand. But it'd be best if we = could cause 'split' to begin with the .001 file as explained above. Thank you for letting me discuss this here. [Today's Addendum I intended to add to the original report, for = historical purposes if nothing else:] I've found a few simple C pgms, all self-contained, that can be = very-easily modified to do 3-digit suffixes starting at .001, such as = 'bsplit.c'. For example, these were discovered with internet search = engines: = Nevertheless, it would be terribly nice to have GNU 'split' modify its = suffix-generator logic to provide a bit more customization ability in = this regard -- right now, the coding looks way-too complicated, too much = for me to figure out how to rewrite it for a patch. ;) Thanks again. --Apple-Mail-2--485124648 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJOH2u8AAoJEKkeWNKet7+KOEsH/jm3u3UoUzc0XA1++lQiTAzR 9PkmSxoFW/REF6D87/PeR5nxJvTbv19ww9AtSZlo0lyQcUeyFe92RT/q+Z/dVkqG AVNl76c6gs3uwYz5PrS3M1h7m8f29fdraucg5sAI80zMNYNQq/rD5/o/kqNY3Lyf AfVEWhNru9uYF7LINqIJck1DhmV895QVDNs+vap63FejnIbyTzP/qGZPivyJ3u9G a8QDvN39bRdm4wY1gMgoqbAh7ocSwNVDE/mHN/RuBbvSVoKIXZ5Bbpbimbt/i3Rm +Yk1Kb171EdDrAKsLMVMiyXg5njsJz1x8eydSIGzNLteb9Tw0lJa270PUTsNcOU= =3iGS -----END PGP SIGNATURE----- --Apple-Mail-2--485124648-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 29 17:34:07 2012 Received: (at 9085) by debbugs.gnu.org; 29 Jan 2012 22:34:07 +0000 Received: from localhost ([127.0.0.1]:44198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrdK2-0003oX-UK for submit@debbugs.gnu.org; Sun, 29 Jan 2012 17:34:07 -0500 Received: from mail-ww0-f46.google.com ([74.125.82.46]:62957) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrdK0-0003o1-La for 9085@debbugs.gnu.org; Sun, 29 Jan 2012 17:34:06 -0500 Received: by wgbdt14 with SMTP id dt14so3565664wgb.15 for <9085@debbugs.gnu.org>; Sun, 29 Jan 2012 14:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:cc:date:message-id:mime-version:content-type; bh=/L5SxRzOfVmNUj0/ns+V362c/80CB00lcPIXK/IDcZo=; b=eg6i0IiM8516LMnw911dK6DnVMFcQtNUtVmthP+BGEk1F7OIlpNZnExQrPW9ZVyX0O MredEoSMo3vFcqz4w3iYSDTb4nCZoyc2wDQ3WO0f9A5qXuPHe4nL9lpP7puTgroABC1p htju9JsxBB5XFHbFjNpUNmhDvtU5jnMD0VOYQ= Received: by 10.180.87.8 with SMTP id t8mr24400080wiz.15.1327876432816; Sun, 29 Jan 2012 14:33:52 -0800 (PST) Received: from Apollo.jerryland.fr ([85.69.251.50]) by mx.google.com with ESMTPS id bu13sm46205031wib.6.2012.01.29.14.33.50 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 Jan 2012 14:33:51 -0800 (PST) From: =?utf-8?Q?J=C3=A9r=C3=A9my_Compostella?= To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: 'split' feature request: an option to uses e.g. '.001' as first suffix. Date: Sun, 29 Jan 2012 23:34:09 +0100 Message-ID: <874nvekuji.fsf@Apollo.jerryland.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, SciFi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable P=C3=A1draig, Sci-Fi, others, I made an implementation of the requested feature. With the attached patch applied the split command accepts a new optional "from" argument for the --numeric-suffixes (aka -d) option. If this argument is specified, the numeric suffix counts from this value, otherwise, like before, it counts from 0. I've tried to not impact the performance, to not break anything and to respect the coding rules but feel free to comment this patch. I will take into account whatever you may want. Cheers, J=C3=A9r=C3=A9my --- --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-split-numeric-suffixes-new-optional-from-argument-bu.patch Content-Description: split: --numeric-suffixes new optional "from" argument (bug#9085) patch >From 82cbcf36e1fc9901964b6a348b495739357f28ee Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Sun, 29 Jan 2012 15:20:31 +0100 Subject: [PATCH] split: --numeric-suffixes new optional "from" argument (bug#9085) The split command now accepts a new optional "from" argument for the --numeric-suffixes (aka -d) option. When this argument is specified, the numeric suffix counts from this value, otherwise, like before, it counts from 0. Signed-off-by: Jeremy Compostella --- NEWS | 6 +++++ doc/coreutils.texi | 7 +++-- src/split.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 2b0926f..2f46707 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + split now accept an optional "from" value for the + --numeric-suffixes (aka -d) option. When this argument is + specified, the numeric suffix counts from this value, otherwise, + like before, it counts from 0. * Noteworthy changes in release 8.15 (2012-01-06) [stable] diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 0d3b739..53ab356 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -3083,11 +3083,12 @@ and so can be a pipe for example. @opindex --suffix-length Use suffixes of length @var{length}. The default @var{length} is 2. -@item -d -@itemx --numeric-suffixes +@item -d[@var{from}] +@itemx --numeric-suffixes[=@var{from}] @opindex -d @opindex --numeric-suffixes -Use digits in suffixes rather than lower-case letters. +Use digits in suffixes rather than lower-case letters. The numerical +suffix counts from @var{from} if specified, 0 otherwise. @item -e @itemx --elide-empty-files diff --git a/src/split.c b/src/split.c index 5fbce0e..7454bc2 100644 --- a/src/split.c +++ b/src/split.c @@ -80,6 +80,9 @@ static size_t suffix_length; /* Alphabet of characters to use in suffix. */ static char const *suffix_alphabet = "abcdefghijklmnopqrstuvwxyz"; +/* Numerical suffix count from value. */ +static size_t suffix_count_from; + /* Name of input file. May be "-". */ static char *infile; @@ -122,7 +125,7 @@ static struct option const longopts[] = {"elide-empty-files", no_argument, NULL, 'e'}, {"unbuffered", no_argument, NULL, 'u'}, {"suffix-length", required_argument, NULL, 'a'}, - {"numeric-suffixes", no_argument, NULL, 'd'}, + {"numeric-suffixes", optional_argument, NULL, 'd'}, {"filter", required_argument, NULL, FILTER_OPTION}, {"verbose", no_argument, NULL, VERBOSE_OPTION}, {"-io-blksize", required_argument, NULL, @@ -195,7 +198,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -a, --suffix-length=N use suffixes of length N (default %d)\n\ -b, --bytes=SIZE put SIZE bytes per output file\n\ -C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\ - -d, --numeric-suffixes use numeric suffixes instead of alphabetic\n\ + -d[FROM], --numeric-suffixes[FROM] use numeric suffixes instead of alphabetic.\n\ + When specified, start counting from FROM, 0 otherwise\n\ -e, --elide-empty-files do not generate empty output files with '-n'\n\ --filter=COMMAND write to shell COMMAND; file name is $FILE\n\ -l, --lines=NUMBER put NUMBER lines per output file\n\ @@ -231,6 +235,7 @@ next_file_name (void) { /* Index in suffix_alphabet of each character in the suffix. */ static size_t *sufindex; + size_t i = suffix_length; if (! outfile) { @@ -243,9 +248,23 @@ next_file_name (void) outfile = xmalloc (outfile_length + 1); outfile_mid = outfile + outbase_length; memcpy (outfile, outbase, outbase_length); - memset (outfile_mid, suffix_alphabet[0], suffix_length); - outfile[outfile_length] = 0; sufindex = xcalloc (suffix_length, sizeof *sufindex); + /* Initialize the suffix index accordingly to the count from + value. */ + { + size_t left = suffix_count_from; + while (i-- != 0) + { + if (left) + { + sufindex[i] = left % 10; + left /= 10; + } + outfile_mid[i] = suffix_alphabet[sufindex[i]]; + } + } + + outfile[outfile_length] = 0; #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX /* POSIX requires that if the output file name is too long for @@ -265,7 +284,6 @@ next_file_name (void) { /* Increment the suffix in place, if possible. */ - size_t i = suffix_length; while (i-- != 0) { sufindex[i]++; @@ -1016,7 +1034,7 @@ main (int argc, char **argv) int this_optind = optind ? optind : 1; char *slash; - c = getopt_long (argc, argv, "0123456789C:a:b:del:n:u", + c = getopt_long (argc, argv, "0123456789C:a:b:d::el:n:u", longopts, NULL); if (c == -1) break; @@ -1142,6 +1160,19 @@ main (int argc, char **argv) case 'd': suffix_alphabet = "0123456789"; + if (optarg) + { + unsigned long tmp; + if (xstrtoul (optarg, NULL, 10, &tmp, "") != LONGINT_OK + || SIZE_MAX / sizeof (size_t) < tmp) + { + error (0, 0, _("%s: invalid count from numerical suffix number"), + optarg); + usage (EXIT_FAILURE); + } + else + suffix_count_from = tmp; + } break; case 'e': @@ -1212,6 +1243,26 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } + /* Check that the suffix length is greater enough for the numerical + suffix count from value. */ + if (suffix_count_from) + { + size_t start = suffix_count_from; + size_t length = suffix_length; + + while (start) + { + if (length == 0) + { + error (0, 0, _("numerical suffix FROM number too hight\ + for the suffix length")); + usage (EXIT_FAILURE); + } + start /= 10; + length--; + } + } + /* Open the input file. */ if (! STREQ (infile, "-") && fd_reopen (STDIN_FILENO, infile, O_RDONLY, 0) < 0) -- 1.7.2.5 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 05:30:19 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 10:30:19 +0000 Received: from localhost ([127.0.0.1]:44635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RroV8-0005SL-B2 for submit@debbugs.gnu.org; Mon, 30 Jan 2012 05:30:18 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:37803) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RroV4-0005S6-5R for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 05:30:15 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AswBAPZwJk9tTEVT/2dsb2JhbAAMMQaEOVKdI48hAQEBBAwXDwFGEAkCDQQDAQIBAgIFDAoLAgIJAwIBAgEPLggGDQEFAgEBrxmRJoEvhnAeAQQDBAkBAwwEAwQLCoMnHQIKFlgCCjuCEoEWBJsShQ2HTA Received: from unknown (HELO [192.168.1.79]) ([109.76.69.83]) by mail2.vodafone.ie with ESMTP; 30 Jan 2012 10:29:35 +0000 Message-ID: <4F26710E.1050900@draigBrady.com> Date: Mon, 30 Jan 2012 10:29:34 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: =?UTF-8?B?SsOpcsOpbXkgQ29tcG9zdGVsbGE=?= Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. References: <874nvekuji.fsf@Apollo.jerryland.fr> In-Reply-To: <874nvekuji.fsf@Apollo.jerryland.fr> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 01/29/2012 10:34 PM, Jérémy Compostella wrote: > Pádraig, Sci-Fi, others, > > I made an implementation of the requested feature. With the attached > patch applied the split command accepts a new optional "from" argument > for the --numeric-suffixes (aka -d) option. If this argument is > specified, the numeric suffix counts from this value, otherwise, like > before, it counts from 0. > > I've tried to not impact the performance, to not break anything and to > respect the coding rules but feel free to comment this patch. I will > take into account whatever you may want. Thanks again for looking at this. It's a useful feature for the presented use case, or for supporting multiple independent split invocations. Note we rarely change an option to have optional args. For optional args, no space is allowed between option name and value. I.E. --numeric-suffixes=10 or -d10 is required, which is a little restrictive. More problematically though, existing scripts using the short options -de or -du in combination will break. The -eu options are relatively new though, so I'm leaning towards this being acceptable. Hmm, this unusual form would fail too, `split -da3 ...`. The failure mode is immediate and obvious, but this worries me a bit. I wonder might we have a separate option, --suffix-start, and theoretically that could accept alphabetic options too? I'm not suggesting we do this, but it's worth discussing. >>From 82cbcf36e1fc9901964b6a348b495739357f28ee Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Sun, 29 Jan 2012 15:20:31 +0100 Subject: [PATCH] split: --numeric-suffixes new optional "from" argument (bug#9085) + -d[FROM], --numeric-suffixes[FROM] use numeric suffixes instead of alphabetic.\n\ + When specified, start counting from FROM, 0 otherwise\n\ s/-d[FROM], --numeric-suffixes[FROM]/-d, --numeric-suffixes[=FROM] -e, --elide-empty-files do not generate empty output files with '-n'\n\ --filter=COMMAND write to shell COMMAND; file name is $FILE\n\ -l, --lines=NUMBER put NUMBER lines per output file\n\ @@ -231,6 +235,7 @@ next_file_name (void) { /* Index in suffix_alphabet of each character in the suffix. */ static size_t *sufindex; + size_t i = suffix_length; if (! outfile) { @@ -243,9 +248,23 @@ next_file_name (void) outfile = xmalloc (outfile_length + 1); outfile_mid = outfile + outbase_length; memcpy (outfile, outbase, outbase_length); - memset (outfile_mid, suffix_alphabet[0], suffix_length); - outfile[outfile_length] = 0; sufindex = xcalloc (suffix_length, sizeof *sufindex); + /* Initialize the suffix index accordingly to the count from + value. */ + { + size_t left = suffix_count_from; + while (i-- != 0) + { + if (left) + { + sufindex[i] = left % 10; + left /= 10; + } + outfile_mid[i] = suffix_alphabet[sufindex[i]]; + } + } + + outfile[outfile_length] = 0; #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX /* POSIX requires that if the output file name is too long for @@ -265,7 +284,6 @@ next_file_name (void) { /* Increment the suffix in place, if possible. */ - size_t i = suffix_length; while (i-- != 0) { sufindex[i]++; @@ -1016,7 +1034,7 @@ main (int argc, char **argv) int this_optind = optind ? optind : 1; char *slash; - c = getopt_long (argc, argv, "0123456789C:a:b:del:n:u", + c = getopt_long (argc, argv, "0123456789C:a:b:d::el:n:u", longopts, NULL); if (c == -1) break; @@ -1142,6 +1160,19 @@ main (int argc, char **argv) case 'd': suffix_alphabet = "0123456789"; + if (optarg) + { + unsigned long tmp; + if (xstrtoul (optarg, NULL, 10, &tmp, "") != LONGINT_OK + || SIZE_MAX / sizeof (size_t) < tmp) Note the SIZE_MAX/sizeof(size_t) restriction was on the -a option, as that is later used in a malloc. For -d there would be no such restriction, so I'd just use xstrtoumax() != LONGINT_OK cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 06:00:20 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 11:00:20 +0000 Received: from localhost ([127.0.0.1]:44657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RroyC-00068b-08 for submit@debbugs.gnu.org; Mon, 30 Jan 2012 06:00:20 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:61338) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rroy7-00068M-J7 for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 06:00:18 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AswBANl3Jk9tTEVT/2dsb2JhbAAMMQaEOVKnH4UlAQEBBAwXDwFGEAkCDQsCAgUMCgsCAgkDAgECAUUGDQEHAQGvH5EpgS+GcB4BBAMECQEDDAQDBAsKNYJyHQIKFlgCCjuCEoEWBJsSjFk Received: from unknown (HELO [192.168.1.79]) ([109.76.69.83]) by mail2.vodafone.ie with ESMTP; 30 Jan 2012 10:59:59 +0000 Message-ID: <4F26782F.4070203@draigBrady.com> Date: Mon, 30 Jan 2012 10:59:59 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: =?UTF-8?B?SsOpcsOpbXkgQ29tcG9zdGVsbGE=?= Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. References: <874nvekuji.fsf@Apollo.jerryland.fr> <4F26710E.1050900@draigBrady.com> In-Reply-To: <4F26710E.1050900@draigBrady.com> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 01/30/2012 10:29 AM, Pádraig Brady wrote: > On 01/29/2012 10:34 PM, Jérémy Compostella wrote: >> Pádraig, Sci-Fi, others, >> >> I made an implementation of the requested feature. With the attached >> patch applied the split command accepts a new optional "from" argument >> for the --numeric-suffixes (aka -d) option. If this argument is >> specified, the numeric suffix counts from this value, otherwise, like >> before, it counts from 0. >> >> I've tried to not impact the performance, to not break anything and to >> respect the coding rules but feel free to comment this patch. I will >> take into account whatever you may want. > > Thanks again for looking at this. > It's a useful feature for the presented use case, > or for supporting multiple independent split invocations. > > Note we rarely change an option to have optional args. > For optional args, no space is allowed between option name and value. > I.E. --numeric-suffixes=10 or -d10 is required, which is a little restrictive. > More problematically though, existing scripts using the short options -de or -du in > combination will break. The -eu options are relatively new though, so I'm leaning > towards this being acceptable. Hmm, this unusual form would fail too, `split -da3 ...`. > The failure mode is immediate and obvious, but this worries me a bit. > > I wonder might we have a separate option, --suffix-start, > and theoretically that could accept alphabetic options too? > I'm not suggesting we do this, but it's worth discussing. Think a bit more about it, it's probably worth to split the short and long options. Have -d not take a param as before, and have --numeric-suffixes take an optional param. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 06:07:37 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 11:07:37 +0000 Received: from localhost ([127.0.0.1]:44663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrp5F-0006Id-CJ for submit@debbugs.gnu.org; Mon, 30 Jan 2012 06:07:37 -0500 Received: from mx.meyering.net ([88.168.87.75]:48330) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrp5D-0006IV-2I for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 06:07:36 -0500 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 1145C600D9; Mon, 30 Jan 2012 12:07:24 +0100 (CET) From: Jim Meyering To: =?iso-8859-1?Q?P=E1draig?= Brady Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. In-Reply-To: <4F26782F.4070203@draigBrady.com> (=?iso-8859-1?Q?=22P=E1drai?= =?iso-8859-1?Q?g?= Brady"'s message of "Mon, 30 Jan 2012 10:59:59 +0000") References: <874nvekuji.fsf@Apollo.jerryland.fr> <4F26710E.1050900@draigBrady.com> <4F26782F.4070203@draigBrady.com> Date: Mon, 30 Jan 2012 12:07:23 +0100 Message-ID: <87sjixmot0.fsf@rho.meyering.net> Lines: 41 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, =?iso-8859-1?Q?J=E9r=E9my?= Compostella X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) P=E1draig Brady wrote: > On 01/30/2012 10:29 AM, P=E1draig Brady wrote: >> On 01/29/2012 10:34 PM, J=E9r=E9my Compostella wrote: >>> P=E1draig, Sci-Fi, others, >>> >>> I made an implementation of the requested feature. With the attached >>> patch applied the split command accepts a new optional "from" argument >>> for the --numeric-suffixes (aka -d) option. If this argument is >>> specified, the numeric suffix counts from this value, otherwise, like >>> before, it counts from 0. >>> >>> I've tried to not impact the performance, to not break anything and to >>> respect the coding rules but feel free to comment this patch. I will >>> take into account whatever you may want. >> >> Thanks again for looking at this. >> It's a useful feature for the presented use case, >> or for supporting multiple independent split invocations. >> >> Note we rarely change an option to have optional args. >> For optional args, no space is allowed between option name and value. >> I.E. --numeric-suffixes=3D10 or -d10 is required, which is a little rest= rictive. >> More problematically though, existing scripts using the short >> options -de or -du in >> combination will break. The -eu options are relatively new though, >> so I'm leaning >> towards this being acceptable. Hmm, this unusual form would fail >> too, `split -da3 ...`. >> The failure mode is immediate and obvious, but this worries me a bit. >> >> I wonder might we have a separate option, --suffix-start, >> and theoretically that could accept alphabetic options too? >> I'm not suggesting we do this, but it's worth discussing. > > Think a bit more about it, it's probably worth to split > the short and long options. Have -d not take a param as before, > and have --numeric-suffixes take an optional param. I agree. We try hard to avoid short options with optional args for the reasons you've outlined above. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 07:05:38 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 12:05:38 +0000 Received: from localhost ([127.0.0.1]:44847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrpzN-0007l1-QB for submit@debbugs.gnu.org; Mon, 30 Jan 2012 07:05:38 -0500 Received: from mail-tul01m020-f172.google.com ([209.85.214.172]:55891) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrpzJ-0007km-16 for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 07:05:35 -0500 Received: by obbwc12 with SMTP id wc12so3871844obb.3 for <9085@debbugs.gnu.org>; Mon, 30 Jan 2012 04:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cMt03ovUJYbL+IxUvv485c8Yr81q8B8R6P19uhyenH8=; b=E6qvfqo18FlMqe2Mki4n3flbJmHau7SYhjw/G5cYxpcLeS9B42gNwVYT0Yy2CyXp6M +L4mMjVHVykqBidCa61b4ZWPD7tYkPC8S42jc8GjUYALUn7+V+sqkr/7+WTzd2ZgL++O QfT1cRaSgLa05M0egKWEMqStUnE3Z2zXvHbdE= MIME-Version: 1.0 Received: by 10.182.155.98 with SMTP id vv2mr28290123obb.26.1327925117867; Mon, 30 Jan 2012 04:05:17 -0800 (PST) Received: by 10.60.18.197 with HTTP; Mon, 30 Jan 2012 04:05:17 -0800 (PST) Received: by 10.60.18.197 with HTTP; Mon, 30 Jan 2012 04:05:17 -0800 (PST) In-Reply-To: <87sjixmot0.fsf@rho.meyering.net> References: <874nvekuji.fsf@Apollo.jerryland.fr> <4F26710E.1050900@draigBrady.com> <4F26782F.4070203@draigBrady.com> <87sjixmot0.fsf@rho.meyering.net> Date: Mon, 30 Jan 2012 13:05:17 +0100 Message-ID: Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. From: =?ISO-8859-1?Q?J=E9r=E9my_Compostella?= To: Jim Meyering Content-Type: multipart/alternative; boundary=f46d0447f196f055da04b7bda85c X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, =?ISO-8859-1?Q?P=E1draig_Brady?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --f46d0447f196f055da04b7bda85c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks to both you for looking at this patch. I'm a bit busy right now. I will take your proposition into account as soon as possible. Exceptionaly, I do not have access to a computer during the day this week. I only have access to my mailbox via my phone. Cheers, Jeremy Le 30 janv. 2012 12:07, "Jim Meyering" a =E9crit : > P=E1draig Brady wrote: > > On 01/30/2012 10:29 AM, P=E1draig Brady wrote: > >> On 01/29/2012 10:34 PM, J=E9r=E9my Compostella wrote: > >>> P=E1draig, Sci-Fi, others, > >>> > >>> I made an implementation of the requested feature. With the attached > >>> patch applied the split command accepts a new optional "from" argumen= t > >>> for the --numeric-suffixes (aka -d) option. If this argument is > >>> specified, the numeric suffix counts from this value, otherwise, like > >>> before, it counts from 0. > >>> > >>> I've tried to not impact the performance, to not break anything and t= o > >>> respect the coding rules but feel free to comment this patch. I will > >>> take into account whatever you may want. > >> > >> Thanks again for looking at this. > >> It's a useful feature for the presented use case, > >> or for supporting multiple independent split invocations. > >> > >> Note we rarely change an option to have optional args. > >> For optional args, no space is allowed between option name and value. > >> I.E. --numeric-suffixes=3D10 or -d10 is required, which is a little > restrictive. > >> More problematically though, existing scripts using the short > >> options -de or -du in > >> combination will break. The -eu options are relatively new though, > >> so I'm leaning > >> towards this being acceptable. Hmm, this unusual form would fail > >> too, `split -da3 ...`. > >> The failure mode is immediate and obvious, but this worries me a bit. > >> > >> I wonder might we have a separate option, --suffix-start, > >> and theoretically that could accept alphabetic options too? > >> I'm not suggesting we do this, but it's worth discussing. > > > > Think a bit more about it, it's probably worth to split > > the short and long options. Have -d not take a param as before, > > and have --numeric-suffixes take an optional param. > > I agree. > We try hard to avoid short options with optional args > for the reasons you've outlined above. > --f46d0447f196f055da04b7bda85c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Thanks to both you for looking at this patch.

I'm a bit busy right now. I will take your proposition into account = as soon as possible. Exceptionaly, I do not have access to a computer durin= g the day this week. I only have access to my mailbox via my phone.

Cheers,

Jeremy

Le 30 janv. 2012 12:07, "Jim Meyering"= <jim@meyering.net> a =E9crit= =A0:
P=E1draig Brady wrote:
> On 01/30/2012 10:29 AM, P=E1draig Brady wrote:
>> On 01/29/2012 10:34 PM, J=E9r=E9my Compostella wrote:
>>> P=E1draig, Sci-Fi, others,
>>>
>>> I made an implementation of the requested feature. With the at= tached
>>> patch applied the split command accepts a new optional "f= rom" argument
>>> for the --numeric-suffixes (aka -d) option. If this argument i= s
>>> specified, the numeric suffix counts from this value, otherwis= e, like
>>> before, it counts from 0.
>>>
>>> I've tried to not impact the performance, to not break any= thing and to
>>> respect the coding rules but feel free to comment this patch. = I will
>>> take into account whatever you may want.
>>
>> Thanks again for looking at this.
>> It's a useful feature for the presented use case,
>> or for supporting multiple independent split invocations.
>>
>> Note we rarely change an option to have optional args.
>> For optional args, no space is allowed between option name and val= ue.
>> I.E. --numeric-suffixes=3D10 or -d10 is required, which is a littl= e restrictive.
>> More problematically though, existing scripts using the short
>> options -de or -du in
>> combination will break. =A0The -eu options are relatively new thou= gh,
>> so I'm leaning
>> towards this being acceptable. Hmm, this unusual form would fail >> too, `split -da3 ...`.
>> The failure mode is immediate and obvious, but this worries me a b= it.
>>
>> I wonder might we have a separate option, --suffix-start,
>> and theoretically that could accept alphabetic options too?
>> I'm not suggesting we do this, but it's worth discussing.<= br> >
> Think a bit more about it, it's probably worth to split
> the short and long options. Have -d not take a param as before,
> and have --numeric-suffixes take an optional param.

I agree.
We try hard to avoid short options with optional args
for the reasons you've outlined above.
--f46d0447f196f055da04b7bda85c-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 12:33:29 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 17:33:29 +0000 Received: from localhost ([127.0.0.1]:45450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrv6e-0007mH-HA for submit@debbugs.gnu.org; Mon, 30 Jan 2012 12:33:28 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:56458) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrv6c-0007m6-JA for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 12:33:27 -0500 Received: by wicr5 with SMTP id r5so3378448wic.3 for <9085@debbugs.gnu.org>; Mon, 30 Jan 2012 09:33:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:cc:date:message-id:mime-version:content-type :content-transfer-encoding; bh=fNbVCIFojcH31Pc4WNY1x94uqNJzloy72wiBUd25X0E=; b=BXVR974WZ5bQDH4qyMibKCTm/vCb9Vchg+1xcwsFBQtI5B8vvaDP8gfbvTTTquBKYs nc5k3nozxRuUUCtCGrYfMU6zlWKCK507loUell96OFxYcOD5Fya+N97dPObRYGSe6DvE +RmuJdsrZ0sGy8RE6y/pzzZYVV4yVhIpNFlkM= Received: by 10.180.99.199 with SMTP id es7mr28928850wib.10.1327944790312; Mon, 30 Jan 2012 09:33:10 -0800 (PST) Received: from Apollo.jerryland.fr ([85.69.251.50]) by mx.google.com with ESMTPS id y1sm2733433wiw.6.2012.01.30.09.33.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jan 2012 09:33:09 -0800 (PST) From: =?utf-8?Q?J=C3=A9r=C3=A9my_Compostella?= To: =?utf-8?Q?P=C3=A1draig?= Brady , Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. Date: Mon, 30 Jan 2012 18:33:28 +0100 Message-ID: <871uqhksd3.fsf@Apollo.jerryland.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) P=C3=A1draig, Jim, others, - Solution 1: P=C3=A1draig wrotes: > I wonder might we have a separate option, --suffix-start, and > theoretically that could accept alphabetic options too? I'm not > suggesting we do this, but it's worth discussion. That's was my first idea but since your first mail subject was "split --numeric-suffixes=3DN" I assumed that you already thought about it as a bad solution. Wrong assumption I guess. - Solution 2: P=C3=A1draig wrotes: > Thinking a bit more about it, it's probably worth to split the short > and long options. Have -d not take a param as before, and have > --numeric-suffixes take an optional param. > To do this, leave 'optional_argument' in the long_opts array, and just > remove the :: from the getopts call. Personally, I do prefer the "Solution 1" since the result looks more consistent, more powerful andf does not change anything to the current options. However, it needs more work. It's a very particular week for me and I will probably miss time and energy to work on this solution before next week-end. Anyway, we can talk about the best solution to implement so let me know. - Note: P=C3=A1draig wrotes: > Note the SIZE_MAX/sizeof(size_t) restriction was on the -a option, as > that is later used in a malloc. For -d there would be no such > restriction, so I'd just use xstrtoumax() !=3D LONGINT_OK OK, thanks for the note and explanation, I will take this into account. Cheers, J=C3=A9r=C3=A9my From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 12:45:21 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 17:45:21 +0000 Received: from localhost ([127.0.0.1]:45461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrvI8-000855-CB for submit@debbugs.gnu.org; Mon, 30 Jan 2012 12:45:21 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:35579) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrvI5-00084m-RK for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 12:45:19 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoBAMjWJk9tTEVT/2dsb2JhbAAMN4Q5UqcfhSQBAQEDAQwXDwFGBQsJAg0LAgIFFgsCAgkDAgECAUUGDQEHAQEXh2GmZJFOgS+HDgEEAwQJAQMMBAMECwo1gnIdAgoWWAIKgk2BFgSbEoxZ Received: from unknown (HELO [192.168.1.79]) ([109.76.69.83]) by mail2.vodafone.ie with ESMTP; 30 Jan 2012 17:44:42 +0000 Message-ID: <4F26D706.8030309@draigBrady.com> Date: Mon, 30 Jan 2012 17:44:38 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: =?UTF-8?B?SsOpcsOpbXkgQ29tcG9zdGVsbGE=?= Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. References: <871uqhksd3.fsf@Apollo.jerryland.fr> In-Reply-To: <871uqhksd3.fsf@Apollo.jerryland.fr> X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 01/30/2012 05:33 PM, Jérémy Compostella wrote: > Pádraig, Jim, others, > > - Solution 1: > Pádraig wrotes: >> I wonder might we have a separate option, --suffix-start, and >> theoretically that could accept alphabetic options too? I'm not >> suggesting we do this, but it's worth discussion. > That's was my first idea but since your first mail subject was "split > --numeric-suffixes=N" I assumed that you already thought about it as a > bad solution. Wrong assumption I guess. > > - Solution 2: > Pádraig wrotes: >> Thinking a bit more about it, it's probably worth to split the short >> and long options. Have -d not take a param as before, and have >> --numeric-suffixes take an optional param. >> To do this, leave 'optional_argument' in the long_opts array, and just >> remove the :: from the getopts call. My vote is for solution 2. Less options = simpler interface for users. I don't think it's too onerous to mandate, numeric suffixes for this feature. > Personally, I do prefer the "Solution 1" since the result looks more > consistent, more powerful andf does not change anything to the current > options. > > However, it needs more work. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 13:07:52 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 18:07:52 +0000 Received: from localhost ([127.0.0.1]:45502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrvdw-0000Bl-2i for submit@debbugs.gnu.org; Mon, 30 Jan 2012 13:07:52 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:44942) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrvds-0000BQ-KD for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 13:07:50 -0500 Received: by werm10 with SMTP id m10so3391982wer.3 for <9085@debbugs.gnu.org>; Mon, 30 Jan 2012 10:07:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:cc:date:message-id:mime-version:content-type; bh=t+0mDiDwi1/JekV8UgkGMdvsc9DwOBgkOrjjaNXpNqs=; b=lKkcFXXQpHQbzWRgSB4wKjYQf+qRxPAA23qaDVqWUbMwROloRgiNqIZ13R0wIvnpic xIANzQYCB3U3m6meWVurtVOhvlVCU+phsbvV9v9aW1l6ttQZCCpsm0ewjBFz7q7N8CZH MJZWXeArWEDJJClNhzHy2xf7Q9X2DXT/yb8E4= Received: by 10.216.133.26 with SMTP id p26mr7632593wei.36.1327946851759; Mon, 30 Jan 2012 10:07:31 -0800 (PST) Received: from Apollo.jerryland.fr ([85.69.251.50]) by mx.google.com with ESMTPS id l8sm54696472wiy.5.2012.01.30.10.07.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jan 2012 10:07:31 -0800 (PST) From: =?utf-8?Q?J=C3=A9r=C3=A9my_Compostella?= To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. Date: Mon, 30 Jan 2012 19:07:49 +0100 Message-ID: <87y5spjc7e.fsf@Apollo.jerryland.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable P=C3=A1draig wrotes: > On 01/30/2012 05:33 PM, J=C3=A9r=C3=A9my Compostella wrote: > > P=C3=A1draig, Jim, others, > > > > - Solution 1: > > P=C3=A1draig wrotes: > >> I wonder might we have a separate option, --suffix-start, and > >> theoretically that could accept alphabetic options too? I'm not > >> suggesting we do this, but it's worth discussion. > > That's was my first idea but since your first mail subject was "split > > --numeric-suffixes=3DN" I assumed that you already thought about it as a > > bad solution. Wrong assumption I guess. > > > > - Solution 2: > > P=C3=A1draig wrotes: > >> Thinking a bit more about it, it's probably worth to split the short > >> and long options. Have -d not take a param as before, and have > >> --numeric-suffixes take an optional param. > >> To do this, leave 'optional_argument' in the long_opts array, and just > >> remove the :: from the getopts call. >=20 > My vote is for solution 2. > Less options =3D simpler interface for users. > I don't think it's too onerous to mandate, > numeric suffixes for this feature. OK, I attached the updated patch. If nobody does challenge the "Solution 2" I think we have the appropriate implementation. Note: I just received my coreutils assignment PDF file. I will print it and send it this week. Cheers, Jeremy --- --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-split-numeric-suffixes-new-optional-from-argument-bu.patch Content-Description: split: --numeric-suffixes new optional "from" argument (bug#9085) patch >From 79f08eef51b5651f153e0bacaab28c1da73c6517 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Sun, 29 Jan 2012 15:20:31 +0100 Subject: [PATCH] split: --numeric-suffixes new optional "from" argument (bug#9085) The split command now accepts a new optional "from" argument for the --numeric-suffixes option. If this argument is specified, the numeric suffix counts from this value, otherwise, like before, it counts from 0. Signed-off-by: Jeremy Compostella --- NEWS | 6 +++++ doc/coreutils.texi | 5 ++- src/split.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 2b0926f..083e047 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + split now accept an optional "from" value for the + --numeric-suffixes option. If this argument is specified, the + numeric suffix counts from this value, otherwise, like before, it + counts from 0. * Noteworthy changes in release 8.15 (2012-01-06) [stable] diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 0d3b739..2d2ba32 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -3084,10 +3084,11 @@ and so can be a pipe for example. Use suffixes of length @var{length}. The default @var{length} is 2. @item -d -@itemx --numeric-suffixes +@itemx --numeric-suffixes[=@var{from}] @opindex -d @opindex --numeric-suffixes -Use digits in suffixes rather than lower-case letters. +Use digits in suffixes rather than lower-case letters. The numerical +suffix counts from @var{from} if specified, 0 otherwise. @item -e @itemx --elide-empty-files diff --git a/src/split.c b/src/split.c index 5fbce0e..ca72637 100644 --- a/src/split.c +++ b/src/split.c @@ -80,6 +80,9 @@ static size_t suffix_length; /* Alphabet of characters to use in suffix. */ static char const *suffix_alphabet = "abcdefghijklmnopqrstuvwxyz"; +/* Numerical suffix count from value. */ +static unsigned long suffix_count_from; + /* Name of input file. May be "-". */ static char *infile; @@ -122,7 +125,7 @@ static struct option const longopts[] = {"elide-empty-files", no_argument, NULL, 'e'}, {"unbuffered", no_argument, NULL, 'u'}, {"suffix-length", required_argument, NULL, 'a'}, - {"numeric-suffixes", no_argument, NULL, 'd'}, + {"numeric-suffixes", optional_argument, NULL, 'd'}, {"filter", required_argument, NULL, FILTER_OPTION}, {"verbose", no_argument, NULL, VERBOSE_OPTION}, {"-io-blksize", required_argument, NULL, @@ -195,7 +198,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -a, --suffix-length=N use suffixes of length N (default %d)\n\ -b, --bytes=SIZE put SIZE bytes per output file\n\ -C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\ - -d, --numeric-suffixes use numeric suffixes instead of alphabetic\n\ + -d, --numeric-suffixes[FROM] use numeric suffixes instead of alphabetic.\n\ + When specified, start counting from FROM, 0 otherwise\n\ -e, --elide-empty-files do not generate empty output files with '-n'\n\ --filter=COMMAND write to shell COMMAND; file name is $FILE\n\ -l, --lines=NUMBER put NUMBER lines per output file\n\ @@ -231,6 +235,7 @@ next_file_name (void) { /* Index in suffix_alphabet of each character in the suffix. */ static size_t *sufindex; + size_t i = suffix_length; if (! outfile) { @@ -243,9 +248,23 @@ next_file_name (void) outfile = xmalloc (outfile_length + 1); outfile_mid = outfile + outbase_length; memcpy (outfile, outbase, outbase_length); - memset (outfile_mid, suffix_alphabet[0], suffix_length); - outfile[outfile_length] = 0; sufindex = xcalloc (suffix_length, sizeof *sufindex); + /* Initialize the suffix index accordingly to the count from + value. */ + { + unsigned long left = suffix_count_from; + while (i-- != 0) + { + if (left) + { + sufindex[i] = left % 10; + left /= 10; + } + outfile_mid[i] = suffix_alphabet[sufindex[i]]; + } + } + + outfile[outfile_length] = 0; #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX /* POSIX requires that if the output file name is too long for @@ -265,7 +284,6 @@ next_file_name (void) { /* Increment the suffix in place, if possible. */ - size_t i = suffix_length; while (i-- != 0) { sufindex[i]++; @@ -1142,6 +1160,18 @@ main (int argc, char **argv) case 'd': suffix_alphabet = "0123456789"; + if (optarg) + { + unsigned long tmp; + if (xstrtoul (optarg, NULL, 10, &tmp, "") != LONGINT_OK) + { + error (0, 0, _("%s: invalid count from numerical suffix number"), + optarg); + usage (EXIT_FAILURE); + } + else + suffix_count_from = tmp; + } break; case 'e': @@ -1212,6 +1242,26 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } + /* Check that the suffix length is greater enough for the numerical + suffix count from value. */ + if (suffix_count_from) + { + unsigned long start = suffix_count_from; + size_t length = suffix_length; + + while (start) + { + if (length == 0) + { + error (0, 0, _("numerical suffix FROM number too hight\ + for the suffix length")); + usage (EXIT_FAILURE); + } + start /= 10; + length--; + } + } + /* Open the input file. */ if (! STREQ (infile, "-") && fd_reopen (STDIN_FILENO, infile, O_RDONLY, 0) < 0) -- 1.7.2.5 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 14:14:38 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 19:14:38 +0000 Received: from localhost ([127.0.0.1]:45592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrwgY-0002bQ-GR for submit@debbugs.gnu.org; Mon, 30 Jan 2012 14:14:38 -0500 Received: from mx.meyering.net ([88.168.87.75]:49665) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrwgW-0002bI-4q for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 14:14:37 -0500 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 47F56600A3; Mon, 30 Jan 2012 20:14:23 +0100 (CET) From: Jim Meyering To: =?iso-8859-1?Q?P=E1draig?= Brady Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. In-Reply-To: <4F26D706.8030309@draigBrady.com> (=?iso-8859-1?Q?=22P=E1drai?= =?iso-8859-1?Q?g?= Brady"'s message of "Mon, 30 Jan 2012 17:44:38 +0000") References: <871uqhksd3.fsf@Apollo.jerryland.fr> <4F26D706.8030309@draigBrady.com> Date: Mon, 30 Jan 2012 20:14:23 +0100 Message-ID: <87ehuhknow.fsf@rho.meyering.net> Lines: 32 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, =?iso-8859-1?Q?J=E9r=E9my?= Compostella X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) P=E1draig Brady wrote: > On 01/30/2012 05:33 PM, J=E9r=E9my Compostella wrote: >> P=E1draig, Jim, others, >> >> - Solution 1: >> P=E1draig wrotes: >>> I wonder might we have a separate option, --suffix-start, and >>> theoretically that could accept alphabetic options too? I'm not >>> suggesting we do this, but it's worth discussion. >> That's was my first idea but since your first mail subject was "split >> --numeric-suffixes=3DN" I assumed that you already thought about it as a >> bad solution. Wrong assumption I guess. >> >> - Solution 2: >> P=E1draig wrotes: >>> Thinking a bit more about it, it's probably worth to split the short >>> and long options. Have -d not take a param as before, and have >>> --numeric-suffixes take an optional param. >>> To do this, leave 'optional_argument' in the long_opts array, and just >>> remove the :: from the getopts call. > > My vote is for solution 2. > Less options =3D simpler interface for users. > I don't think it's too onerous to mandate, > numeric suffixes for this feature. Same here. Another reason to avoid adding --suffix is that it would invalidate -- rendering ambiguous -- any existing use of split that takes advantage of --suffix (or --s for that matter) being an abbreviation of the --suffix-length option name. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 14:29:42 2012 Received: (at 9085) by debbugs.gnu.org; 30 Jan 2012 19:29:42 +0000 Received: from localhost ([127.0.0.1]:45611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrwv7-0002wo-R3 for submit@debbugs.gnu.org; Mon, 30 Jan 2012 14:29:42 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:44153) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrwv5-0002wa-5H for 9085@debbugs.gnu.org; Mon, 30 Jan 2012 14:29:40 -0500 Received: by werm10 with SMTP id m10so3462729wer.3 for <9085@debbugs.gnu.org>; Mon, 30 Jan 2012 11:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:cc:date:message-id:mime-version:content-type :content-transfer-encoding; bh=2qLuC1SRwetC0ixBEIhWYeQceum3o0YtvEOpUtJBekQ=; b=TS6/ctPC23L8Ln1hgFegqjvJH1jpxi08UBN9zhKOF+jbP46lSUmawSNIItLgPB2Gvd SMtxUGJd9VCoXmZOJBupEmN61Bw3ndbcfFJc8GuPLOaIqgK7wUOoiot0QvCspTib9ymi auX9PI0YQonhNa0/4ymjvFPPSG8qjuuSdGdsI= Received: by 10.216.135.169 with SMTP id u41mr1771341wei.13.1327951762381; Mon, 30 Jan 2012 11:29:22 -0800 (PST) Received: from Apollo.jerryland.fr ([85.69.251.50]) by mx.google.com with ESMTPS id y1sm3704127wiw.6.2012.01.30.11.29.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jan 2012 11:29:21 -0800 (PST) From: =?utf-8?Q?J=C3=A9r=C3=A9my_Compostella?= To: Jim Meyering Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. Date: Mon, 30 Jan 2012 20:29:40 +0100 Message-ID: <87vcntj8ez.fsf@Apollo.jerryland.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, =?utf-8?Q?P=C3=A1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > P=C3=A1draig Brady wrote: > > On 01/30/2012 05:33 PM, J=C3=A9r=C3=A9my Compostella wrote: > >> P=C3=A1draig, Jim, others, > >> > >> - Solution 1: > >> P=C3=A1draig wrotes: > >>> I wonder might we have a separate option, --suffix-start, and > >>> theoretically that could accept alphabetic options too? I'm not > >>> suggesting we do this, but it's worth discussion. > >> That's was my first idea but since your first mail subject was "split > >> --numeric-suffixes=3DN" I assumed that you already thought about it as= a > >> bad solution. Wrong assumption I guess. > >> > >> - Solution 2: > >> P=C3=A1draig wrotes: > >>> Thinking a bit more about it, it's probably worth to split the short > >>> and long options. Have -d not take a param as before, and have > >>> --numeric-suffixes take an optional param. > >>> To do this, leave 'optional_argument' in the long_opts array, and just > >>> remove the :: from the getopts call. > > > > My vote is for solution 2. > > Less options =3D simpler interface for users. > > I don't think it's too onerous to mandate, > > numeric suffixes for this feature. >=20 > Same here. > Another reason to avoid adding --suffix is that it would > invalidate -- rendering ambiguous -- any existing use of split that takes > advantage of --suffix (or --s for that matter) being an abbreviation > of the --suffix-length option name. OK I understand that too. However, IMHO it could be avoid with a not "suffix" prefixed option name, like --numeric-suffixes does in a sense, no ? Anyway, I'm completely new in its project so I learn from you. Cheers, Jeremy From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 06 08:59:46 2012 Received: (at 9085) by debbugs.gnu.org; 6 Feb 2012 13:59:46 +0000 Received: from localhost ([127.0.0.1]:56519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RuP6b-0002T0-6b for submit@debbugs.gnu.org; Mon, 06 Feb 2012 08:59:46 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:36771) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RuP6U-0002Sh-7p for 9085@debbugs.gnu.org; Mon, 06 Feb 2012 08:59:40 -0500 Received: by werm10 with SMTP id m10so4334615wer.3 for <9085@debbugs.gnu.org>; Mon, 06 Feb 2012 05:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:cc:date:message-id:mime-version:content-type; bh=UXhUA3Mkw3QTBFYdslDPRV8XgvZF9sxn+HuXP/a5sko=; b=Y4eSNYiYIR/eFgU1xR09e6w/l3IXmIIHuY7r0/yZ29ZsiMnwFfSafe78G4wlITJY4Q 6U7zQUsDLJNYDcE9bZ6WFnakBeNbLRHylcEHYFkRZeO8D6Q8jLJq9f02OvZ7N8WctjHy p0tAkf6i2Gr7/rVOkYqo5pTO4Bh95wrvPNwrc= Received: by 10.216.139.147 with SMTP id c19mr7164951wej.11.1328536718410; Mon, 06 Feb 2012 05:58:38 -0800 (PST) Received: from Apollo.jerryland.fr ([85.69.251.50]) by mx.google.com with ESMTPS id y6sm13232892wix.10.2012.02.06.05.58.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Feb 2012 05:58:37 -0800 (PST) From: =?utf-8?Q?J=C3=A9r=C3=A9my_Compostella?= To: =?utf-8?Q?P=C3=A1draig?= Brady Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. Date: Mon, 06 Feb 2012 14:58:55 +0100 Message-ID: <87vcnk3vxc.fsf@Apollo.jerryland.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering , coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable P=C3=A1draig, all, I took into account general comments on my commits. I attached the improved patch for feature. Improvements are: - Add by file description, - I put back accents on my name (J=C3=A9r=C3=A9my instead of Jeremy), - I referenced from who this feature was requested. I added a new dedicated tests suite too. Cheers, J=C3=A9r=C3=A9my --- --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-split-numeric-suffixes-new-optional-from-argument-bu.patch Content-Description: split: --numeric-suffixes new optional "from" argument (bug#9085) patch >From 71612b3319e1dbed84d1182470397718afccf846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Compostella?= Date: Sun, 29 Jan 2012 15:20:31 +0100 Subject: [PATCH] split: --numeric-suffixes new optional "from" argument (bug#9085) The split command now accepts a new optional "from" argument for the --numeric-suffixes option. If this argument is specified, the numeric suffix counts from this value, otherwise, like before, it counts from 0. * src/split.c (next_file_name): Initialize the suffix index accordingly to the count from value. (main): Check that the suffix length is greater enough for the numerical suffix count from value. * doc/coreutils.texi (split invocation): Mention it. * NEWS (New features): Mention it. * tests/split/numeric: New file. --numeric-suffixes[=FROM] option tests. * tests/Makefile.am (TESTS): Add it. Requested by SciFi. --- NEWS | 7 ++++++ doc/coreutils.texi | 5 ++- src/split.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++---- tests/Makefile.am | 1 + tests/split/numeric | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+), 7 deletions(-) create mode 100755 tests/split/numeric diff --git a/NEWS b/NEWS index 9eebbf6..f09d55d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + split now accept an optional "from" value for the + --numeric-suffixes option. If this argument is specified, the + numeric suffix counts from this value, otherwise, like before, it + counts from 0. + ** Bug fixes mv now lets you move a symlink onto a same-inode destination file that diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 52838e7..b9fb482 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -3084,10 +3084,11 @@ and so can be a pipe for example. Use suffixes of length @var{length}. The default @var{length} is 2. @item -d -@itemx --numeric-suffixes +@itemx --numeric-suffixes[=@var{from}] @opindex -d @opindex --numeric-suffixes -Use digits in suffixes rather than lower-case letters. +Use digits in suffixes rather than lower-case letters. The numerical +suffix counts from @var{from} if specified, 0 otherwise. @item -e @itemx --elide-empty-files diff --git a/src/split.c b/src/split.c index 1d0310c..c8e1a51 100644 --- a/src/split.c +++ b/src/split.c @@ -80,6 +80,9 @@ static size_t suffix_length; /* Alphabet of characters to use in suffix. */ static char const *suffix_alphabet = "abcdefghijklmnopqrstuvwxyz"; +/* Numerical suffix count from value. */ +static unsigned long suffix_count_from; + /* Name of input file. May be "-". */ static char *infile; @@ -122,7 +125,7 @@ static struct option const longopts[] = {"elide-empty-files", no_argument, NULL, 'e'}, {"unbuffered", no_argument, NULL, 'u'}, {"suffix-length", required_argument, NULL, 'a'}, - {"numeric-suffixes", no_argument, NULL, 'd'}, + {"numeric-suffixes", optional_argument, NULL, 'd'}, {"filter", required_argument, NULL, FILTER_OPTION}, {"verbose", no_argument, NULL, VERBOSE_OPTION}, {"-io-blksize", required_argument, NULL, @@ -195,7 +198,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ -a, --suffix-length=N use suffixes of length N (default %d)\n\ -b, --bytes=SIZE put SIZE bytes per output file\n\ -C, --line-bytes=SIZE put at most SIZE bytes of lines per output file\n\ - -d, --numeric-suffixes use numeric suffixes instead of alphabetic\n\ + -d, --numeric-suffixes[=FROM] use numeric suffixes instead of alphabetic.\n\ + When specified, start counting from FROM, 0 otherwise\n\ -e, --elide-empty-files do not generate empty output files with '-n'\n\ --filter=COMMAND write to shell COMMAND; file name is $FILE\n\ -l, --lines=NUMBER put NUMBER lines per output file\n\ @@ -231,6 +235,7 @@ next_file_name (void) { /* Index in suffix_alphabet of each character in the suffix. */ static size_t *sufindex; + size_t i = suffix_length; if (! outfile) { @@ -243,9 +248,23 @@ next_file_name (void) outfile = xmalloc (outfile_length + 1); outfile_mid = outfile + outbase_length; memcpy (outfile, outbase, outbase_length); - memset (outfile_mid, suffix_alphabet[0], suffix_length); - outfile[outfile_length] = 0; sufindex = xcalloc (suffix_length, sizeof *sufindex); + /* Initialize the suffix index accordingly to the count from + value. */ + { + unsigned long left = suffix_count_from; + while (i-- != 0) + { + if (left) + { + sufindex[i] = left % 10; + left /= 10; + } + outfile_mid[i] = suffix_alphabet[sufindex[i]]; + } + } + + outfile[outfile_length] = 0; #if ! _POSIX_NO_TRUNC && HAVE_PATHCONF && defined _PC_NAME_MAX /* POSIX requires that if the output file name is too long for @@ -265,7 +284,6 @@ next_file_name (void) { /* Increment the suffix in place, if possible. */ - size_t i = suffix_length; while (i-- != 0) { sufindex[i]++; @@ -1142,6 +1160,18 @@ main (int argc, char **argv) case 'd': suffix_alphabet = "0123456789"; + if (optarg) + { + unsigned long tmp; + if (xstrtoul (optarg, NULL, 10, &tmp, "") != LONGINT_OK) + { + error (0, 0, _("%s: invalid count from numerical suffix number"), + optarg); + usage (EXIT_FAILURE); + } + else + suffix_count_from = tmp; + } break; case 'e': @@ -1212,6 +1242,26 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } + /* Check that the suffix length is greater enough for the numerical + suffix count from value. */ + if (suffix_count_from) + { + unsigned long start = suffix_count_from; + size_t length = suffix_length; + + while (start) + { + if (length == 0) + { + error (0, 0, _("numerical suffix FROM number too hight\ + for the suffix length")); + usage (EXIT_FAILURE); + } + start /= 10; + length--; + } + } + /* Open the input file. */ if (! STREQ (infile, "-") && fd_reopen (STDIN_FILENO, infile, O_RDONLY, 0) < 0) diff --git a/tests/Makefile.am b/tests/Makefile.am index a94aaa2..62bbb66 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -259,6 +259,7 @@ TESTS = \ split/lines \ split/l-chunk \ split/r-chunk \ + split/numeric \ misc/stat-birthtime \ misc/stat-fmt \ misc/stat-hyphen \ diff --git a/tests/split/numeric b/tests/split/numeric new file mode 100755 index 0000000..5550d6f --- /dev/null +++ b/tests/split/numeric @@ -0,0 +1,61 @@ +#!/bin/sh +# Show that split --numeric-suffixes[=from] works. + +# Copyright (C) 2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ split + +# Check default start from 0 +printf '1\n2\n3\n4\n5\n' > in || framework_failure_ +split --numeric-suffixes --lines=2 in > out || fail=1 +cat <<\EOF > exp-1 +1 +2 +EOF +cat <<\EOF > exp-2 +3 +4 +EOF +cat <<\EOF > exp-3 +5 +EOF +compare exp-1 x00 || fail=1 +compare exp-2 x01 || fail=1 +compare exp-3 x02 || fail=1 + +# Check --numeric-suffixes=X +split --numeric-suffixes=1 --lines=2 in > out || fail=1 +cat <<\EOF > exp-1 +1 +2 +EOF +cat <<\EOF > exp-2 +3 +4 +EOF +cat <<\EOF > exp-3 +5 +EOF +compare exp-1 x01 || fail=1 +compare exp-2 x02 || fail=1 +compare exp-3 x03 || fail=1 + +# Check that split failed when suffix length is not greater enough for +# the numerical suffix count from value +fail=1 && split -a 3 --numeric-suffixes=1000 in > out 2> /dev/null || fail=0 + +Exit $fail -- 1.7.2.5 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 16 16:32:38 2012 Received: (at 9085) by debbugs.gnu.org; 16 Feb 2012 21:32:38 +0000 Received: from localhost ([127.0.0.1]:42966 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ry8wP-0004dM-U7 for submit@debbugs.gnu.org; Thu, 16 Feb 2012 16:32:38 -0500 Received: from mail-iy0-f172.google.com ([209.85.210.172]:46475) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ry8wM-0004d9-Ns for 9085@debbugs.gnu.org; Thu, 16 Feb 2012 16:32:36 -0500 Received: by iagf6 with SMTP id f6so3447181iag.3 for <9085@debbugs.gnu.org>; Thu, 16 Feb 2012 13:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=CVZdrUzw7w4O8Sapo3fle8G7MwDvA8glh5RKXrTRM70=; b=ftDJ4IgZ0c9EmYoVHZBFPywIPY/SROygiJ9YRz2p+E6gnRWOBJr/FTDjUI4XEblOMr Zi+/RqBpNcV4o4Ibns+uTZTMeHlJmUWd2JbP24qv7bue/gNnGL4jBo+aNIEam/IVefaV ddqTWd3y//T4l/dkCguDxDJSsGccyN+XvgmXY= Received: by 10.50.153.198 with SMTP id vi6mr5263124igb.30.1329427839425; Thu, 16 Feb 2012 13:30:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.29.196 with HTTP; Thu, 16 Feb 2012 13:30:19 -0800 (PST) In-Reply-To: <87vcnk3vxc.fsf@Apollo.jerryland.fr> References: <87vcnk3vxc.fsf@Apollo.jerryland.fr> From: =?ISO-8859-1?Q?J=E9r=E9my_Compostella?= Date: Thu, 16 Feb 2012 22:30:19 +0100 Message-ID: Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. To: =?ISO-8859-1?Q?P=E1draig_Brady?= Content-Type: multipart/mixed; boundary=e89a8f22c6811f9d7504b91b8ab8 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering , coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --e89a8f22c6811f9d7504b91b8ab8 Content-Type: multipart/alternative; boundary=e89a8f22c6811f9d7104b91b8ab6 --e89a8f22c6811f9d7104b91b8ab6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable P=E1draig, all, I rebased my branch for this feature and make the syntax-check success. I attached the new patch which I hope will satisfy you. Feel free to comment it, I will take into account whatever you want. Cheers, J=E9r=E9my --e89a8f22c6811f9d7104b91b8ab6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
P=E1draig, all,

I rebased my branch for this = feature and make the syntax-check
success. I attached the new pat= ch which I hope will satisfy you.

Feel free to com= ment it, I will take into account whatever you want.

Cheers,

J=E9r=E9my
--e89a8f22c6811f9d7104b91b8ab6-- --e89a8f22c6811f9d7504b91b8ab8 Content-Type: text/x-patch; charset=US-ASCII; name="0001-split-numeric-suffixes-new-optional-from-argument-bu.patch" Content-Disposition: attachment; filename="0001-split-numeric-suffixes-new-optional-from-argument-bu.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gyqaywgq1 RnJvbSA5ZTkwZjZmMjZhYjg1ZmFjMmIxNTk5ODA0ZTMxYjc4YWFhYzQyMzcwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/Sj1DMz1BOXI9QzM9QTlteT0yMENvbXBvc3Rl bGxhPz0gPGplcmVteS5jb21wb3N0ZWxsYUBnbWFpbC5jb20+CkRhdGU6IFN1biwgMjkgSmFuIDIw MTIgMTU6MjA6MzEgKzAxMDAKU3ViamVjdDogW1BBVENIXSBzcGxpdDogLS1udW1lcmljLXN1ZmZp eGVzIG5ldyBvcHRpb25hbCAiZnJvbSIgYXJndW1lbnQgKGJ1ZyM5MDg1KQoKVGhlIHNwbGl0IGNv bW1hbmQgbm93IGFjY2VwdHMgYSBuZXcgb3B0aW9uYWwgImZyb20iIGFyZ3VtZW50IGZvciB0aGUK LS1udW1lcmljLXN1ZmZpeGVzIG9wdGlvbi4gSWYgdGhpcyBhcmd1bWVudCBpcyBzcGVjaWZpZWQs IHRoZSBudW1lcmljCnN1ZmZpeCBjb3VudHMgZnJvbSB0aGlzIHZh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ndGgpOwotICAgICAgbWVtc2V0IChvdXRmaWxlX21pZCwgc3Vm Zml4X2FscGhhYmV0WzBdLCBzdWZmaXhfbGVuZ3RoKTsKLSAgICAgIG91dGZpbGVbb3V0ZmlsZV9s ZW5ndGhdID0gMDsKICAgICAgIHN1ZmluZGV4ID0geGNhbGxvYyAoc3VmZml4X2xlbmd0aCwgc2l6 ZW9mICpzdWZpbmRleCk7CisgICAgICAvKiBJbml0aWFsaXplIHRoZSBzdWZmaXggaW5kZXggYWNj b3JkaW5nbHkgdG8gdGhlIGNvdW50IGZyb20KKyAgICAgICAgIHZhbHVlLiAgKi8KKyAgICAgIHsK KyAgICAgICAgdW5zaWduZWQgbG9uZyBsZWZ0ID0gc3VmZml4X2NvdW50X2Zyb207CisgICAgICAg IHdoaWxlIChpLS0gIT0gMCkKKyAgICAgICAgICB7CisgICAgICAgICAgICBpZiAobGVmdCkKKyAg ICAgICAgICAgICAgeworICAgICAgICAgICAgICAgIHN1ZmluZGV4W2ldID0gbGVmdCAlIDEwOwor ICAgICAgICAgICAgICAgIGxlZnQgLz0gMTA7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAg IG91dGZpbGVfbWlkW2ldID0gc3VmZml4X2FscGhhYmV0W3N1ZmluZGV4W2ldXTsKKyAgICAgICAg ICB9CisgICAgICB9CisKKyAgICAgIG91dGZpbGVbb3V0ZmlsZV9sZW5ndGhdID0gMDsKIAogI2lm ICEgX1BPU0lYX05PX1RSVU5DICYmIEhBVkVfUEFUSENPTkYgJiYgZGVmaW5lZCBfUENfTkFNRV9N QVgKICAgICAgIC8qIFBPU0lYIHJlcXVpcmVzIHRoYXQgaWYgdGhlIG91dHB1dCBmaWxlIG5hbWUg aXMgdG9vIGxvbmcgZm9yCkBAIC0yNjUsNyArMjg0LDYgQEAgbmV4dF9maWxlX25hbWUgKHZvaWQp CiAgICAgewogICAgICAgLyogSW5jcmVtZW50IHRoZSBzdWZmaXggaW4gcGxhY2UsIGlmIHBvc3Np YmxlLiAgKi8KIAotICAgICAgc2l6ZV90IGkgPSBzdWZmaXhfbGVuZ3RoOwogICAgICAgd2hpbGUg KGktLSAhPSAwKQogICAgICAgICB7CiAgICAgICAgICAgc3VmaW5kZXhbaV0rKzsKQEAgLTExNDIs NiArMTE2MCwxOSBAQCBtYWluIChpbnQgYXJnYywgY2hhciAqKmFyZ3YpCiAKICAgICAgICAgY2Fz ZSAnZCc6CiAgICAgICAgICAgc3VmZml4X2FscGhhYmV0ID0gIjAxMjM0NTY3ODkiOworICAgICAg ICAgIGlmIChvcHRhcmcpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIHVuc2lnbmVkIGxv bmcgdG1wOworICAgICAgICAgICAgICBpZiAoeHN0cnRvdWwgKG9wdGFyZywgTlVMTCwgMTAsICZ0 bXAsICIiKSAhPSBMT05HSU5UX09LKQorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAg ICAgIGVycm9yICgwLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgIF8oIiVzOiBpbnZhbGlk IGNvdW50IGZyb20gbnVtZXJpY2FsIHN1ZmZpeCBudW1iZXIiKSwKKyAgICAgICAgICAgICAgICAg ICAgICAgICBvcHRhcmcpOworICAgICAgICAgICAgICAgICAgdXNhZ2UgKEVYSVRfRkFJTFVSRSk7 CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAg c3VmZml4X2NvdW50X2Zyb20gPSB0bXA7CisgICAgICAgICAgICB9CiAgICAgICAgICAgYnJlYWs7 CiAKICAgICAgICAgY2FzZSAnZSc6CkBAIC0xMjEyLDYgKzEyNDMsMjYgQEAgbWFpbiAoaW50IGFy Z2MsIGNoYXIgKiphcmd2KQogICAgICAgdXNhZ2UgKEVYSVRfRkFJTFVSRSk7CiAgICAgfQogCisg IC8qIENoZWNrIHRoYXQgdGhlIHN1ZmZpeCBsZW5ndGggaXMgZ3JlYXRlciBlbm91Z2ggZm9yIHRo ZSBudW1lcmlj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MiB8fCBmYWlsPTEK K2NvbXBhcmUgZXhwLTMgeDAzIHx8IGZhaWw9MQorCisjIENoZWNrIHRoYXQgc3BsaXQgZmFpbGVk IHdoZW4gc3VmZml4IGxlbmd0aCBpcyBub3QgZ3JlYXRlciBlbm91Z2ggZm9yCisjIHRoZSBudW1l cmljYWwgc3VmZml4IGNvdW50IGZyb20gdmFsdWUKK2ZhaWw9MSAmJiBzcGxpdCAtYSAzIC0tbnVt ZXJpYy1zdWZmaXhlcz0xMDAwIGluID4gb3V0IDI+IC9kZXYvbnVsbCB8fCBmYWlsPTAKKworRXhp dCAkZmFpbAotLSAKMS43LjIuNQoK --e89a8f22c6811f9d7504b91b8ab8-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 16 21:15:15 2012 Received: (at 9085) by debbugs.gnu.org; 17 Feb 2012 02:15:15 +0000 Received: from localhost ([127.0.0.1]:43100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RyDLv-0002xr-2l for submit@debbugs.gnu.org; Thu, 16 Feb 2012 21:15:15 -0500 Received: from mail3.vodafone.ie ([213.233.128.45]:40484) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RyDLr-0002xU-8y for 9085@debbugs.gnu.org; Thu, 16 Feb 2012 21:15:13 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskBAF22PU9tTBcG/2dsb2JhbAAMOK4fhUYBAQEEDG0QCw0LCQwIAg8JAwIBAgFFBg0BBwEBFsEci2sKARtBAYQagykEjk6MaIxp Received: from unknown (HELO [192.168.1.79]) ([109.76.23.6]) by mail3.vodafone.ie with ESMTP; 17 Feb 2012 02:13:13 +0000 Message-ID: <4F3DB7B9.6020201@draigBrady.com> Date: Fri, 17 Feb 2012 02:13:13 +0000 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: =?ISO-8859-1?Q?J=E9r=E9my_Compostella?= Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. References: <87vcnk3vxc.fsf@Apollo.jerryland.fr> In-Reply-To: X-Enigmail-Version: 1.3.2 Content-Type: multipart/mixed; boundary="------------020508000004040103070801" X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering , coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) This is a multi-part message in MIME format. --------------020508000004040103070801 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit On 02/16/2012 09:30 PM, Jérémy Compostella wrote: > Pádraig, all, > > I rebased my branch for this feature and make the syntax-check > success. I attached the new patch which I hope will satisfy you. > > Feel free to comment it, I will take into account whatever you want. 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. Also this removes the limitation of size of an unsigned int, though that's not really a practical concern I suppose. I've also attached some string and test cleanups, to --amend into your patch. cheers, Pádraig. --------------020508000004040103070801 Content-Type: text/plain; name="split-numeric-suffix-adjusments.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="split-numeric-suffix-adjusments.diff" diff --git a/NEWS b/NEWS index fae6ecc..4662919 100644 --- a/NEWS +++ b/NEWS @@ -7,10 +7,8 @@ GNU coreutils NEWS -*- outline -*- dd now accepts the count_bytes, skip_bytes iflags and the count_bytes oflag, to more easily allow processing portions of a file. - split now accept an optional "from" value for the - --numeric-suffixes option. If this argument is specified, the - numeric suffix counts from this value, otherwise, like before, it - counts from 0. + split now accepts an optional "from" argument to --numeric-suffixes, + which changes the start number from the default of 0. ** Bug fixes diff --git a/doc/coreutils.texi b/doc/coreutils.texi index f5616d8..d7a43d6 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -3087,7 +3087,7 @@ Use suffixes of length @var{length}. The default @var{length} is 2. @itemx --numeric-suffixes[=@var{from}] @opindex -d @opindex --numeric-suffixes -Use digits in suffixes rather than lower-case letters. The numerical +Use digits in suffixes rather than lower-case letters. The numerical suffix counts from @var{from} if specified, 0 otherwise. @item -e diff --git a/src/split.c b/src/split.c index 03feb9f..e7c61bb 100644 --- a/src/split.c +++ b/src/split.c @@ -249,8 +249,7 @@ next_file_name (void) outfile_mid = outfile + outbase_length; memcpy (outfile, outbase, outbase_length); sufindex = xcalloc (suffix_length, sizeof *sufindex); - /* Initialize the suffix index accordingly to the count from - value. */ + /* Initialize the suffix index according to start value. */ { unsigned long left = suffix_count_from; while (i-- != 0) @@ -1166,7 +1165,7 @@ main (int argc, char **argv) if (xstrtoul (optarg, NULL, 10, &tmp, "") != LONGINT_OK) { error (0, 0, - _("%s: invalid count from numerical suffix number"), + _("%s: invalid start value for numerical suffix"), optarg); usage (EXIT_FAILURE); } @@ -1243,7 +1242,7 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - /* Check that the suffix length is greater enough for the numerical + /* Check that the suffix length is large enough for the numerical suffix count from value. */ if (suffix_count_from) { @@ -1254,8 +1253,8 @@ main (int argc, char **argv) { if (length == 0) { - error (0, 0, _("numerical suffix FROM number too hight\ - for the suffix length")); + error (0, 0, _("numerical suffix start value is too large " + "for the suffix length")); usage (EXIT_FAILURE); } start /= 10; diff --git a/tests/split/numeric b/tests/split/numeric index 5550d6f..ad22df6 100755 --- a/tests/split/numeric +++ b/tests/split/numeric @@ -21,7 +21,7 @@ print_ver_ split # Check default start from 0 printf '1\n2\n3\n4\n5\n' > in || framework_failure_ -split --numeric-suffixes --lines=2 in > out || fail=1 +split --numeric-suffixes --lines=2 in || fail=1 cat <<\EOF > exp-1 1 2 @@ -38,7 +38,7 @@ compare exp-2 x01 || fail=1 compare exp-3 x02 || fail=1 # Check --numeric-suffixes=X -split --numeric-suffixes=1 --lines=2 in > out || fail=1 +split --numeric-suffixes=1 --lines=2 in || fail=1 cat <<\EOF > exp-1 1 2 @@ -54,8 +54,12 @@ compare exp-1 x01 || fail=1 compare exp-2 x02 || fail=1 compare exp-3 x03 || fail=1 -# Check that split failed when suffix length is not greater enough for -# the numerical suffix count from value -fail=1 && split -a 3 --numeric-suffixes=1000 in > out 2> /dev/null || fail=0 +# Check that split failed when suffix length is not large enough for +# the numerical suffix start value +split -a 3 --numeric-suffixes=1000 in 2> /dev/null && fail=1 + +# check invalid --numeric-suffixes start values are flagged +split --numeric-suffixes=-1 in 2> /dev/null && fail=1 +split --numeric-suffixes=one in 2> /dev/null && fail=1 Exit $fail --------------020508000004040103070801-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 17 12:59:23 2012 Received: (at 9085) by debbugs.gnu.org; 17 Feb 2012 17:59:23 +0000 Received: from localhost ([127.0.0.1]:43890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RyS5a-0002kH-1N for submit@debbugs.gnu.org; Fri, 17 Feb 2012 12:59:23 -0500 Received: from mail-iy0-f172.google.com ([209.85.210.172]:63639) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RyS5S-0002jy-Jv for 9085@debbugs.gnu.org; Fri, 17 Feb 2012 12:59:19 -0500 Received: by iagf6 with SMTP id f6so4772034iag.3 for <9085@debbugs.gnu.org>; Fri, 17 Feb 2012 09:57:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=qL/oDvaF880b5kmB/BAAz/mHiMyATn5izm1BUtbxi7A=; b=TmFB6NMA5DCNj22wMfWdSOyjAYOO3nMa9GWdqfCoJQkqEJe9s95nspycuN6dAHOUfd RfCiu4bCAR1hXgBPWN0KUm6cT9KwMTQbtKaczO1Pl7HlgTkRkvhOXbyfZV8C4ds3O6Wi 3WmbKtxTyjsaIRlLY+7LsTM0C8heIad9+ugEU= Received: by 10.42.235.137 with SMTP id kg9mr7919956icb.47.1329501434336; Fri, 17 Feb 2012 09:57:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.29.196 with HTTP; Fri, 17 Feb 2012 09:56:54 -0800 (PST) In-Reply-To: <4F3DB7B9.6020201@draigBrady.com> References: <87vcnk3vxc.fsf@Apollo.jerryland.fr> <4F3DB7B9.6020201@draigBrady.com> From: =?ISO-8859-1?Q?J=E9r=E9my_Compostella?= Date: Fri, 17 Feb 2012 18:56:54 +0100 Message-ID: Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. To: =?ISO-8859-1?Q?P=E1draig_Brady?= Content-Type: multipart/mixed; boundary=20cf3026697ab8d64004b92cacb6 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 9085 Cc: 9085@debbugs.gnu.org, Jim Meyering , coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --20cf3026697ab8d64004b92cacb6 Content-Type: multipart/alternative; boundary=20cf3026697ab8d63a04b92cacb4 --20cf3026697ab8d63a04b92cacb4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > 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) !=3D 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=E9r=E9my --20cf3026697ab8d63a04b92cacb4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> Thanks for continuing with this.
> One general = thing that might both improve
> and simplify the implementatio= n, is to
> not to convert from string to int at all.
>=A0
> I.E. when processing the arg, just validate like:
> if (strlen (optarg) !=3D strspn (optarg, suffix_alphabet))
> =A0error()
> else
> =A0 /* skip over = any leading 0, and use this as the start directly. */
>=A0
> Then the subsequent check for length and
<= div>> the initialization of the file name should be simplified.
This is more like my first implementation indeed. But since I didn't<= /div>
know about the strspn() function the code was a little bit more comple= x
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 uns= igned int,
> though that's not really a practical concern = I suppose.
Fair point. IMHO, even if it's not a really practi= cal concern
it's stupid to have=A0such an easy to avoid restriction.=A0
<= div>
> I've also attached some string and test cleanup= s,
> to --amend into your patch.
Applied.

Cheers,

J=E9r=E9my
--20cf3026697ab8d63a04b92cacb4-- --20cf3026697ab8d64004b92cacb6 Content-Type: text/x-patch; charset=US-ASCII; name="0001-split-numeric-suffixes-new-optional-from-argument-bu.patch" Content-Disposition: attachment; filename="0001-split-numeric-suffixes-new-optional-from-argument-bu.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gyrimvwo1 RnJvbSBlODQ0YjQ3NGNlMWE1YTM1MzMwZTI1OThjZWIyNzFiMmEyMmUwMDJkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/Sj1DMz1BOXI9QzM9QTlteT0yMENvbXB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J2QnOgogICAgICAg ICAgIHN1ZmZpeF9hbHBoYWJldCA9ICIwMTIzNDU2Nzg5IjsKKyAgICAgICAgICBpZiAob3B0YXJn KQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBpZiAoc3RybGVuIChvcHRhcmcpICE9IHN0 cnNwbiAob3B0YXJnLCBzdWZmaXhfYWxwaGFiZXQpKQorICAgICAgICAgICAgICAgIHsKKyAgICAg ICAgICAgICAgICAgIGVycm9yICgwLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgIF8oIiVz OiBpbnZhbGlkIHN0YXJ0IHZhbHVlIGZvciBudW1lcmljYWwgc3VmZml4IiksCisgICAgICAgICAg ICAgICAgICAgICAgICAgb3B0YXJnKTsKKyAgICAgICAgICAgICAgICAgIHVzYWdlIChFWElUX0ZB SUxVUkUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgZWxzZQorICAgICAgICAg ICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIC8qIFNraXAgYW55IGxlYWRpbmcgemVyby4gICov CisgICAgICAgICAgICAgICAgICB3aGlsZSAoKm9wdGFyZyA9PSAnMCcgJiYgKihvcHRhcmcgKyAx KSAhPSAnXDAnKQorICAgICAgICAgICAgICAgICAgICBvcHRhcmcrKzsKKyAgICAgICAgICAgICAg ICAgIG51bWVyaWNfc3VmZml4X3N0YXJ0ID0gb3B0YXJnOworICAgICAgICAgICAgICAgIH0KKyAg ICAgICAgICAgIH0KICAgICAgICAgICBicmVhazsKIAogICAgICAgICBjYXNlICdlJzoKQEAgLTEy MTIsNiArMTI0MywxNSBAQCBtYWluIChpbnQgYXJnYywgY2hhciAqKmFyZ3YpCiAgICAgICB1c2Fn ZSAoRVhJVF9GQUlMVVJFKTsKICAgICB9CiAKKyAgLyogQ2hlY2sgdGhhdCB0aGUgc3VmZml4IGxl bmd0aCBpcyBsYXJnZSBlbm91Z2ggZm9yIHRoZSBudW1lcmljYWwKKyAgICAgc3VmZml4IHN0YXJ0 IHZhb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MDAwIGluIDI+IC9kZXYvbnVsbCAmJiBmYWlsPTEKKworIyBjaGVjayBpbnZhbGlkIC0t bnVtZXJpYy1zdWZmaXhlcyBzdGFydCB2YWx1ZXMgYXJlIGZsYWdnZWQKK3NwbGl0IC0tbnVtZXJp Yy1zdWZmaXhlcz0tMSBpbiAyPiAvZGV2L251bGwgJiYgZmFpbD0xCitzcGxpdCAtLW51bWVyaWMt c3VmZml4ZXM9b25lIGluIDI+IC9kZXYvbnVsbCAmJiBmYWlsPTEKKworRXhpdCAkZmFpbAotLSAK MS43LjIuNQoK --20cf3026697ab8d64004b92cacb6-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 17 21:19:32 2012 Received: (at 9085-done) by debbugs.gnu.org; 18 Feb 2012 02:19:32 +0000 Received: from localhost ([127.0.0.1]:44193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RyZtZ-0006R8-QQ for submit@debbugs.gnu.org; Fri, 17 Feb 2012 21:19:31 -0500 Received: from mail3.vodafone.ie ([213.233.128.45]:49255) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RyZtW-0006Qu-PV for 9085-done@debbugs.gnu.org; Fri, 17 Feb 2012 21:19:28 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAFIJP09tTdvu/2dsb2JhbAAMOK9BhV0BAQEEDCYBRhALDQsJJQ8CRgYNAQcBAcBwjC8JAwIDBwQEAgIDCQENAQIBAocxBJs2jGo Received: from unknown (HELO [192.168.1.79]) ([109.77.219.238]) by mail3.vodafone.ie with ESMTP; 18 Feb 2012 02:17:23 +0000 Message-ID: <4F3F0A33.40602@draigBrady.com> Date: Sat, 18 Feb 2012 02:17:23 +0000 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: =?ISO-8859-1?Q?J=E9r=E9my_Compostella?= Subject: Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix. References: <87vcnk3vxc.fsf@Apollo.jerryland.fr> <4F3DB7B9.6020201@draigBrady.com> In-Reply-To: X-Enigmail-Version: 1.3.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 9085-done Cc: 9085-done@debbugs.gnu.org, coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 02/17/2012 05:56 PM, Jérémy Compostella wrote: > I attached the new patch. I tried to make it as simple as possible but > feel free to comment. Thanks! I just grouped the operations in next_file_name() a little for clarity, tweaked a couple of strings, and pushed. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 13 08:30:29 2012 Received: (at control) by debbugs.gnu.org; 13 Mar 2012 12:30:30 +0000 Received: from localhost ([127.0.0.1]:48369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7Qs0-0001K1-VL for submit@debbugs.gnu.org; Tue, 13 Mar 2012 08:30:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18476) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7Qrm-0001Jd-NH for control@debbugs.gnu.org; Tue, 13 Mar 2012 08:30:26 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2DC0Hg5013096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 13 Mar 2012 08:00:17 -0400 Received: from [10.3.113.33] (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2DC0H2M011042 for ; Tue, 13 Mar 2012 08:00:17 -0400 Message-ID: <4F5F36D0.9030802@redhat.com> Date: Tue, 13 Mar 2012 06:00:16 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: Re: bug#11004: thank you-all! (Re: bug#9085: 'split' feature request: an option to uses e.g. '.001' as first suffix.) References: In-Reply-To: X-Enigmail-Version: 1.3.5 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDA4F781CE26673FB134B42D3" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDA4F781CE26673FB134B42D3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable forcemerge 9085 11004 thanks On 03/13/2012 02:40 AM, SciFi wrote: >=20 > Hi, >=20 > I am still here. > And I am still watching & reading this list/group (via Gmane, > amongst a few=E2=80=93hundred other lists/groups). >=20 > I want to thank everyone involved with these mods to =E2=80=98split=E2=80= =99 > (and of course to all the other updates to coreutils in general). >=20 > I have not tested them yet, at the time I type/send this note, > as it would need a git-pull (and I do remember that caused a > big mess here last time I tried ). >=20 > However, I see Mr Meyering is ready for a new release, > and I=E2=80=99ve restarted my interest in UseNet, > so I=E2=80=99d love to try at least a test srcball > soon as it=E2=80=99s ready. >=20 > Thanks again! >=20 > :) >=20 --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigDA4F781CE26673FB134B42D3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPXzbQAAoJEKeha0olJ0NqcvEH/3FAZxGDcZ9Vrj/PZx5/rA4k aVxGf/dad+ZIzg39ubAj50ENAWgmYbfOfMF9Vuc7lyzUrmC56XV1a/TuYru5HU+K 5FwFky1MjN3pk+0z9ZGmRJzV2XmmBiq38ALMLLiE0VYXBrqjKU0jMvSLmD7obuY/ rHgVfRmUhXvAM5Jb3/Ks2jni11O6g9zCwh2xppKWvcaqtH7YzcQ5qlibyItlIhMq +JeYBc05/oh1kY2+0U6Ykmat5VAgS39JigUvC+Y54EZc84y0uSDF4RiZzxEyOrhQ yFT1dIprqva/mbJIsuzkvL2PO3OAQh0+43kORyJlFXyX8i9McXpLZPCi0iI3+5c= =1EuE -----END PGP SIGNATURE----- --------------enigDA4F781CE26673FB134B42D3-- From unknown Sat Aug 16 15:51:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 11 Apr 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator