|
|
1.1 root 1: /* entryinfo.c - Entry Information routines */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/dsap/common/RCS/entryinfo.c,v 7.1 90/07/09 14:34:26 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/dsap/common/RCS/entryinfo.c,v 7.1 90/07/09 14:34:26 mrose Exp $
9: *
10: *
11: * $Log: entryinfo.c,v $
12: * Revision 7.1 90/07/09 14:34:26 mrose
13: * sync
14: *
15: * Revision 7.0 89/11/23 21:42:11 mrose
16: * Release 6.0
17: *
18: */
19:
20: /*
21: * NOTICE
22: *
23: * Acquisition, use, and distribution of this module and related
24: * materials are subject to the restrictions of a license agreement.
25: * Consult the Preface in the User's Manual for the full terms of
26: * this agreement.
27: *
28: */
29:
30:
31: /* LINTLIBRARY */
32:
33: #include "quipu/util.h"
34: #include "quipu/commonarg.h"
35:
36: entryinfo_comp_free (a,state)
37: register EntryInfo *a;
38: int state;
39: {
40: register EntryInfo * einfo;
41: register Attr_Sequence as;
42:
43: if (a == NULLENTRYINFO)
44: return;
45:
46: dn_free (a->ent_dn);
47: if (state == 1)
48: for ( as=a->ent_attr; as!= NULLATTR; as=as->attr_link)
49: free ((char *) as);
50: else
51: as_free (a->ent_attr);
52:
53: for (einfo=a->ent_next; einfo!=NULLENTRYINFO; einfo=einfo->ent_next) {
54: dn_free (einfo->ent_dn);
55: if (state == 1)
56: for ( as=einfo->ent_attr; as!= NULLATTR; as=as->attr_link)
57: free ((char *) as);
58: else
59: as_free (einfo->ent_attr);
60: free ((char *) einfo);
61: }
62: }
63:
64: entryinfo_free (a,state)
65: register EntryInfo * a;
66: register int state;
67: {
68: if (a == NULLENTRYINFO)
69: return;
70: entryinfo_comp_free (a,state);
71: free ((char *) a);
72: }
73:
74: entryinfo_cpy (a,b)
75: register EntryInfo *a;
76: register EntryInfo *b;
77: {
78: a->ent_dn = dn_cpy (b->ent_dn);
79: a->ent_attr = as_cpy (b->ent_attr);
80: a->ent_iscopy = b->ent_iscopy;
81: a->ent_age = b->ent_age;
82: a->ent_next = a->ent_next;
83: }
84:
85: entryinfo_append (a,b)
86: register EntryInfo *a,*b;
87: {
88: register EntryInfo *ptr;
89:
90: if ( a == NULLENTRYINFO )
91: return;
92:
93: for (ptr=a; ptr->ent_next != NULLENTRYINFO; ptr=ptr->ent_next)
94: ; /* noop */
95:
96: ptr->ent_next = b;
97: }
98:
99: entryinfo_merge (a,b)
100: register EntryInfo *a,*b;
101: {
102: register EntryInfo *ptr;
103: EntryInfo *tmp, *prev, *trail;
104:
105: if (( a == NULLENTRYINFO )
106: || (b == NULLENTRYINFO ))
107: return;
108:
109: for (ptr=a; ptr != NULLENTRYINFO; ptr=ptr->ent_next) {
110: prev = NULLENTRYINFO;
111: for (tmp=b; tmp != NULLENTRYINFO; tmp=tmp->ent_next) {
112: if (dn_cmp (ptr->ent_dn, tmp->ent_dn) == OK) {
113: /* already got it - throw it away */
114: if (prev == NULLENTRYINFO)
115: b = tmp->ent_next;
116: else
117: prev->ent_next = tmp->ent_next;
118: as_free (tmp->ent_attr);
119: dn_free (tmp->ent_dn);
120: free ((char *)tmp);
121: break;
122: }
123: prev = tmp;
124: }
125: trail = ptr;
126: }
127:
128: trail->ent_next = b;
129: }
130:
131: entryinfo_print (ps,entryinfo,format)
132: PS ps;
133: EntryInfo *entryinfo;
134: int format;
135: {
136: register EntryInfo *einfo;
137:
138: for (einfo= entryinfo; einfo!=NULLENTRYINFO; einfo=einfo->ent_next) {
139: dn_print(ps,einfo->ent_dn,EDBOUT);
140: ps_print (ps,"\n");
141:
142: as_print (ps,einfo->ent_attr,format);
143: ps_print (ps,"\n");
144: }
145: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.