local.test 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #! /bin/sh
  2. # Copyright (C) 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
  3. #
  4. # This file is part of GNU Texinfo.
  5. #
  6. # GNU Texinfo 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,
  9. # or (at your option) any later version.
  10. #
  11. # GNU Texinfo 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 <http://www.gnu.org/licenses/>.
  18. # Make sure no "local" variable identifier is used twice, since
  19. # local is not actually portable.
  20. . ./defs || exit 1
  21. set -e
  22. # Make sure quotes are used to protect the value. See the comment in
  23. # texi2dvi itself about local.
  24. if sed -e 's/^[ ]*#.*//' $TEXI2DVI |
  25. $EGREP "\blocal [a-zA-Z_0-9]*=[^\"']" |
  26. $EGREP -v "\blocal [a-zA-Z_0-9]*=[a-zA-Z0-9]*$" |
  27. grep .
  28. then
  29. false
  30. else
  31. true
  32. fi
  33. # Make sure each name is used only once.
  34. if sed -n -e 's/^#.*//' \
  35. -e 's/local \([a-zA-Z_0-9]*\)/\1/gp' $TEXI2DVI |
  36. sort |
  37. uniq -c |
  38. grep -v '^.*1 ' |
  39. grep .
  40. then
  41. false
  42. else
  43. true
  44. fi
  45. # Make sure we don't use $().
  46. if $FGREP '$(' $TEXI2DVI
  47. then
  48. false
  49. else
  50. true
  51. fi