tarruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/README.txt +99 -0
  2. data/ext/extconf.rb +19 -0
  3. data/ext/libtar/COPYRIGHT +35 -0
  4. data/ext/libtar/ChangeLog +243 -0
  5. data/ext/libtar/ChangeLog-1.0.x +141 -0
  6. data/ext/libtar/INSTALL +183 -0
  7. data/ext/libtar/Makefile.in +51 -0
  8. data/ext/libtar/README +121 -0
  9. data/ext/libtar/TODO +10 -0
  10. data/ext/libtar/autoconf/ac_path_generic.m4 +136 -0
  11. data/ext/libtar/autoconf/aclocal.m4 +199 -0
  12. data/ext/libtar/autoconf/encap.m4 +133 -0
  13. data/ext/libtar/autoconf/install-sh +251 -0
  14. data/ext/libtar/autom4te.cache/output.0 +8102 -0
  15. data/ext/libtar/autom4te.cache/requests +112 -0
  16. data/ext/libtar/autom4te.cache/traces.0 +382 -0
  17. data/ext/libtar/compat/ChangeLog +31 -0
  18. data/ext/libtar/compat/README +12 -0
  19. data/ext/libtar/compat/TODO +4 -0
  20. data/ext/libtar/compat/basename.c +91 -0
  21. data/ext/libtar/compat/compat.h +260 -0
  22. data/ext/libtar/compat/dirname.c +96 -0
  23. data/ext/libtar/compat/fnmatch.c +237 -0
  24. data/ext/libtar/compat/gethostbyname_r.c +41 -0
  25. data/ext/libtar/compat/gethostname.c +36 -0
  26. data/ext/libtar/compat/getservbyname_r.c +41 -0
  27. data/ext/libtar/compat/glob.c +898 -0
  28. data/ext/libtar/compat/inet_aton.c +27 -0
  29. data/ext/libtar/compat/module.ac +591 -0
  30. data/ext/libtar/compat/snprintf.c +788 -0
  31. data/ext/libtar/compat/strdup.c +62 -0
  32. data/ext/libtar/compat/strlcat.c +72 -0
  33. data/ext/libtar/compat/strlcpy.c +68 -0
  34. data/ext/libtar/compat/strmode.c +199 -0
  35. data/ext/libtar/compat/strrstr.c +40 -0
  36. data/ext/libtar/compat/strsep.c +87 -0
  37. data/ext/libtar/config.h.in +187 -0
  38. data/ext/libtar/configure +8102 -0
  39. data/ext/libtar/configure.ac +114 -0
  40. data/ext/libtar/doc/Makefile.in +152 -0
  41. data/ext/libtar/doc/tar_append_file.3 +50 -0
  42. data/ext/libtar/doc/tar_block_read.3 +24 -0
  43. data/ext/libtar/doc/tar_extract_all.3 +43 -0
  44. data/ext/libtar/doc/tar_extract_file.3 +84 -0
  45. data/ext/libtar/doc/tar_open.3 +97 -0
  46. data/ext/libtar/doc/th_get_pathname.3 +63 -0
  47. data/ext/libtar/doc/th_print_long_ls.3 +22 -0
  48. data/ext/libtar/doc/th_read.3 +34 -0
  49. data/ext/libtar/doc/th_set_from_stat.3 +45 -0
  50. data/ext/libtar/lib/Makefile.in +92 -0
  51. data/ext/libtar/lib/append.c +272 -0
  52. data/ext/libtar/lib/block.c +384 -0
  53. data/ext/libtar/lib/decode.c +130 -0
  54. data/ext/libtar/lib/encode.c +237 -0
  55. data/ext/libtar/lib/extract.c +656 -0
  56. data/ext/libtar/lib/handle.c +150 -0
  57. data/ext/libtar/lib/internal.h +46 -0
  58. data/ext/libtar/lib/libtar.h +311 -0
  59. data/ext/libtar/lib/output.c +146 -0
  60. data/ext/libtar/lib/util.c +153 -0
  61. data/ext/libtar/lib/wrapper.c +175 -0
  62. data/ext/libtar/libtar/Makefile.in +73 -0
  63. data/ext/libtar/libtar/libtar.c +363 -0
  64. data/ext/libtar/listhash/ChangeLog +15 -0
  65. data/ext/libtar/listhash/TODO +21 -0
  66. data/ext/libtar/listhash/hash.c.in +344 -0
  67. data/ext/libtar/listhash/hash_new.3.in +74 -0
  68. data/ext/libtar/listhash/list.c.in +458 -0
  69. data/ext/libtar/listhash/list_new.3.in +86 -0
  70. data/ext/libtar/listhash/listhash.h.in +196 -0
  71. data/ext/libtar/listhash/module.ac +21 -0
  72. data/ext/libtar/win32/config.h +190 -0
  73. data/ext/libtar/win32/dirent.c +115 -0
  74. data/ext/libtar/win32/dirent.h +24 -0
  75. data/ext/libtar/win32/grp.h +4 -0
  76. data/ext/libtar/win32/listhash/libtar_hash.c +344 -0
  77. data/ext/libtar/win32/listhash/libtar_list.c +458 -0
  78. data/ext/libtar/win32/listhash/libtar_listhash.h +196 -0
  79. data/ext/libtar/win32/pwd.h +4 -0
  80. data/ext/libtar/win32/sys/param.h +8 -0
  81. data/ext/libtar/win32/tar.h +35 -0
  82. data/ext/libtar/win32/utime.h +6 -0
  83. data/ext/libtar/win32/win32/types.h +10 -0
  84. data/ext/tarruby.c +648 -0
  85. metadata +150 -0
