home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnurecod.zip / checkit < prev    next >
Text File  |  1994-10-31  |  2KB  |  69 lines

  1. :
  2. # Script to help checking `recode'.
  3. # Copyright (C) 1991 Free Software Foundation, Inc.
  4. # Francois Pinard <pinard@iro.umontreal.ca>, 1991.
  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 2, or (at your option)
  9. # 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, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Use this script by `checkit [-v] FILE BEFORE AFTER'.  It does
  21. # various check of recoding FILE from BEFORE to AFTER or vice-versa.
  22. # The -v parameter gives more verbose output.  Exit with a non-zero
  23. # status if any error found.
  24.  
  25. if test "$1" = -v; then
  26.   shift
  27.   verbose=1
  28. fi
  29.  
  30. # Select methods to be tested by studying `configure' output.
  31.  
  32. methods=i
  33. grep '#define  *HAVE_POPEN  *1' config.h > /dev/null && methods="$methods o"
  34. grep '#define  *HAVE_PIPE  *1' config.h > /dev/null && methods="$methods p"
  35.  
  36. # Try all methods, both in filter and in non-filter modes.  Echo the
  37. # tested sequence of steps in verbose mode, but only once after the
  38. # first "Checking" message.
  39.  
  40. test -n "$verbose" && verbose_once=-v
  41. for method in $methods; do
  42.   echo "Checking -$method $2:$3 FILE  (and $3:$2 too)"
  43.   cp $1 checkit.tmp
  44.   chmod +w checkit.tmp
  45.   ./recode $verbose_once -q$method $2:$3 checkit.tmp
  46.   ./recode $verbose_once -q$method $3:$2 checkit.tmp
  47.   verbose_once=
  48.   if cmp -s $1 checkit.tmp; then
  49.     :
  50.   else
  51.     rm checkit.tmp
  52.     exit 1
  53.   fi
  54.  
  55.   echo "Checking -$method $2:$3 <FILE (and $3:$2 too)"
  56.   ./recode -q$method < $1 $2:$3 | ./recode -q$method $3:$2 > checkit.tmp
  57.   if cmp -s $1 checkit.tmp; then
  58.     :
  59.   else
  60.     rm checkit.tmp
  61.     exit 1
  62.   fi
  63. done
  64.  
  65. # Return success.
  66.  
  67. rm checkit.tmp
  68. exit 0
  69.