aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/cut.c2
-rwxr-xr-xtestsuite/cut.tests12
2 files changed, 13 insertions, 1 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c
index e12c56732..e33626d7f 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -309,7 +309,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
309#endif 309#endif
310 if (!odelim) 310 if (!odelim)
311 odelim = (opt & OPT_REGEX) ? " " : delim; 311 odelim = (opt & OPT_REGEX) ? " " : delim;
312 if (!delim || !*delim) 312 if (!delim)
313 delim = (opt & OPT_REGEX) ? "[[:space:]]+" : "\t"; 313 delim = (opt & OPT_REGEX) ? "[[:space:]]+" : "\t";
314 314
315// argc -= optind; 315// argc -= optind;
diff --git a/testsuite/cut.tests b/testsuite/cut.tests
index 8da390cd7..52d05fde3 100755
--- a/testsuite/cut.tests
+++ b/testsuite/cut.tests
@@ -142,4 +142,16 @@ testing "cut -dNEWLINE --output-delimiter EMPTY_INPUT" \
142 "" \ 142 "" \
143 "" "" 143 "" ""
144 144
145# This seems to work as if delimiter is never found.
146# We test here that -d '' does *not* operate as if there was no -d
147# and delimiter has defaulted to TAB:
148testing "cut -d EMPTY" \
149 "cut -d '' -f2-" \
150 "1 2\t3 4 5\n" \
151 "" "1 2\t3 4 5\n"
152testing "cut -d EMPTY -s" \
153 "cut -d '' -f2- -s" \
154 "" \
155 "" "1 2\t3 4 5\n"
156
145exit $FAILCOUNT 157exit $FAILCOUNT