Annotation of researchv10no/cmd/lcc/include/vax_bsd/assert.h, revision 1.1

1.1     ! root        1: #ifndef __ASSERT
        !             2: #define __ASSERT
        !             3: 
        !             4: void assert(int);
        !             5: 
        !             6: static int _assert(char *e, char *file, unsigned line) {
        !             7:        extern int write(int, char *, int);
        !             8:        extern int sprintf(char *, const char *, ...);
        !             9:        extern void abort(void);
        !            10:        int i;
        !            11:        char buf[256];
        !            12: 
        !            13:        sprintf(buf, "assertion failed: %s, file %s, line %d\n", e, file, line);
        !            14:        for (i = 0; i < sizeof buf; i++)
        !            15:                if (buf[i] == 0)
        !            16:                        break;
        !            17:         write(2, buf, i);
        !            18:        abort();
        !            19:        return 0;
        !            20: }
        !            21: #endif /* __ASSERT */
        !            22: 
        !            23: #undef assert
        !            24: #ifdef NDEBUG
        !            25: #define assert(ignore) ((void)0)
        !            26: #else
        !            27: extern int _assert(char *, char *, unsigned);
        !            28: #define assert(e) ((void)((e)||_assert(#e, __FILE__, __LINE__)))
        !            29: #endif /* NDEBUG */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.