1#!/bin/sh 2# exercise the -w option 3 4# Copyright (C) 2015-2023 Free Software Foundation, Inc. 5 6# This program is free software: you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation, either version 3 of the License, or 9# (at your option) any later version. 10 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <https://www.gnu.org/licenses/>. 18 19. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 20print_ver_ ls 21getlimits_ 22 23touch a b || framework_failure_ 24chmod a+x a || framework_failure_ 25 26# Negative values disallowed 27returns_ 2 ls -w-1 || fail=1 28 29# Verify octal parsing (especially since 0 is allowed) 30returns_ 2 ls -w08 || fail=1 31 32# Overflowed values are capped at SIZE_MAX 33ls -w$SIZE_OFLOW || fail=1 34 35# After coreutils 8.24 -w0 means no limit 36# and delimiting with spaces 37ls -w0 -x -T1 a b > out || fail=1 38printf '%s\n' 'a b' > exp || framework_failure_ 39compare exp out || fail=1 40 41# Ensure that 0 line length doesn't cause division by zero 42TERM=xterm ls -w0 -x --color=always || fail=1 43 44# coreutils <= 8.24 could display 1 column too few 45ls -w4 -x -T0 a b > out || fail=1 46compare exp out || fail=1 47 48Exit $fail 49