aboutsummaryrefslogtreecommitdiff
path: root/coreutils-5.3.0-bin/share/awk/readable.awk
blob: dbbab5782527e411c77408c00bddda0b3060c387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# readable.awk --- library file to skip over unreadable files
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# October 2000

BEGIN {
    for (i = 1; i < ARGC; i++) {
        if (ARGV[i] ~ /^[A-Za-z_][A-Za-z0-9_]*=.*/ \
            || ARGV[i] == "-")
            continue    # assignment or standard input
        else if ((getline junk < ARGV[i]) < 0) # unreadable
            delete ARGV[i]
        else
            close(ARGV[i])
    }
}