lib/Tools/nonascii
author wenzelm
Wed, 17 Dec 1997 18:13:43 +0100
changeset 4433 960868c0cbdd
parent 4193 a8e252c91dba
child 4508 f102cb0140fe
permissions -rwxr-xr-x
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4193
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     1
#!/bin/bash
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     2
#
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     3
# $Id$
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     4
#
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: check files for non-ASCII characters
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     6
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     7
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     8
## diagnostics
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
     9
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    10
PRG=$(basename $0)
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    11
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    12
function usage()
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    13
{
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    14
  echo
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    15
  echo "Usage: $PRG [FILES|DIRS...]"
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    16
  echo
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    17
  echo "  Recursively find .thy/.ML files and check for non-ASCII characters."
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    18
  echo
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    19
  exit 1
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    20
}
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    21
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    22
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    23
## process command line
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    24
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    25
[ $# -eq 0 -o "$1" = "-?" ] && usage
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    26
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    27
SPECS="$@"; shift $#
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    28
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    29
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    30
## main
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    31
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    32
PERL=$(type -path perl)
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    33
if [ -z $PERL ]; then
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    34
  echo "$PRG fatal error: no perl!?"
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    35
else
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    36
  find $SPECS \( -name \*.ML -o -name \*.thy \) -print | \
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    37
    xargs $PERL -e \
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    38
      'while(<ARGV>) { if (m/[\x80-\xff]/) { print "$ARGV: $_"; }}'
a8e252c91dba check files for non-ASCII characters;
wenzelm
parents:
diff changeset
    39
fi