DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T r

⟦e8f2dabdc⟧ TextFile

    Length: 1687 (0x697)
    Types: TextFile
    Names: »rdn_str.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/dsap/common/rdn_str.c« 

TextFile

#include "quipu/util.h"
#include "quipu/name.h"
#include "quipu/malloc.h"

RDN str2rdn_aux (str)
char * str;
{
oid_table_attr *at, *AttrT_new_aux();
char * ptr;
char * save, val;
char * TidyString();
RDN rdn;
unsigned last_heap;

	/* look for "type = value" */

	if (str == NULLCP) {
		parse_error ("NULL rdn component",NULLCP);
		return (NULLRDN);
	}

	if ((ptr=index(str,'=')) == 0) {
		parse_error ("Equals missing in RDN '%s'",str);
		return (NULLRDN);
	}

	save = ptr++;
	save--;
	if (! isspace (*save))
		save++;
	val = *save;
	*save = 0;

	if ((at = AttrT_new_aux (TidyString(str))) == NULLTABLE_ATTR) {
		parse_error ("Unknown attribute type in RDN '%s'",str);
		*save = val;
		return (NULLRDN);
	}

	rdn = rdn_comp_alloc();
	rdn->rdn_next = NULLRDN;
	rdn->rdn_at.at_oid = NULLOID;
	rdn->rdn_at.at_table = at;

	if ((last_heap = mem_heap) == 1)
		mem_heap = 2 + attr_index;

	if (str_at2AttrV_aux (ptr,&rdn->rdn_at,&rdn->rdn_av) == NOTOK) {
		*save = val;
		mem_heap = last_heap;
		free ((char *) rdn);
		return (NULLRDN);
	}

	mem_heap = last_heap;
	*save = val;
	return (rdn);
}


RDN str2rdn (str)
char * str;
{
register char *ptr;
register char *save,val;
RDN rdn = NULLRDN, newrdn;

	/* look for "rdn % rdn % rdn" */

	if (str == NULLCP)
		return (NULLRDN);

	while ( (ptr = index (str,'%')) != 0) {
		save = ptr++;
		save--;
		if (! isspace (*save))
			save++;
		val = *save;
		*save = 0;
		if ((newrdn = str2rdn_aux (str)) == NULLRDN) {
			rdn_free (rdn);
			return (NULLRDN);
		}

		rdn = rdn_merge (rdn,newrdn);
		*save = val;
		str = ptr;
	}

	if ((newrdn = str2rdn_aux (str)) == NULLRDN) {
		rdn_free (rdn);
		return (NULLRDN);
	}

	return (rdn_merge (rdn,newrdn));
}