@@ -0,0 +1,458 @@
1
+ /* @configure_input@ */
2
+
3
+ /*
4
+ ** Copyright 1998-2002 University of Illinois Board of Trustees
5
+ ** Copyright 1998-2002 Mark D. Roth
6
+ ** All rights reserved.
7
+ **
8
+ ** @LISTHASH_PREFIX@_list.c - linked list routines
9
+ **
10
+ ** Mark D. Roth <roth@uiuc.edu>
11
+ ** Campus Information Technologies and Educational Services
12
+ ** University of Illinois at Urbana-Champaign
13
+ */
14
+
15
+ #include <config.h>
16
+ #include <compat.h>
17
+
18
+ #include <@LISTHASH_PREFIX@_listhash.h>
19
+
20
+ #include <stdio.h>
21
+ #include <errno.h>
22
+ #include <sys/param.h>
23
+
24
+ #ifdef STDC_HEADERS
25
+ # include <string.h>
26
+ # include <stdlib.h>
27
+ #endif
28
+
29
+
30
+ /*
31
+ ** @LISTHASH_PREFIX@_listptr_reset() - reset a list pointer
32
+ */
33
+ void
34
+ @LISTHASH_PREFIX@_listptr_reset(@LISTHASH_PREFIX@_listptr_t *lp)
35
+ {
36
+ *lp = NULL;
37
+ }
38
+
39
+
40
+ /*
41
+ ** @LISTHASH_PREFIX@_listptr_data() - retrieve the data pointed to by lp
42
+ */
43
+ void *
44
+ @LISTHASH_PREFIX@_listptr_data(@LISTHASH_PREFIX@_listptr_t *lp)
45
+ {
46
+ return (*lp)->data;
47
+ }
48
+
49
+
50
+ /*
51
+ ** @LISTHASH_PREFIX@_list_new() - create a new, empty list
52
+ */
53
+ @LISTHASH_PREFIX@_list_t *
54
+ @LISTHASH_PREFIX@_list_new(int flags, @LISTHASH_PREFIX@_cmpfunc_t cmpfunc)
55
+ {
56
+ @LISTHASH_PREFIX@_list_t *newlist;
57
+
58
+ #ifdef DS_DEBUG
59
+ printf("in @LISTHASH_PREFIX@_list_new(%d, 0x%lx)\n", flags, cmpfunc);
60
+ #endif
61
+
62
+ if (flags != LIST_USERFUNC
63
+ && flags != LIST_STACK
64
+ && flags != LIST_QUEUE)
65
+ {
66
+ errno = EINVAL;
67
+ return NULL;
68
+ }
69
+
70
+ newlist = (@LISTHASH_PREFIX@_list_t *)calloc(1, sizeof(@LISTHASH_PREFIX@_list_t));
71
+ if (cmpfunc != NULL)
72
+ newlist->cmpfunc = cmpfunc;
73
+ else
74
+ newlist->cmpfunc = (@LISTHASH_PREFIX@_cmpfunc_t)strcmp;
75
+ newlist->flags = flags;
76
+
77
+ return newlist;
78
+ }
79
+
80
+
81
+ /*
82
+ ** @LISTHASH_PREFIX@_list_iterate() - call a function for every element
83
+ ** in a list
84
+ */
85
+ int
86
+ @LISTHASH_PREFIX@_list_iterate(@LISTHASH_PREFIX@_list_t *l,
87
+ @LISTHASH_PREFIX@_iterate_func_t plugin,
88
+ void *state)
89
+ {
90
+ @LISTHASH_PREFIX@_listptr_t n;
91
+
92
+ if (l == NULL)
93
+ return -1;
94
+
95
+ for (n = l->first; n != NULL; n = n->next)
96
+ {
97
+ if ((*plugin)(n->data, state) == -1)
98
+ return -1;
99
+ }
100
+
101
+ return 0;
102
+ }
103
+
104
+
105
+ /*
106
+ ** @LISTHASH_PREFIX@_list_empty() - empty the list
107
+ */
108
+ void
109
+ @LISTHASH_PREFIX@_list_empty(@LISTHASH_PREFIX@_list_t *l, @LISTHASH_PREFIX@_freefunc_t freefunc)
110
+ {
111
+ @LISTHASH_PREFIX@_listptr_t n;
112
+
113
+ for (n = l->first; n != NULL; n = l->first)
114
+ {
115
+ l->first = n->next;
116
+ if (freefunc != NULL)
117
+ (*freefunc)(n->data);
118
+ free(n);
119
+ }
120
+
121
+ l->nents = 0;
122
+ }
123
+
124
+
125
+ /*
126
+ ** @LISTHASH_PREFIX@_list_free() - remove and free() the whole list
127
+ */
128
+ void
129
+ @LISTHASH_PREFIX@_list_free(@LISTHASH_PREFIX@_list_t *l, @LISTHASH_PREFIX@_freefunc_t freefunc)
130
+ {
131
+ @LISTHASH_PREFIX@_list_empty(l, freefunc);
132
+ free(l);
133
+ }
134
+
135
+
136
+ /*
137
+ ** @LISTHASH_PREFIX@_list_nents() - return number of elements in the list
138
+ */
139
+ unsigned int
140
+ @LISTHASH_PREFIX@_list_nents(@LISTHASH_PREFIX@_list_t *l)
141
+ {
142
+ return l->nents;
143
+ }
144
+
145
+
146
+ /*
147
+ ** @LISTHASH_PREFIX@_list_add() - adds an element to the list
148
+ ** returns:
149
+ ** 0 success
150
+ ** -1 (and sets errno) failure
151
+ */
152
+ int
153
+ @LISTHASH_PREFIX@_list_add(@LISTHASH_PREFIX@_list_t *l, void *data)
154
+ {
155
+ @LISTHASH_PREFIX@_listptr_t n, m;
156
+
157
+ #ifdef DS_DEBUG
158
+ printf("==> @LISTHASH_PREFIX@_list_add(\"%s\")\n", (char *)data);
159
+ #endif
160
+
161
+ n = (@LISTHASH_PREFIX@_listptr_t)malloc(sizeof(struct @LISTHASH_PREFIX@_node));
162
+ if (n == NULL)
163
+ return -1;
164
+ n->data = data;
165
+ l->nents++;
166
+
167
+ #ifdef DS_DEBUG
168
+ printf(" @LISTHASH_PREFIX@_list_add(): allocated data\n");
169
+ #endif
170
+
171
+ /* if the list is empty */
172
+ if (l->first == NULL)
173
+ {
174
+ l->last = l->first = n;
175
+ n->next = n->prev = NULL;
176
+ #ifdef DS_DEBUG
177
+ printf("<== @LISTHASH_PREFIX@_list_add(): list was empty; "
178
+ "added first element and returning 0\n");
179
+ #endif
180
+ return 0;
181
+ }
182
+
183
+ #ifdef DS_DEBUG
184
+ printf(" @LISTHASH_PREFIX@_list_add(): list not empty\n");
185
+ #endif
186
+
187
+ if (l->flags == LIST_STACK)
188
+ {
189
+ n->prev = NULL;
190
+ n->next = l->first;
191
+ if (l->first != NULL)
192
+ l->first->prev = n;
193
+ l->first = n;
194
+ #ifdef DS_DEBUG
195
+ printf("<== @LISTHASH_PREFIX@_list_add(): LIST_STACK set; "
196
+ "added in front\n");
197
+ #endif
198
+ return 0;
199
+ }
200
+
201
+ if (l->flags == LIST_QUEUE)
202
+ {
203
+ n->prev = l->last;
204
+ n->next = NULL;
205
+ if (l->last != NULL)
206
+ l->last->next = n;
207
+ l->last = n;
208
+ #ifdef DS_DEBUG
209
+ printf("<== @LISTHASH_PREFIX@_list_add(): LIST_QUEUE set; "
210
+ "added at end\n");
211
+ #endif
212
+ return 0;
213
+ }
214
+
215
+ for (m = l->first; m != NULL; m = m->next)
216
+ if ((*(l->cmpfunc))(data, m->data) < 0)
217
+ {
218
+ /*
219
+ ** if we find one that's bigger,
220
+ ** insert data before it
221
+ */
222
+ #ifdef DS_DEBUG
223
+ printf(" @LISTHASH_PREFIX@_list_add(): gotcha..."
224
+ "inserting data\n");
225
+ #endif
226
+ if (m == l->first)
227
+ {
228
+ l->first = n;
229
+ n->prev = NULL;
230
+ m->prev = n;
231
+ n->next = m;
232
+ #ifdef DS_DEBUG
233
+ printf("<== @LISTHASH_PREFIX@_list_add(): "
234
+ "added first, returning 0\n");
235
+ #endif
236
+ return 0;
237
+ }
238
+ m->prev->next = n;
239
+ n->prev = m->prev;
240
+ m->prev = n;
241
+ n->next = m;
242
+ #ifdef DS_DEBUG
243
+ printf("<== @LISTHASH_PREFIX@_list_add(): added middle,"
244
+ " returning 0\n");
245
+ #endif
246
+ return 0;
247
+ }
248
+
249
+ #ifdef DS_DEBUG
250
+ printf(" @LISTHASH_PREFIX@_list_add(): new data larger than current "
251
+ "list elements\n");
252
+ #endif
253
+
254
+ /* if we get here, data is bigger than everything in the list */
255
+ l->last->next = n;
256
+ n->prev = l->last;
257
+ l->last = n;
258
+ n->next = NULL;
259
+ #ifdef DS_DEBUG
260
+ printf("<== @LISTHASH_PREFIX@_list_add(): added end, returning 0\n");
261
+ #endif
262
+ return 0;
263
+ }
264
+
265
+
266
+ /*
267
+ ** @LISTHASH_PREFIX@_list_del() - remove the element pointed to by n
268
+ ** from the list l
269
+ */
270
+ void
271
+ @LISTHASH_PREFIX@_list_del(@LISTHASH_PREFIX@_list_t *l, @LISTHASH_PREFIX@_listptr_t *n)
272
+ {
273
+ @LISTHASH_PREFIX@_listptr_t m;
274
+
275
+ #ifdef DS_DEBUG
276
+ printf("==> @LISTHASH_PREFIX@_list_del()\n");
277
+ #endif
278
+
279
+ l->nents--;
280
+
281
+ m = (*n)->next;
282
+
283
+ if ((*n)->prev)
284
+ (*n)->prev->next = (*n)->next;
285
+ else
286
+ l->first = (*n)->next;
287
+ if ((*n)->next)
288
+ (*n)->next->prev = (*n)->prev;
289
+ else
290
+ l->last = (*n)->prev;
291
+
292
+ free(*n);
293
+ *n = m;
294
+ }
295
+
296
+
297
+ /*
298
+ ** @LISTHASH_PREFIX@_list_next() - get the next element in the list
299
+ ** returns:
300
+ ** 1 success
301
+ ** 0 end of list
302
+ */
303
+ int
304
+ @LISTHASH_PREFIX@_list_next(@LISTHASH_PREFIX@_list_t *l,
305
+ @LISTHASH_PREFIX@_listptr_t *n)
306
+ {
307
+ if (*n == NULL)
308
+ *n = l->first;
309
+ else
310
+ *n = (*n)->next;
311
+
312
+ return (*n != NULL ? 1 : 0);
313
+ }
314
+
315
+
316
+ /*
317
+ ** @LISTHASH_PREFIX@_list_prev() - get the previous element in the list
318
+ ** returns:
319
+ ** 1 success
320
+ ** 0 end of list
321
+ */
322
+ int
323
+ @LISTHASH_PREFIX@_list_prev(@LISTHASH_PREFIX@_list_t *l,
324
+ @LISTHASH_PREFIX@_listptr_t *n)
325
+ {
326
+ if (*n == NULL)
327
+ *n = l->last;
328
+ else
329
+ *n = (*n)->prev;
330
+
331
+ return (*n != NULL ? 1 : 0);
332
+ }
333
+
334
+
335
+ /*
336
+ ** @LISTHASH_PREFIX@_str_match() - string matching function
337
+ ** returns:
338
+ ** 1 match
339
+ ** 0 no match
340
+ */
341
+ int
342
+ @LISTHASH_PREFIX@_str_match(char *check, char *data)
343
+ {
344
+ return !strcmp(check, data);
345
+ }
346
+
347
+
348
+ /*
349
+ ** @LISTHASH_PREFIX@_list_add_str() - splits string str into delim-delimited
350
+ ** elements and adds them to list l
351
+ ** returns:
352
+ ** 0 success
353
+ ** -1 (and sets errno) failure
354
+ */
355
+ int
356
+ @LISTHASH_PREFIX@_list_add_str(@LISTHASH_PREFIX@_list_t *l,
357
+ char *str, char *delim)
358
+ {
359
+ char tmp[10240];
360
+ char *tokp, *nextp = tmp;
361
+
362
+ strlcpy(tmp, str, sizeof(tmp));
363
+ while ((tokp = strsep(&nextp, delim)) != NULL)
364
+ {
365
+ if (*tokp == '\0')
366
+ continue;
367
+ if (@LISTHASH_PREFIX@_list_add(l, strdup(tokp)))
368
+ return -1;
369
+ }
370
+
371
+ return 0;
372
+ }
373
+
374
+
375
+ /*
376
+ ** @LISTHASH_PREFIX@_list_search() - find an entry in a list
377
+ ** returns:
378
+ ** 1 match found
379
+ ** 0 no match
380
+ */
381
+ int
382
+ @LISTHASH_PREFIX@_list_search(@LISTHASH_PREFIX@_list_t *l,
383
+ @LISTHASH_PREFIX@_listptr_t *n, void *data,
384
+ @LISTHASH_PREFIX@_matchfunc_t matchfunc)
385
+ {
386
+ #ifdef DS_DEBUG
387
+ printf("==> @LISTHASH_PREFIX@_list_search(l=0x%lx, n=0x%lx, \"%s\")\n",
388
+ l, n, (char *)data);
389
+ #endif
390
+
391
+ if (matchfunc == NULL)
392
+ matchfunc = (@LISTHASH_PREFIX@_matchfunc_t)@LISTHASH_PREFIX@_str_match;
393
+
394
+ if (*n == NULL)
395
+ *n = l->first;
396
+ else
397
+ *n = (*n)->next;
398
+
399
+ for (; *n != NULL; *n = (*n)->next)
400
+ {
401
+ #ifdef DS_DEBUG
402
+ printf("checking against \"%s\"\n", (char *)(*n)->data);
403
+ #endif
404
+ if ((*(matchfunc))(data, (*n)->data) != 0)
405
+ return 1;
406
+ }
407
+
408
+ #ifdef DS_DEBUG
409
+ printf("no matches found\n");
410
+ #endif
411
+ return 0;
412
+ }
413
+
414
+
415
+ /*
416
+ ** @LISTHASH_PREFIX@_list_dup() - copy an existing list
417
+ */
418
+ @LISTHASH_PREFIX@_list_t *
419
+ @LISTHASH_PREFIX@_list_dup(@LISTHASH_PREFIX@_list_t *l)
420
+ {
421
+ @LISTHASH_PREFIX@_list_t *newlist;
422
+ @LISTHASH_PREFIX@_listptr_t n;
423
+
424
+ newlist = @LISTHASH_PREFIX@_list_new(l->flags, l->cmpfunc);
425
+ for (n = l->first; n != NULL; n = n->next)
426
+ @LISTHASH_PREFIX@_list_add(newlist, n->data);
427
+
428
+ #ifdef DS_DEBUG
429
+ printf("returning from @LISTHASH_PREFIX@_list_dup()\n");
430
+ #endif
431
+ return newlist;
432
+ }
433
+
434
+
435
+ /*
436
+ ** @LISTHASH_PREFIX@_list_merge() - merge two lists into a new list
437
+ */
438
+ @LISTHASH_PREFIX@_list_t *
439
+ @LISTHASH_PREFIX@_list_merge(@LISTHASH_PREFIX@_cmpfunc_t cmpfunc, int flags,
440
+ @LISTHASH_PREFIX@_list_t *list1,
441
+ @LISTHASH_PREFIX@_list_t *list2)
442
+ {
443
+ @LISTHASH_PREFIX@_list_t *newlist;
444
+ @LISTHASH_PREFIX@_listptr_t n;
445
+
446
+ newlist = @LISTHASH_PREFIX@_list_new(flags, cmpfunc);
447
+
448
+ n = NULL;
449
+ while (@LISTHASH_PREFIX@_list_next(list1, &n) != 0)
450
+ @LISTHASH_PREFIX@_list_add(newlist, n->data);
451
+ n = NULL;
452
+ while (@LISTHASH_PREFIX@_list_next(list2, &n) != 0)
453
+ @LISTHASH_PREFIX@_list_add(newlist, n->data);
454
+
455
+ return newlist;
456
+ }
457
+
458
+
@@ -0,0 +1,86 @@
1
+ .TH @LISTHASH_PREFIX@_list_new 3 "Jan 2000" "University of Illinois" "C Library Calls"
2
+ \" @configure_input@
3
+ .SH NAME
4
+ @LISTHASH_PREFIX@_list_new, @LISTHASH_PREFIX@_list_free, @LISTHASH_PREFIX@_list_next,
5
+ @LISTHASH_PREFIX@_list_prev, @LISTHASH_PREFIX@_list_add, @LISTHASH_PREFIX@_list_del,
6
+ @LISTHASH_PREFIX@_list_search, @LISTHASH_PREFIX@_list_dup, @LISTHASH_PREFIX@_list_merge,
7
+ @LISTHASH_PREFIX@_list_add_str \- linked list routines
8
+ .SH SYNOPSIS
9
+ .B #include <@LISTHASH_PREFIX@.h>
10
+ .P
11
+ .BI "@LISTHASH_PREFIX@_list_t *@LISTHASH_PREFIX@_list_new(int " flags ","
12
+ .BI "int (*" cmpfunc ")());"
13
+ .br
14
+ .BI "void @LISTHASH_PREFIX@_list_free(@LISTHASH_PREFIX@_list_t *" l ", void (*" freefunc ")());"
15
+ .br
16
+ .BI "int @LISTHASH_PREFIX@_list_add_str(@LISTHASH_PREFIX@_list_t *" l ", char *" str ","
17
+ .BI "char *" delim ");"
18
+ .br
19
+ .BI "int @LISTHASH_PREFIX@_list_add(@LISTHASH_PREFIX@_list_t *" l ", void *" data ");"
20
+ .br
21
+ .BI "void @LISTHASH_PREFIX@_list_del(@LISTHASH_PREFIX@_list_t *" l ", @LISTHASH_PREFIX@_node_t **" n ");"
22
+ .br
23
+ .BI "int @LISTHASH_PREFIX@_list_search(@LISTHASH_PREFIX@_list_t *" l ", @LISTHASH_PREFIX@_node_t **" n ","
24
+ .BI "void *" data ", int (*" matchfunc ")());"
25
+ .br
26
+ .BI "int @LISTHASH_PREFIX@_list_next(@LISTHASH_PREFIX@_list_t *" l ", @LISTHASH_PREFIX@_node_t **" n ");"
27
+ .br
28
+ .BI "int @LISTHASH_PREFIX@_list_prev(@LISTHASH_PREFIX@_list_t *" l ", @LISTHASH_PREFIX@_node_t **" n ");"
29
+ .br
30
+ .BI "@LISTHASH_PREFIX@_list_t *@LISTHASH_PREFIX@_list_dup(@LISTHASH_PREFIX@_list_t *" l ");"
31
+ .br
32
+ .BI "@LISTHASH_PREFIX@_list_t *@LISTHASH_PREFIX@_list_merge(int (*" cmpfunc ")(), int " flags ","
33
+ .BI "@LISTHASH_PREFIX@_list_t *" list1 ", @LISTHASH_PREFIX@_list_t *" list2 ");"
34
+ .SH DESCRIPTION
35
+ The \fB@LISTHASH_PREFIX@_list_new\fP() function creates a new list. The \fIflags\fP
36
+ argument must be one of the following values:
37
+ .IP \fBLIST_USERFUNC\fP
38
+ The \fIcmpfunc\fP argument points to a user-supplied function which
39
+ determines the ordering of the list.
40
+ .IP \fBLIST_STACK\fP
41
+ Use the list as a stack. New elements are added to the front of the list.
42
+ .IP \fBLIST_QUEUE\fP
43
+ Use the list as a queue. New elements are added to the end of the list.
44
+ .PP
45
+ The \fB@LISTHASH_PREFIX@_list_free\fP() function deallocates all memory associated
46
+ with the list \fIl\fP. If \fIfreefunc\fP is not \fINULL\fP, it is called
47
+ to free memory associated with each node in the list.
48
+
49
+ The \fB@LISTHASH_PREFIX@_list_add\fP() function adds the element pointed to by
50
+ \fIdata\fP to the list \fIl\fP. The position of the new element will
51
+ be determined by the flags passed to \fB@LISTHASH_PREFIX@_list_new\fP() when the
52
+ list was created.
53
+
54
+ The \fB@LISTHASH_PREFIX@_list_add_str\fP() function tokenizes the string \fIstr\fP
55
+ using the delimiter characters in the string \fIdelim\fP. The resulting
56
+ tokens are added to list \fIl\fP using \fB@LISTHASH_PREFIX@_list_add\fP().
57
+
58
+ The \fB@LISTHASH_PREFIX@_list_search\fP() function searches for an element which
59
+ matches \fIdata\fP using the matching function \fImatchfunc\fP. If
60
+ \fImatchfunc\fP is \fINULL\fP, a default matching function designed for
61
+ ASCII strings is used. Searching begins from the node pointed to by
62
+ \fIn\fP.
63
+
64
+ The \fB@LISTHASH_PREFIX@_list_del\fP() function removes the entry pointed to by
65
+ \fIn\fP from the list pointed to by \fIl\fP.
66
+
67
+ The \fB@LISTHASH_PREFIX@_list_dup\fP() function creates a copy of the list \fIl\fP
68
+ using dynamically allocated memory.
69
+
70
+ The \fB@LISTHASH_PREFIX@_list_merge\fP() function creates a new
71
+ list with \fIflags\fP and \fIcmpfunc\fP, in the same way as
72
+ \fB@LISTHASH_PREFIX@_list_new\fP(). It then adds all elements from \fIlist1\fP
73
+ and \fIlist2\fP using \fB@LISTHASH_PREFIX@_list_add\fP().
74
+ .SH RETURN VALUE
75
+ The \fB@LISTHASH_PREFIX@_list_new\fP(), \fB@LISTHASH_PREFIX@_list_dup\fP(), and
76
+ \fB@LISTHASH_PREFIX@_list_merge\fP() functions return a pointer to the new list
77
+ structure, or \fINULL\fP on error.
78
+
79
+ The \fB@LISTHASH_PREFIX@_list_next\fP(), \fB@LISTHASH_PREFIX@_list_prev\fP(), and
80
+ \fB@LISTHASH_PREFIX@_list_search\fP() functions return 1 when valid data is
81
+ returned, or 0 otherwise.
82
+
83
+ The \fB@LISTHASH_PREFIX@_list_add\fP() and \fB@LISTHASH_PREFIX@_list_add_str\fP() functions
84
+ return 0 on success, or -1 on error.
85
+ .SH SEE ALSO
86
+ .BR @LISTHASH_PREFIX@_hash_new (3)