Annotation of coherent/g/usr/bin/vi/strldbg.c, revision 1.1

1.1     ! root        1: /* strldgb.c - debugging version of strlen */
        !             2: 
        !             3: #include <fcntl.h>
        !             4: 
        !             5: int fddb = -1;
        !             6: 
        !             7: /*
        !             8:  * stack:
        !             9:  *     Arg
        !            10:  *     Return Addr
        !            11:  */
        !            12: int strlen(cp)
        !            13: char * cp;
        !            14: {
        !            15:        int * dbp;
        !            16:        char buf[80];
        !            17: 
        !            18:        if (fddb == -1) {
        !            19:                fddb = open("/dev/console", O_RDWR);
        !            20:        }
        !            21: 
        !            22:        dbp = (int *)&cp;
        !            23:        dbp--;
        !            24:        sprintf(buf, "from %08x: strlen(%08x)\n", *dbp, cp);
        !            25:        write(fddb, buf, stl(buf));
        !            26:        return stl(cp);
        !            27: }
        !            28: 
        !            29: int stl(cp)
        !            30: char * cp;
        !            31: {
        !            32:        int ret = 0;
        !            33:        while (*cp++)
        !            34:                ret++;
        !            35:        return ret;
        !            36: }

unix.superglobalmegacorp.com

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