summaryrefslogtreecommitdiff
path: root/util/local.test
blob: ff4aa7928acf0a0d52a397c49cdbe6f0776b7745 (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
58
59
#! /bin/sh
# Copyright (C) 2003, 2005, 2007, 2008  Free Software Foundation, Inc.
#
# This file is part of GNU Texinfo.
#
# GNU Texinfo is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# GNU Texinfo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Make sure no "local" variable identifier is used twice, since
# local is not actually portable.

. ./defs || exit 1

set -e

# Make sure quotes are used to protect the value.  See the comment in
# texi2dvi itself about local.
if sed -e 's/^[	 ]*#.*//' $TEXI2DVI |
    $EGREP "\blocal [a-zA-Z_0-9]*=[^\"']" |
    $EGREP -v "\blocal [a-zA-Z_0-9]*=[a-zA-Z0-9]*$" |
    grep .
then
  false
else
  true
fi


# Make sure each name is used only once.
if sed -n -e 's/^#.*//' \
          -e 's/local \([a-zA-Z_0-9]*\)/\1/gp' $TEXI2DVI |
    sort |
    uniq -c |
    grep -v '^.*1 ' |
    grep .
then
  false
else
  true
fi


# Make sure we don't use $().
if $FGREP '$(' $TEXI2DVI
then
  false
else
  true
fi