mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
split: Improve GNU compatibility.
* Like GNU split, turn autoextend back on if given -a0. * Add a test case that verifies that -a<non-zero> turns autoextend off. * Add a test case that verifies that -a0 turns autoextend back on. Sponsored by: Klara, Inc. Reviewed by: christos, kevans Differential Revision: https://reviews.freebsd.org/D42011
This commit is contained in:
parent
d7399551b0
commit
d9d69a6f6f
|
@ -115,7 +115,12 @@ main(int argc, char **argv)
|
|||
errx(EX_USAGE, "%s: suffix length is %s",
|
||||
optarg, errstr);
|
||||
}
|
||||
if (sufflen == 0) {
|
||||
sufflen = 2;
|
||||
autosfx = true;
|
||||
} else {
|
||||
autosfx = false;
|
||||
}
|
||||
break;
|
||||
case 'b': /* Byte count. */
|
||||
if (expand_number(optarg, &bytecnt) != 0) {
|
||||
|
|
|
@ -209,6 +209,23 @@ autoextend_body()
|
|||
atf_check -o inline:"$((26*25+1))\n" cat xzaaa
|
||||
}
|
||||
|
||||
atf_test_case noautoextend
|
||||
noautoextend_body()
|
||||
{
|
||||
seq $((26*26)) >input
|
||||
atf_check split -a2 -l1 input
|
||||
atf_check -o inline:"$((26*26))\n" cat xzz
|
||||
}
|
||||
|
||||
atf_test_case reautoextend
|
||||
reautoextend_body()
|
||||
{
|
||||
seq $((26*25+1)) >input
|
||||
atf_check split -a2 -a0 -l1 input
|
||||
atf_check -o inline:"$((26*25))\n" cat xyz
|
||||
atf_check -o inline:"$((26*25+1))\n" cat xzaaa
|
||||
}
|
||||
|
||||
atf_test_case continue
|
||||
continue_body()
|
||||
{
|
||||
|
@ -249,6 +266,8 @@ atf_init_test_cases()
|
|||
atf_add_test_case larger_suffix_length
|
||||
atf_add_test_case pattern
|
||||
atf_add_test_case autoextend
|
||||
atf_add_test_case noautoextend
|
||||
atf_add_test_case reautoextend
|
||||
atf_add_test_case continue
|
||||
atf_add_test_case undocumented_kludge
|
||||
atf_add_test_case duplicate_linecount
|
||||
|
|
Loading…
Reference in a new issue