blob: beedca5337de99ac13ac5b024be9545c6edb7f93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
ME="${0##*/}"
usage() {
cat << __EOT__
Usage: $ME command [argument …]
When using the sortdir library, applications will receive directory
entries in alphabetical order.
Ordering depends on the current locale used by your application.
You can override this by setting the SORTDIR_LOCALE environment
variable. Examples:
export SORTDIR_LOCALE=hu_HU
or
export SORTDIR_LOCALE=C
Version comparing (see strverscmp(3)) is performed if SORTDIR_VERSCMP
is set to any value. In this case SORTDIR_LOCALE is ignored.
Reverse ordering is provided if SORTDIR_REVERSE is set to any value.
__EOT__
}
case "$1" in
-h | --help )
usage
exit 0
;;
* )
: pass
;;
esac
LIBSORTDIR="${LIBSORTDIR:-/usr/lib/libsortdir.so}"
if [ -z "$LD_PRELOAD" ]; then
LD_PRELOAD="$LIBSORTDIR"
else
# This is The Right Way (tm)
# Appending the new library to the old LD_PRELOAD would suck.
LD_PRELOAD="$LIBSORTDIR $LD_PRELOAD"
fi
set -euf
export LD_PRELOAD
if [ "$#" -eq 0 ]; then
prog="${SHELL:-/bin/sh}"
else
prog="$1"
shift
fi
exec "$prog" "$@"
# eof
|