File: lib

package info (click to toggle)
darcs 2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,292 kB
  • ctags: 259
  • sloc: haskell: 26,818; sh: 7,051; ansic: 1,572; perl: 124; makefile: 24
file content (32 lines) | stat: -rw-r--r-- 836 bytes parent folder | download
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
# This is a -*- sh -*- library.
set -vex

## I would use the builtin !, but that has the wrong semantics.
not () { "$@" && exit 1 || :; }

# trick: OS-detection (if needed)
abort_windows () {
if echo $OS | grep -i windows; then
  echo This test does not work on Windows
  exit 200
fi
}

# switch locale to latin9 if supported if there's a locale command, skip test
# otherwise
switch_to_latin9_locale () {
    if ! which locale ; then
        echo "no locale command"
        exit 200 # skip test
    fi

    latin9_locale=`locale -a | grep @euro | head -n 1`
    if [ -z "$latin9_locale" ]; then
            echo "no latin9 locale found"
            exit 200 # skip, we can't switch away from UTF-8
    fi

    echo "Using locale $latin9_locale"
    export LC_ALL=$latin9_locale
    echo "character encoding is now `locale charmap`"
}