| 
10555
 | 
     1  | 
#!/usr/bin/env bash
  | 
| 
4193
 | 
     2  | 
#
  | 
| 
 | 
     3  | 
# $Id$
  | 
| 
9788
 | 
     4  | 
# Author: Markus Wenzel, TU Muenchen
  | 
| 
 | 
     5  | 
# License: GPL (GNU GENERAL PUBLIC LICENSE)
  | 
| 
4193
 | 
     6  | 
#
  | 
| 
 | 
     7  | 
# DESCRIPTION: check files for non-ASCII characters
  | 
| 
 | 
     8  | 
  | 
| 
 | 
     9  | 
  | 
| 
 | 
    10  | 
## diagnostics
  | 
| 
 | 
    11  | 
  | 
| 
10511
 | 
    12  | 
PRG="$(basename "$0")"
  | 
| 
4193
 | 
    13  | 
  | 
| 
 | 
    14  | 
function usage()
  | 
| 
 | 
    15  | 
{
 | 
| 
 | 
    16  | 
  echo
  | 
| 
 | 
    17  | 
  echo "Usage: $PRG [FILES|DIRS...]"
  | 
| 
 | 
    18  | 
  echo
  | 
| 
 | 
    19  | 
  echo "  Recursively find .thy/.ML files and check for non-ASCII characters."
  | 
| 
 | 
    20  | 
  echo
  | 
| 
 | 
    21  | 
  exit 1
  | 
| 
 | 
    22  | 
}
  | 
| 
 | 
    23  | 
  | 
| 
 | 
    24  | 
  | 
| 
 | 
    25  | 
## process command line
  | 
| 
 | 
    26  | 
  | 
| 
9788
 | 
    27  | 
[ "$#" -eq 0 -o "$1" = "-?" ] && usage
  | 
| 
4193
 | 
    28  | 
  | 
| 
9788
 | 
    29  | 
SPECS="$@"; shift "$#"
  | 
| 
4193
 | 
    30  | 
  | 
| 
 | 
    31  | 
  | 
| 
 | 
    32  | 
## main
  | 
| 
 | 
    33  | 
  | 
| 
6082
 | 
    34  | 
#set by configure
  | 
| 
 | 
    35  | 
AUTO_PERL=perl
  | 
| 
 | 
    36  | 
  | 
| 
4508
 | 
    37  | 
find $SPECS \( -name \*.ML -o -name \*.thy \) -print | \
  | 
| 
9788
 | 
    38  | 
  xargs "$AUTO_PERL" -w -e \
  | 
| 
4508
 | 
    39  | 
    'while(<ARGV>) { if (m/[\x80-\xff]/) { print "$ARGV: $_"; }}'
 |