Related:#1021403 - Don't use cut mb path if not necessary
This commit is contained in:
parent
9b303ebcee
commit
45bd042713
@ -110,7 +110,16 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
|
|
||||||
struct range_pair
|
struct range_pair
|
||||||
{
|
{
|
||||||
@@ -106,15 +169,25 @@ enum operating_mode
|
@@ -75,6 +138,8 @@ static size_t n_rp;
|
||||||
|
/* Number of `struct range_pair's allocated. */
|
||||||
|
static size_t n_rp_allocated;
|
||||||
|
|
||||||
|
+/* Length of the delimiter given as argument to -d. */
|
||||||
|
+size_t delimlen;
|
||||||
|
|
||||||
|
/* Append LOW, HIGH to the list RP of range pairs, allocating additional
|
||||||
|
space if necessary. Update global variable N_RP. When allocating,
|
||||||
|
@@ -106,15 +171,25 @@ enum operating_mode
|
||||||
{
|
{
|
||||||
undefined_mode,
|
undefined_mode,
|
||||||
|
|
||||||
@ -137,7 +146,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
/* If true do not output lines containing no delimeter characters.
|
/* If true do not output lines containing no delimeter characters.
|
||||||
Otherwise, all such lines are printed. This option is valid only
|
Otherwise, all such lines are printed. This option is valid only
|
||||||
with field mode. */
|
with field mode. */
|
||||||
@@ -126,6 +199,9 @@ static bool complement;
|
@@ -126,6 +201,9 @@ static bool complement;
|
||||||
|
|
||||||
/* The delimeter character for field mode. */
|
/* The delimeter character for field mode. */
|
||||||
static unsigned char delim;
|
static unsigned char delim;
|
||||||
@ -147,7 +156,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
|
|
||||||
/* True if the --output-delimiter=STRING option was specified. */
|
/* True if the --output-delimiter=STRING option was specified. */
|
||||||
static bool output_delimiter_specified;
|
static bool output_delimiter_specified;
|
||||||
@@ -188,7 +264,7 @@ Print selected parts of lines from each
|
@@ -188,7 +266,7 @@ Print selected parts of lines from each
|
||||||
-f, --fields=LIST select only these fields; also print any line\n\
|
-f, --fields=LIST select only these fields; also print any line\n\
|
||||||
that contains no delimiter character, unless\n\
|
that contains no delimiter character, unless\n\
|
||||||
the -s option is specified\n\
|
the -s option is specified\n\
|
||||||
@ -156,7 +165,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
"), stdout);
|
"), stdout);
|
||||||
fputs (_("\
|
fputs (_("\
|
||||||
--complement complement the set of selected bytes, characters\n\
|
--complement complement the set of selected bytes, characters\n\
|
||||||
@@ -381,6 +457,9 @@ set_fields (const char *fieldstr)
|
@@ -381,6 +459,9 @@ set_fields (const char *fieldstr)
|
||||||
if (operating_mode == byte_mode)
|
if (operating_mode == byte_mode)
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
_("byte offset %s is too large"), quote (bad_num));
|
_("byte offset %s is too large"), quote (bad_num));
|
||||||
@ -166,7 +175,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
else
|
else
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
_("field number %s is too large"), quote (bad_num));
|
_("field number %s is too large"), quote (bad_num));
|
||||||
@@ -505,6 +584,79 @@ cut_bytes (FILE *stream)
|
@@ -505,6 +586,79 @@ cut_bytes (FILE *stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +255,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
/* Read from stream STREAM, printing to standard output any selected fields. */
|
/* Read from stream STREAM, printing to standard output any selected fields. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -629,13 +782,198 @@ cut_fields (FILE *stream)
|
@@ -629,13 +783,201 @@ cut_fields (FILE *stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +438,10 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
+ break;
|
+ break;
|
||||||
+
|
+
|
||||||
+ case field_mode:
|
+ case field_mode:
|
||||||
+ cut_fields_mb (stream);
|
+ if (delimlen == 1)
|
||||||
|
+ cut_fields (stream);
|
||||||
|
+ else
|
||||||
|
+ cut_fields_mb (stream);
|
||||||
+ break;
|
+ break;
|
||||||
+
|
+
|
||||||
+ default:
|
+ default:
|
||||||
@ -448,16 +460,15 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Process file FILE to standard output.
|
/* Process file FILE to standard output.
|
||||||
@@ -687,6 +1025,8 @@ main (int argc, char **argv)
|
@@ -687,6 +1029,7 @@ main (int argc, char **argv)
|
||||||
bool ok;
|
bool ok;
|
||||||
bool delim_specified = false;
|
bool delim_specified = false;
|
||||||
char *spec_list_string IF_LINT ( = NULL);
|
char *spec_list_string IF_LINT ( = NULL);
|
||||||
+ char mbdelim[MB_LEN_MAX + 1];
|
+ char mbdelim[MB_LEN_MAX + 1];
|
||||||
+ size_t delimlen = 0;
|
|
||||||
|
|
||||||
initialize_main (&argc, &argv);
|
initialize_main (&argc, &argv);
|
||||||
set_program_name (argv[0]);
|
set_program_name (argv[0]);
|
||||||
@@ -709,7 +1049,6 @@ main (int argc, char **argv)
|
@@ -709,7 +1052,6 @@ main (int argc, char **argv)
|
||||||
switch (optc)
|
switch (optc)
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
@ -465,7 +476,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
/* Build the byte list. */
|
/* Build the byte list. */
|
||||||
if (operating_mode != undefined_mode)
|
if (operating_mode != undefined_mode)
|
||||||
FATAL_ERROR (_("only one type of list may be specified"));
|
FATAL_ERROR (_("only one type of list may be specified"));
|
||||||
@@ -717,6 +1056,14 @@ main (int argc, char **argv)
|
@@ -717,6 +1059,14 @@ main (int argc, char **argv)
|
||||||
spec_list_string = optarg;
|
spec_list_string = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -480,7 +491,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
case 'f':
|
case 'f':
|
||||||
/* Build the field list. */
|
/* Build the field list. */
|
||||||
if (operating_mode != undefined_mode)
|
if (operating_mode != undefined_mode)
|
||||||
@@ -728,10 +1075,36 @@ main (int argc, char **argv)
|
@@ -728,10 +1078,38 @@ main (int argc, char **argv)
|
||||||
case 'd':
|
case 'd':
|
||||||
/* New delimiter. */
|
/* New delimiter. */
|
||||||
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
|
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
|
||||||
@ -506,6 +517,8 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
+ FATAL_ERROR (_("the delimiter must be a single character"));
|
+ FATAL_ERROR (_("the delimiter must be a single character"));
|
||||||
+ memcpy (mbdelim, optarg, delimlen);
|
+ memcpy (mbdelim, optarg, delimlen);
|
||||||
+ mbdelim[delimlen] = '\0';
|
+ mbdelim[delimlen] = '\0';
|
||||||
|
+ if (delimlen == 1)
|
||||||
|
+ delim = *optarg;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -521,7 +534,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OUTPUT_DELIMITER_OPTION:
|
case OUTPUT_DELIMITER_OPTION:
|
||||||
@@ -744,6 +1117,7 @@ main (int argc, char **argv)
|
@@ -744,6 +1122,7 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
@ -529,7 +542,7 @@ diff -urNp coreutils-8.22-orig/src/cut.c coreutils-8.22/src/cut.c
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
@@ -783,15 +1157,34 @@ main (int argc, char **argv)
|
@@ -783,15 +1162,34 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!delim_specified)
|
if (!delim_specified)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 8.22
|
Version: 8.22
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: http://www.gnu.org/software/coreutils/
|
Url: http://www.gnu.org/software/coreutils/
|
||||||
@ -372,6 +372,9 @@ fi
|
|||||||
%{_sbindir}/chroot
|
%{_sbindir}/chroot
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 06 2014 Ondrej Oprala <ooprala@redhat.com> 8.22-8
|
||||||
|
- Don't use cut mb path if not necessary (#1021403)
|
||||||
|
|
||||||
* Mon Jan 06 2014 Ondrej Oprala <ooprala@redhat.com> 8.22-7
|
* Mon Jan 06 2014 Ondrej Oprala <ooprala@redhat.com> 8.22-7
|
||||||
- Fix sorting by non-first field (#1003544)
|
- Fix sorting by non-first field (#1003544)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user