Annotation of 43BSDReno/contrib/isode-beta/dsap/common/rdn_str.c, revision 1.1

1.1     ! root        1: #include "quipu/util.h"
        !             2: #include "quipu/name.h"
        !             3: #include "quipu/malloc.h"
        !             4: 
        !             5: RDN str2rdn_aux (str)
        !             6: char * str;
        !             7: {
        !             8: AttributeType at;
        !             9: char * ptr;
        !            10: char * save, val;
        !            11: char * TidyString();
        !            12: RDN rdn;
        !            13: unsigned last_heap;
        !            14: 
        !            15:        /* look for "type = value" */
        !            16: 
        !            17:        if (str == NULLCP) {
        !            18:                parse_error ("NULL rdn component",NULLCP);
        !            19:                return (NULLRDN);
        !            20:        }
        !            21: 
        !            22:        if ((ptr=index(str,'=')) == 0) {
        !            23:                parse_error ("Equals missing in RDN '%s'",str);
        !            24:                return (NULLRDN);
        !            25:        }
        !            26: 
        !            27:        save = ptr++;
        !            28:        save--;
        !            29:        if (! isspace (*save))
        !            30:                save++;
        !            31:        val = *save;
        !            32:        *save = 0;
        !            33: 
        !            34:        if ((at = AttrT_new (TidyString(str))) == NULLTABLE_ATTR) {
        !            35:                parse_error ("Unknown attribute type in RDN '%s'",str);
        !            36:                *save = val;
        !            37:                return (NULLRDN);
        !            38:        }
        !            39: 
        !            40:        rdn = rdn_comp_alloc();
        !            41:        rdn->rdn_next = NULLRDN;
        !            42:        rdn->rdn_at = at;
        !            43: 
        !            44:        if ((last_heap = mem_heap) == 1)
        !            45:                mem_heap = 2 + attr_index;
        !            46: 
        !            47:        if (str_at2AttrV_aux (ptr,rdn->rdn_at,&rdn->rdn_av) == NOTOK) {
        !            48:                *save = val;
        !            49:                mem_heap = last_heap;
        !            50:                free ((char *) rdn);
        !            51:                return (NULLRDN);
        !            52:        }
        !            53: 
        !            54:        mem_heap = last_heap;
        !            55:        *save = val;
        !            56:        return (rdn);
        !            57: }
        !            58: 
        !            59: 
        !            60: RDN str2rdn (str)
        !            61: char * str;
        !            62: {
        !            63: register char *ptr;
        !            64: register char *save,val;
        !            65: RDN rdn = NULLRDN, newrdn;
        !            66: 
        !            67:        /* look for "rdn % rdn % rdn" */
        !            68: 
        !            69:        if (str == NULLCP)
        !            70:                return (NULLRDN);
        !            71: 
        !            72:        while ( (ptr = index (str,'%')) != 0) {
        !            73:                save = ptr++;
        !            74:                save--;
        !            75:                if (! isspace (*save))
        !            76:                        save++;
        !            77:                val = *save;
        !            78:                *save = 0;
        !            79:                if ((newrdn = str2rdn_aux (str)) == NULLRDN) {
        !            80:                        rdn_free (rdn);
        !            81:                        return (NULLRDN);
        !            82:                }
        !            83: 
        !            84:                rdn = rdn_merge (rdn,newrdn);
        !            85:                *save = val;
        !            86:                str = ptr;
        !            87:        }
        !            88: 
        !            89:        if ((newrdn = str2rdn_aux (str)) == NULLRDN) {
        !            90:                rdn_free (rdn);
        !            91:                return (NULLRDN);
        !            92:        }
        !            93: 
        !            94:        return (rdn_merge (rdn,newrdn));
        !            95: }

unix.superglobalmegacorp.com

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