Annotation of researchv10dc/cmd/oworm/scsi/odump.c, revision 1.1

1.1     ! root        1: #include       <fio.h>
        !             2: 
        !             3: #define        WIDTH   32
        !             4: 
        !             5: scsiodump(p, n)
        !             6:        register unsigned char *p;
        !             7: {
        !             8:        register i, nd, l;
        !             9:        unsigned char buf[WIDTH];
        !            10:        int didstar;
        !            11:        unsigned char *s;
        !            12: 
        !            13:        for(nd = 0; n > 0; n -= l, nd += l){
        !            14:                l = min(WIDTH, n);
        !            15:                if(nd && (l == WIDTH) && (memcmp(buf, p, l) == 0)){
        !            16:                        p += WIDTH;
        !            17:                        if(didstar++ == 0)
        !            18:                                Fprint(1, "*\n");
        !            19:                        continue;
        !            20:                }
        !            21:                memcpy(buf, p, l);
        !            22:                didstar = 0;
        !            23:                Fprint(1, "%5.5d", nd);
        !            24:                s = p;
        !            25:                for(i = 0; i < l; i++){
        !            26:                        if((i%4) == 0) Fputc(1, ' ');
        !            27:                        Fprint(1, "%2.2ux", *p++);
        !            28:                }
        !            29:                Fputc(1, '\n');
        !            30:                Fprint(1, "     ");
        !            31:                for(i = 0; i < l; i++){
        !            32:                        if((i%4) == 0) Fputc(1, ' ');
        !            33:                        if((*s >= ' ') && (*s < 0177))
        !            34:                                Fprint(1, " %c", *s++);
        !            35:                        else switch(*s++)
        !            36:                        {
        !            37:                        case '\n':      Fprint(1, "\\n"); break;
        !            38:                        case '\t':      Fprint(1, "\\t"); break;
        !            39:                        default:        Fprint(1, ".."); break;
        !            40:                        }
        !            41:                }
        !            42:                Fputc(1, '\n');
        !            43:        }
        !            44:        Fprint(1, "%5.5d\n", nd);
        !            45: }

unix.superglobalmegacorp.com

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