Annotation of Net2/isofs/isofs_util.c, revision 1.1

1.1     ! root        1: int
        !             2: isonum_711 (p)
        !             3: char *p;
        !             4: {
        !             5:        return (*p & 0xff);
        !             6: }
        !             7: 
        !             8: int
        !             9: isonum_712 (p)
        !            10: char *p;
        !            11: {
        !            12:        int val;
        !            13: 
        !            14:        val = *p;
        !            15:        if (val & 0x80)
        !            16:                val |= 0xffffff00;
        !            17:        return (val);
        !            18: }
        !            19: 
        !            20: int
        !            21: isonum_721 (p)
        !            22: char *p;
        !            23: {
        !            24:        return ((p[0] & 0xff) | ((p[1] & 0xff) << 8));
        !            25: }
        !            26: 
        !            27: int
        !            28: isonum_722 (p)
        !            29: char *p;
        !            30: {
        !            31:        return (((p[0] & 0xff) << 8) | (p[1] & 0xff));
        !            32: }
        !            33: 
        !            34: int
        !            35: isonum_723 (p)
        !            36: char *p;
        !            37: {
        !            38: #if 0
        !            39:        if (p[0] != p[3] || p[1] != p[2]) {
        !            40:                fprintf (stderr, "invalid format 7.2.3 number\n");
        !            41:                exit (1);
        !            42:        }
        !            43: #endif
        !            44:        return (isonum_721 (p));
        !            45: }
        !            46: 
        !            47: int
        !            48: isonum_731 (p)
        !            49: char *p;
        !            50: {
        !            51:        return ((p[0] & 0xff)
        !            52:                | ((p[1] & 0xff) << 8)
        !            53:                | ((p[2] & 0xff) << 16)
        !            54:                | ((p[3] & 0xff) << 24));
        !            55: }
        !            56: 
        !            57: int
        !            58: isonum_732 (p)
        !            59: char *p;
        !            60: {
        !            61:        return (((p[0] & 0xff) << 24)
        !            62:                | ((p[1] & 0xff) << 16)
        !            63:                | ((p[2] & 0xff) << 8)
        !            64:                | (p[3] & 0xff));
        !            65: }
        !            66: 
        !            67: int
        !            68: isonum_733 (p)
        !            69: char *p;
        !            70: {
        !            71:        int i;
        !            72: 
        !            73: #if 0
        !            74:        for (i = 0; i < 4; i++) {
        !            75:                if (p[i] != p[7-i]) {
        !            76:                        fprintf (stderr, "bad format 7.3.3 number\n");
        !            77:                        exit (1);
        !            78:                }
        !            79:        }
        !            80: #endif
        !            81:        return (isonum_731 (p));
        !            82: }
        !            83: 
        !            84: /*
        !            85:  * translate and compare a filename
        !            86:  */
        !            87: isofncmp(char *fn, int fnlen, char *isofn, int isolen) {
        !            88:        int fnidx;
        !            89: 
        !            90:        fnidx = 0;
        !            91:        for (fnidx = 0; fnidx < isolen; fnidx++, fn++) {
        !            92:                char c = *isofn++;
        !            93: 
        !            94:                if (fnidx > fnlen)
        !            95:                        return (0);
        !            96: 
        !            97:                if (c >= 'A' && c <= 'Z') {
        !            98:                        if (c + ('a' - 'A') !=  *fn)
        !            99:                                return(0);
        !           100:                        else
        !           101:                                continue;
        !           102:                }
        !           103:                if (c == ';')
        !           104:                        return ((fnidx == fnlen));
        !           105:                if (c != *fn)
        !           106:                        return (0);
        !           107:        }
        !           108:        return (1);
        !           109: }
        !           110: 
        !           111: /*
        !           112:  * translate a filename
        !           113:  */
        !           114: void
        !           115: isofntrans(char *infn, int infnlen, char *outfn, short *outfnlen) {
        !           116:        int fnidx;
        !           117: 
        !           118:        fnidx = 0;
        !           119:        for (fnidx = 0; fnidx < infnlen; fnidx++) {
        !           120:                char c = *infn++;
        !           121: 
        !           122:                if (c >= 'A' && c <= 'Z')
        !           123:                        *outfn++ = c + ('a' - 'A');
        !           124:                else if (c == ';') {
        !           125:                        *outfnlen = fnidx;
        !           126:                        return;
        !           127:                } else
        !           128:                        *outfn++ = c;
        !           129:        }
        !           130:        *outfnlen = infnlen;
        !           131: }

unix.superglobalmegacorp.com

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