mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
ls: add --null option (Bug#49716)
* NEWS, doc/coreutils.texi (General output formatting): * src/ls.c (usage): Document this. * src/ls.c (NULL_OPTION): New constant. (long_options): Add --null. (eolbyte): New static var. (dired_dump_obstack, main, print_dir, print_current_files) (print_many_per_line, print_horizontal, print_with_separator): Output eolbyte instead of '\n'. (decode_switches): Decode --null. * tests/ls/null-option.sh: New file. * tests/local.mk (all_tests): Add it.
This commit is contained in:
33
tests/ls/null-option.sh
Executable file
33
tests/ls/null-option.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
# Verify behavior of ls --null.
|
||||
|
||||
# Copyright 2021 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ ls
|
||||
|
||||
mkdir dir && touch dir/a dir/b dir/cc || framework_failure_
|
||||
|
||||
LC_ALL=C ls --null dir >out || fail=1
|
||||
tr '\n' '\0' <<EOF >exp
|
||||
a
|
||||
b
|
||||
cc
|
||||
EOF
|
||||
|
||||
compare exp out || fail=1
|
||||
|
||||
Exit $fail
|
||||
Reference in New Issue
Block a user