summaryrefslogtreecommitdiffstats
path: root/contrib/awk/awklib/eg/lib/readable.awk
blob: 51705aea0a56a5375839c8314759adfb9ef8af03 (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@gnu.org, 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])
    }
}
OpenPOWER on IntegriCloud