fail=0
+# When listed explicitly:
+
set x `ls -Ci f slink`; shift
test $# = 4 || fail=1
# The inode numbers should differ.
set x `ls -CHi f slink`; shift
test $# = 4 || fail=1
-# With -H, they must be the same, too.
+# With -H, they must be the same, too, from the command line.
# Note that POSIX says -H must make ls dereference only
# symlinks (specified on the command line) to directories,
# but the historical BSD meaning of -H is to dereference
# implements the BSD semantics.
test "$1" = "$3" || fail=1
+# When listed from a directory:
+
+set x `ls -Ci`; shift
+test $# = 4 || fail=1
+# The inode numbers should differ.
+test "$1" != "$3" || fail=1
+
+set x `ls -CLi`; shift
+test $# = 4 || fail=1
+# With -L, they must be the same.
+test "$1" = "$3" || fail=1
+
+set x `ls -CHi`; shift
+test $# = 4 || fail=1
+# With -H, they must be different from inside a directory.
+test "$1" != "$3" || fail=1
+
(exit $fail); exit $fail