1#!/bin/sh
2# contrast ls -F, ls -p, and ls --indicator-style=file-type
3
4# Copyright (C) 2002-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
21
22mkdir sub
23cd sub
24mkdir dir
25touch regular executable
26chmod a+x executable
27ln -s regular slink-reg
28ln -s dir slink-dir
29ln -s nowhere slink-dangle
30mknod block b 20 20 2> /dev/null && block="block
31"
32mknod char c 10 10 2> /dev/null && char="char
33"
34mkfifo_or_skip_ fifo
35cd ..
36
37
38
39ls -F sub > out || fail=1
40cat <<EOF > exp
41$block${char}dir/
42executable*
43fifo|
44regular
45slink-dangle@
46slink-dir@
47slink-reg@
48EOF
49
50sed 's/\*//' exp > exp2
51ls --indicator-style=file-type sub > out2 || fail=1
52
53sed 's/[@|]$//' exp2 > exp3
54ls -p sub > out3 || fail=1
55
56compare exp out || fail=1
57
58compare exp2 out2 || fail=1
59
60compare exp3 out3 || fail=1
61
62ls --color=auto -F sub > out || fail=1
63compare exp out || fail=1
64
65Exit $fail
66