4
<!-- Manpage converted by man2html 3.0.1 -->
6
lAddElemStr, lDelElemStr, lGetElemStr - list operations
7
lAddSubStr, lDelSubStr, lGetSubStr - sub-list operations
12
lListElem* lAddElemStr(
25
lListElem *lGetElemStr(
31
lListElem* lAddSubStr(
47
lListElem *lGetSubStr(
54
lListElem *lDiffListStr(
61
lListElem *lAddElemStr(lpp, nm, s, dp)
62
Appends an element to the list *lpp. The new element
63
gets the type dp (using <B><A HREF="../htmlman3/lCreateElem.html">lCreateElem(3)</A></B>). Field nm of
64
the new elements gets the value s (using <I>lSet-</I>
65
<B><A HREF="../htmlman3/String.html">String(3)</A></B>). No test are made to ensure uniqueness of
66
elements in the list. If *lpp is NULL a new list head
67
gets created (using <B><A HREF="../htmlman3/lCreateList.html">lCreateList(3)</A></B>). lAddElemStr()
68
fails if the given list or descriptor has no field nm.
70
int lDelElemStr(lpp, nm, s)
71
Removes one element containing s at field nm in the
72
list *lpp. <I>lGetElemStr</I> is used to find the element. It
73
gets unchained and freed. If no more elements are in
74
the list after unchaining the list head gets freed and
75
NULL is written to *lpp. <I>lDelElemStr</I> fails if the
76
given list has no field nm.
78
lListElem *lGetElemStr(lp, nm, s)
79
Searches the first element containing s at field nm in
80
the list lp. <B><A HREF="../htmlman3/strcmp.html">strcmp(3)</A></B> s used to perform the compare.
81
<I>lGetElemStr</I> returns the element.
83
lListElem *lAddSubStr(ep, nm, s, snm, dp)
84
Uses <I>lAddElemStr</I> to append an element to the sub-list
85
field snm of the element ep.
87
int lDelSubStr(ep, nm, s, snm)
88
Uses <I>lDelElemStr</I> to remove an element from the sub-list
89
field snm of the element ep.
91
lListElem *lGetSubStr(ep, nm, s, snm)
92
Uses <I>lGetElemStr</I> to find an element in the sub-list
93
field snm of the element ep.
95
int lDiffListStr(nm, lpp1, lpp2)
96
<I>lDiffListStr</I> removes and frees elements in <I>both</I> lists
97
with the same string key in field nm.
100
The first example shows the usage of list functions:
102
=======================================================================
111
/* add a queue element where QU_qname is "balin.q" to the list lp */
112
if (!(ep=lAddElemStr(&lp, QU_qname, "balin.q", QU_Type))) {
115
lSetString(ep, QU_qhostname, "balin.mydomain");
117
/* get the element of lp where QU_qname is "balin.q" */
118
if (!(ep=lGetElemStr(lp, QU_qname, "balin.q"))) {
122
/* remove the element of lp where QU_qname is "balin.q" */
123
if (!lDelElemStr(&lp, QU_qname, "balin.q")) {
127
/* here lp will be NULL again */
132
=======================================================================
134
The second example shows the usage of sub-list functions:
136
=======================================================================
145
/* add an owner element with OW_name "bill" to the */
146
/* sub-list QU_ownerlist of the element ep */
147
ep = lAddSubStr(ep, OW_name, "bill", QU_ownerlist, OW_Type);
151
lSetString(ep, OW_permissions, "everything");
153
/* get the element in the sub-list QU_ownerlist of */
154
/* the element ep where OW_name is "bill" */
155
if (!(ep=lGetSubStr(ep, OW_name, "bill", QU_ownerlist))) {
158
printf("Owner: %s0, lGetString(ep, OW_name));
160
/* remove the element in the sub-list of element ep */
161
/* where OW_name is "bill" */
162
if (!lDelSubStr(ep, OW_name, "bill", QU_ownerlist)) {
169
=======================================================================
173
<I>lAddElemStr</I> and <I>lAddSubStr</I> return a pointer to the added
174
list element or NULL on error. <I>lDelElemStr</I> and <I>lDelSubStr</I>
175
return 1 on success and 0 on error. <I>lGetElemStr</I> and <I>lGet-</I>
176
<I>SubStr</I> return a pointer to the found list element or NULL on
177
error. <I>lDiffListStr</I> returns 0 on success and -1 on error.
180
<B><A HREF="../htmlman1/sge_intro.html">sge_intro(1)</A></B>, <B><A HREF="../htmlman3/list_intro.html">list_intro(3)</A></B>, <B><A HREF="../htmlman3/lSetString.html">lSetString(3)</A></B>, <B><A HREF="../htmlman3/lGetString.html">lGetString(3)</A></B>,
181
<B><A HREF="../htmlman3/lAppendElem.html">lAppendElem(3)</A></B>, <B><A HREF="../htmlman3/lDechainElem.html">lDechainElem(3)</A></B>, <B><A HREF="../htmlman3/lCreateElem.html">lCreateElem(3)</A></B>, <I>lCreateL-</I>
182
<B><A HREF="../htmlman3/ist.html">ist(3)</A></B>.
185
See <B><A HREF="../htmlman1/sge_intro.html">sge_intro(1)</A></B> for a full statement of rights and permis-
216
Man(1) output converted with
217
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>