File: parity_bit_check.sh

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (65 lines) | stat: -rwxr-xr-x 2,314 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

# $Id: parity_bit_check.sh 11680 2011-03-27 17:57:51Z airwin $

# This script will run parity_bit_check on all files in the PLplot
# source tree (except those listed below) to discover which of those
# files have any character with the eighth (parity) bit set.

# Copyright (C) 2010 Alan W. Irwin
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PLplot 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 Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

which parity_bit_check >/dev/null
parity_bit_check_rc=$?
if [ "$parity_bit_check_rc" != 0 ] ; then
    echo "
This script only works when parity_bit_check is on the PATH.
To make this so please run

make parity_bit_check

in the build tree and put the utils subdirectory of that build tree
where parity_bit_check will be built by the above command on your
PATH."
    exit 1
fi

# Find absolute PATH of script without using readlink (since readlink is
# not available on all platforms).  Followed advice at
# http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/
ORIGINAL_PATH="$(pwd)"
cd "$(dirname $0)"
# Absolute Path of the script
SCRIPT_PATH="$(pwd)"

# Assumption: top-level source tree is parent directory of where script
# is located.
SOURCE_TREE="$(dirname ${SCRIPT_PATH})"
cd "${SOURCE_TREE}"

#List of all files in source tree other than .svn ones....
find -type f >| /tmp/temporary_source_tree_list

for FILE in $(grep -v -f "$SOURCE_TREE"/scripts/parity_bit_check.exclude /tmp/temporary_source_tree_list); do
    parity_bit_check <$FILE
    parity_bit_check_rc=$?
    if [ "$parity_bit_check_rc" -ne 0 ]; then
	printf "%s %x\n" $FILE $parity_bit_check_rc
    fi
done
rm -f /tmp/temporary_source_tree_list