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

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

unix.superglobalmegacorp.com

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