lib/Tools/nonascii
changeset 4193 a8e252c91dba
child 4508 f102cb0140fe
equal deleted inserted replaced
4192:c38ab5af38b5 4193:a8e252c91dba
       
     1 #!/bin/bash
       
     2 #
       
     3 # $Id$
       
     4 #
       
     5 # DESCRIPTION: check files for non-ASCII characters
       
     6 
       
     7 
       
     8 ## diagnostics
       
     9 
       
    10 PRG=$(basename $0)
       
    11 
       
    12 function usage()
       
    13 {
       
    14   echo
       
    15   echo "Usage: $PRG [FILES|DIRS...]"
       
    16   echo
       
    17   echo "  Recursively find .thy/.ML files and check for non-ASCII characters."
       
    18   echo
       
    19   exit 1
       
    20 }
       
    21 
       
    22 
       
    23 ## process command line
       
    24 
       
    25 [ $# -eq 0 -o "$1" = "-?" ] && usage
       
    26 
       
    27 SPECS="$@"; shift $#
       
    28 
       
    29 
       
    30 ## main
       
    31 
       
    32 PERL=$(type -path perl)
       
    33 if [ -z $PERL ]; then
       
    34   echo "$PRG fatal error: no perl!?"
       
    35 else
       
    36   find $SPECS \( -name \*.ML -o -name \*.thy \) -print | \
       
    37     xargs $PERL -e \
       
    38       'while(<ARGV>) { if (m/[\x80-\xff]/) { print "$ARGV: $_"; }}'
       
    39 fi