bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] split: --chunks option


From: Pádraig Brady
Subject: Re: [PATCH] split: --chunks option
Date: Wed, 06 Jan 2010 13:19:33 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0

On 04/01/10 00:54, Pádraig Brady wrote:
On 03/01/10 20:37, Chen Guo wrote:
Hi all, hope everyone had happy holidays.

Here's the patch in its entirety. Let me know if anything's not
satisfactory.

Thanks for all that.
The first thing that hits me is that "round robin" might
be better as a parameter rather than an option.

I'll review everything within the next couple of days.

Got a few mins today to look at it.
This is not a complete review at all.

TODO: refactor eol_parse() to gl/lib/unescape::unescape()
and call that from ptx, tr and maybe printf.
Also this should be in a separate patch anyway.

TODO: auto set suffix_length from /N

TODO: pread() needs pread in bootstrap.conf.
I need to check if it's worth using at all.

TODO: check why `seq 10 | split -r4` doesn't work

Also I there's a bracketing logic error, and a function
prototype fixed as follows:

diff --git a/src/split.c b/src/split.c
 chunk_parse (uintmax_t *m_units, uintmax_t *n_units, char *slash)
 {
   *slash = '\0';
-  if (slash != optarg
-      && xstrtoumax (optarg, NULL, 10, m_units, "") != LONGINT_OK
-      || SIZE_MAX < *m_units)
+  if (slash != optarg /* a leading number is specified.  */
+      && (xstrtoumax (optarg, NULL, 10, m_units, "") != LONGINT_OK
+          || SIZE_MAX < *m_units))
     {
       error (0, 0, _("%s: invalid chunk number"), optarg);
       usage (EXIT_FAILURE);
@@ -729,15 +729,19 @@ chunk_parse (uintmax_t *m_units, uintmax_t *n_units, char 
*slash)
   if (xstrtoumax (++slash, NULL, 10, n_units, "") != LONGINT_OK
       || *n_units == 0 || *n_units < *m_units || SIZE_MAX < *n_units)
     {
-      error (0, 0, _("%s: invalid number of total chunks"), slash);
+      error (0, 0, _("%s: invalid number of chunks"), slash);
       usage (EXIT_FAILURE);
     }
 }

 static void
-eol_parse ()
+eol_parse (void)
 {
   if (*optarg == '\\')
     switch (*(optarg+1))




reply via email to

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