Annotation of researchv10dc/cmd/worm/oscsi/sony/inq.c, revision 1.1

1.1     ! root        1: #include       <stdio.h>
        !             2: #include       "../scsi.h"
        !             3: #include       "../scsish.h"
        !             4: #include       "fns.h"
        !             5: 
        !             6: int
        !             7: sony_inq(int niargs, int *iargs, int ncargs, char **cargs, char *err)
        !             8: {
        !             9:        struct scsi_cmd cmd;
        !            10:        struct scsi_return ret;
        !            11:        int n, i;
        !            12: 
        !            13: #pragma ref ncargs
        !            14: #pragma ref cargs
        !            15: 
        !            16:        if(niargs == 0)
        !            17:                for(niargs = 0; niargs < 8; niargs++)
        !            18:                        iargs[niargs] = niargs;
        !            19:        for(i = 0; i < niargs; i++){
        !            20:                set6(cmd, 0x12, iargs[i]<<5, 0, 0, 6, 0);
        !            21:                if(n = s_io(0, &cmd, 0, &ret, 6, err))
        !            22:                        return(n);
        !            23:                printf("inq(%d,%d): ", s_id, iargs[i]);
        !            24:                if(ret.data[5]&0x80)
        !            25:                        printf("power off (0x%x)\n", ret.data[5]&0xFF);
        !            26:                else if(ret.data[5]&0x40)
        !            27:                        printf("empty (0x%x)\n", ret.data[5]&0xFF);
        !            28:                else
        !            29:                        printf("%s,%s,%s,%s (0x%x)\n",
        !            30:                                (ret.data[5]&0x08)?"write protect":"writable",
        !            31:                                (ret.data[5]&0x04)?"no alternate":"",
        !            32:                                (ret.data[5]&0x02)?"drive error":"",
        !            33:                                (ret.data[5]&0x01)?"ready":"not ready",
        !            34:                                ret.data[5]&0xFF);
        !            35:        }
        !            36:        return(0);
        !            37: }

unix.superglobalmegacorp.com

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