• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file extends the init.sh (provided by gnulib).
2
3# Set environment variables for the tests.
4. ../tests/init-env
5
6prepare_locale_ ()
7{
8  # Solaris 11 doesn't strip the CODESET part from the locale name,
9  # when looking for a message catalog.  Create a directory link with
10  # CODESET, to work around this.
11  if test "$1" != "$2" && test "$GLIBC2" = no; then
12    case "$host_os" in
13      solaris2.11)
14        cp -R "$1" "$2"
15        ;;
16    esac
17  fi
18}
19
20# func_filter_POT_Creation_Date inputfile outputfile
21# creates outputfile from inputfile, filtering out any 'POT-Creation-Date' line.
22func_filter_POT_Creation_Date ()
23{
24  # A simple "grep -v 'POT-Creation-Date'" does not work:
25  # - GNU grep 2.24 produces "Binary file (standard input) matches" in the
26  #   output. The workaround is to use option '--text'.
27  # - Similarly, OpenBSD 4.0 produces "Binary file (standard input) matches"
28  #   in the output, but here it can be worked around by giving the input
29  #   through a pipe.
30  # - On native Windows, some 'grep' binaries produce CRLF line endings. Filter
31  #   out the CRs a posteriori.
32  cat "$1" | LC_ALL=C grep --text -v 'POT-Creation-Date' > "$1".tmq 2>/dev/null \
33    || cat "$1" | LC_ALL=C grep -v 'POT-Creation-Date' > "$1".tmq \
34    || Exit 1
35  LC_ALL=C tr -d '\r' < "$1".tmq > "$2" || Exit 1
36}
37