1# -*- sh -*-
2# Check environment variables for sane values while testing.
3
4# Copyright (C) 2000-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
19if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
20  as_unset=unset
21else
22  as_unset=false
23fi
24
25envvar_check_fail=0
26vars='
27  _POSIX2_VERSION
28  _STDBUF_E
29  _STDBUF_I
30  _STDBUF_O
31  BASH_ENV
32  BLOCKSIZE
33  BLOCK_SIZE
34  CDPATH
35  COLUMNS
36  DF_BLOCK_SIZE
37  DU_BLOCK_SIZE
38  ENV
39  LANGUAGE
40  LS_BLOCK_SIZE
41  LS_COLORS
42  OMP_NUM_THREADS
43  POSIXLY_CORRECT
44  QUOTING_STYLE
45  SIMPLE_BACKUP_SUFFIX
46  TABSIZE
47  TERM
48  COLORTERM
49  TIME_STYLE
50  TMPDIR
51  VERSION_CONTROL
52'
53for var in $vars
54do
55  $as_unset $var
56  if eval test \"\${$var+set}\" = set; then
57    echo "$0: the $var environment variable is set --" \
58      ' unset it and rerun this test' >&2
59    envvar_check_fail=1
60  fi
61done
62
63test "$envvar_check_fail" = 1 && exit 1
64