diff options
author | Cojocaru Alexandru <xojoc@gmx.com> | 2012-12-05 13:13:51 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2012-12-06 09:37:16 +0000 |
commit | dd3193cd959684837b50d1aea8931a4c62ce2673 (patch) | |
tree | 4905cdbc69e76b849464b0c3c0592bc804768f0f /src | |
parent | df9065e552a17ab86b28dd7165678d15592015f8 (diff) | |
download | coreutils-dd3193cd959684837b50d1aea8931a4c62ce2673.tar.xz |
cut: improve error reporting
* src/cut.c (main): Treat a NUL delimiter (-d '') consistently
with non NUL delimiters, and disallow such a delimiter option,
unless a field is also specified.
(set_fields): Provide a more accurate error message when
a given list is invalid.
* tests/misc/cut.pl: Add a test case.
Diffstat (limited to 'src')
-rw-r--r-- | src/cut.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -365,7 +365,7 @@ set_fields (const char *fieldstr) in_digits = false; /* Starting a range. */ if (dash_found) - FATAL_ERROR (_("invalid byte or field list")); + FATAL_ERROR (_("invalid byte, character or field list")); dash_found = true; fieldstr++; @@ -491,7 +491,7 @@ set_fields (const char *fieldstr) fieldstr++; } else - FATAL_ERROR (_("invalid byte or field list")); + FATAL_ERROR (_("invalid byte, character or field list")); } max_range_endpoint = 0; @@ -846,7 +846,7 @@ main (int argc, char **argv) if (operating_mode == undefined_mode) FATAL_ERROR (_("you must specify a list of bytes, characters, or fields")); - if (delim != '\0' && operating_mode != field_mode) + if (delim_specified && operating_mode != field_mode) FATAL_ERROR (_("an input delimiter may be specified only\ when operating on fields")); |