aboutsummaryrefslogtreecommitdiff
path: root/coreutils-5.3.0-bin/share/awk/assert.awk
blob: 75fd8853c3a5489d4ff07abf08ae4bfe7d87fbfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# assert --- assert that a condition is true. Otherwise exit.

#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# May, 1993

function assert(condition, string)
{
    if (! condition) {
        printf("%s:%d: assertion failed: %s\n",
            FILENAME, FNR, string) > "/dev/stderr"
        _assert_exit = 1
        exit 1
    }
}

END {
    if (_assert_exit)
        exit 1
}