File: checkit

package info (click to toggle)
recode 3.4.1-11
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,560 kB
  • ctags: 622
  • sloc: ansic: 10,572; perl: 339; makefile: 317; lisp: 243; sh: 173; lex: 165; awk: 127; sed: 10
file content (68 lines) | stat: -rwxr-xr-x 2,105 bytes parent folder | download | duplicates (2)
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
60
61
62
63
64
65
66
67
68
:
# Script to help checking `recode'.
# Copyright (C) 1991 Free Software Foundation, Inc.
# Francois Pinard <pinard@iro.umontreal.ca>, 1991.

# This program 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 2, or (at your option)
# any later version.

# This program 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# Use this script by `checkit [-v] FILE BEFORE AFTER'.  It does
# various check of recoding FILE from BEFORE to AFTER or vice-versa.
# The -v parameter gives more verbose output.  Exit with a non-zero
# status if any error found.

if test "$1" = -v; then
  shift
  verbose=1
fi

# Select methods to be tested by studying `configure' output.

methods=i
grep '#define  *HAVE_POPEN  *1' config.h > /dev/null && methods="$methods o"
grep '#define  *HAVE_PIPE  *1' config.h > /dev/null && methods="$methods p"

# Try all methods, both in filter and in non-filter modes.  Echo the
# tested sequence of steps in verbose mode, but only once after the
# first "Checking" message.

test -n "$verbose" && verbose_once=-v
for method in $methods; do
  echo "Checking -$method $2:$3 FILE  (and $3:$2 too)"
  cp $1 checkit.tmp
  chmod +w checkit.tmp
  ./recode $verbose_once -q$method $2:$3 checkit.tmp
  ./recode $verbose_once -q$method $3:$2 checkit.tmp
  verbose_once=
  if cmp -s $1 checkit.tmp; then
    :
  else
    rm checkit.tmp
    exit 1
  fi

  echo "Checking -$method $2:$3 <FILE (and $3:$2 too)"
  ./recode -q$method < $1 $2:$3 | ./recode -q$method $3:$2 > checkit.tmp
  if cmp -s $1 checkit.tmp; then
    :
  else
    rm checkit.tmp
    exit 1
  fi
done

# Return success.

rm checkit.tmp
exit 0