~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to doc/htmlman/htmlman3/lAddElemStr.html

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<BODY BGCOLOR=white>
 
3
<PRE>
 
4
<!-- Manpage converted by man2html 3.0.1 -->
 
5
NAME
 
6
     lAddElemStr, lDelElemStr, lGetElemStr - list operations
 
7
     lAddSubStr, lDelSubStr, lGetSubStr - sub-list operations
 
8
 
 
9
SYNOPSIS
 
10
     #include "cull.h"
 
11
 
 
12
     lListElem* lAddElemStr(
 
13
          lList** lpp,
 
14
          int nm,
 
15
          char *s,
 
16
          lDescr *dp
 
17
     );
 
18
 
 
19
     int lDelElemStr(
 
20
          lList** lpp,
 
21
          int nm,
 
22
          char *s
 
23
     );
 
24
 
 
25
     lListElem *lGetElemStr(
 
26
          lList* lp,
 
27
          int nm,
 
28
          char *s
 
29
     );
 
30
 
 
31
     lListElem* lAddSubStr(
 
32
          lListElem* ep,
 
33
          int nm,
 
34
          char *s,
 
35
          B
 
36
          int snm,
 
37
          lDescr *dp
 
38
     );
 
39
 
 
40
     int lDelSubStr(
 
41
          lListElem* ep,
 
42
          int nm,
 
43
          char *s,
 
44
          int snm
 
45
     );
 
46
 
 
47
     lListElem *lGetSubStr(
 
48
          lListElem* ep,
 
49
          int nm,
 
50
          char *s,
 
51
          int snm
 
52
     );
 
53
 
 
54
     lListElem *lDiffListStr(
 
55
          int nm,
 
56
          lList** lpp1,
 
57
          lList** lpp1,
 
58
     );
 
59
 
 
60
DESCRIPTION
 
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.
 
69
 
 
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.
 
77
 
 
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.
 
82
 
 
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.
 
86
 
 
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.
 
90
 
 
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.
 
94
 
 
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.
 
98
 
 
99
EXAMPLES
 
100
     The first example shows the usage of list functions:
 
101
 
 
102
     =======================================================================
 
103
 
 
104
     #include "cull.h"
 
105
 
 
106
     f()
 
107
     {
 
108
          lList *lp = NULL;
 
109
          lListElem *ep;
 
110
 
 
111
          /* add a queue element where QU_qname is "balin.q" to the list lp */
 
112
          if (!(ep=lAddElemStr(&amp;lp, QU_qname, "balin.q", QU_Type))) {
 
113
               /* ... */
 
114
          }
 
115
          lSetString(ep, QU_qhostname, "balin.mydomain");
 
116
 
 
117
          /* get the element of lp where QU_qname is "balin.q" */
 
118
          if (!(ep=lGetElemStr(lp, QU_qname, "balin.q"))) {
 
119
               /* ... */
 
120
          }
 
121
 
 
122
          /* remove the element of lp where QU_qname is "balin.q" */
 
123
          if (!lDelElemStr(&amp;lp, QU_qname, "balin.q")) {
 
124
               /* ... */
 
125
          }
 
126
 
 
127
          /* here lp will be NULL again */
 
128
 
 
129
          return;
 
130
     }
 
131
 
 
132
     =======================================================================
 
133
 
 
134
     The second example shows the usage of sub-list functions:
 
135
 
 
136
     =======================================================================
 
137
 
 
138
     #include "cull.h"
 
139
 
 
140
     g(queue)
 
141
     lListElem *queue;
 
142
     {
 
143
          lListElem *ep;
 
144
 
 
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);
 
148
          if ( !ep ) {
 
149
               /* ... */
 
150
          }
 
151
          lSetString(ep, OW_permissions, "everything");
 
152
 
 
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))) {
 
156
               /* ... */
 
157
          }
 
158
          printf("Owner: %s0, lGetString(ep, OW_name));
 
159
 
 
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)) {
 
163
               /* ... */
 
164
          }
 
165
 
 
166
          return;
 
167
     }
 
168
 
 
169
     =======================================================================
 
170
 
 
171
 
 
172
RETURN VALUES
 
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.
 
178
 
 
179
SEE ALSO
 
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>.
 
183
 
 
184
COPYRIGHT
 
185
     See <B><A HREF="../htmlman1/sge_intro.html">sge_intro(1)</A></B> for a full statement of rights and  permis-
 
186
     sions.
 
187
 
 
188
 
 
189
 
 
190
 
 
191
 
 
192
 
 
193
 
 
194
 
 
195
 
 
196
 
 
197
 
 
198
 
 
199
 
 
200
 
 
201
 
 
202
 
 
203
 
 
204
 
 
205
 
 
206
 
 
207
 
 
208
 
 
209
 
 
210
 
 
211
 
 
212
 
 
213
</PRE>
 
214
<HR>
 
215
<ADDRESS>
 
216
Man(1) output converted with
 
217
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
 
218
</ADDRESS>
 
219
</BODY>
 
220
</HTML>