tarruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
+ /* listhash/libtar_list.c. Generated from list.c.in by configure. */
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
+ ** libtar_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 <libtar_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
+ ** libtar_listptr_reset() - reset a list pointer
32
+ */
33
+ void
34
+ libtar_listptr_reset(libtar_listptr_t *lp)
35
+ {
36
+ *lp = NULL;
37
+ }
38
+
39
+
40
+ /*
41
+ ** libtar_listptr_data() - retrieve the data pointed to by lp
42
+ */
43
+ void *
44
+ libtar_listptr_data(libtar_listptr_t *lp)
45
+ {
46
+ return (*lp)->data;
47
+ }
48
+
49
+
50
+ /*
51
+ ** libtar_list_new() - create a new, empty list
52
+ */
53
+ libtar_list_t *
54
+ libtar_list_new(int flags, libtar_cmpfunc_t cmpfunc)
55
+ {
56
+ libtar_list_t *newlist;
57
+
58
+ #ifdef DS_DEBUG
59
+ printf("in libtar_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 = (libtar_list_t *)calloc(1, sizeof(libtar_list_t));
71
+ if (cmpfunc != NULL)
72
+ newlist->cmpfunc = cmpfunc;
73
+ else
74
+ newlist->cmpfunc = (libtar_cmpfunc_t)strcmp;
75
+ newlist->flags = flags;
76
+
77
+ return newlist;
78
+ }
79
+
80
+
81
+ /*
82
+ ** libtar_list_iterate() - call a function for every element
83
+ ** in a list
84
+ */
85
+ int
86
+ libtar_list_iterate(libtar_list_t *l,
87
+ libtar_iterate_func_t plugin,
88
+ void *state)
89
+ {
90
+ libtar_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
+ ** libtar_list_empty() - empty the list
107
+ */
108
+ void
109
+ libtar_list_empty(libtar_list_t *l, libtar_freefunc_t freefunc)
110
+ {
111
+ libtar_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
+ ** libtar_list_free() - remove and free() the whole list
127
+ */
128
+ void
129
+ libtar_list_free(libtar_list_t *l, libtar_freefunc_t freefunc)
130
+ {
131
+ libtar_list_empty(l, freefunc);
132
+ free(l);
133
+ }
134
+
135
+
136
+ /*
137
+ ** libtar_list_nents() - return number of elements in the list
138
+ */
139
+ unsigned int
140
+ libtar_list_nents(libtar_list_t *l)
141
+ {
142
+ return l->nents;
143
+ }
144
+
145
+
146
+ /*
147
+ ** libtar_list_add() - adds an element to the list
148
+ ** returns:
149
+ ** 0 success
150
+ ** -1 (and sets errno) failure
151
+ */
152
+ int
153
+ libtar_list_add(libtar_list_t *l, void *data)
154
+ {
155
+ libtar_listptr_t n, m;
156
+
157
+ #ifdef DS_DEBUG
158
+ printf("==> libtar_list_add(\"%s\")\n", (char *)data);
159
+ #endif
160
+
161
+ n = (libtar_listptr_t)malloc(sizeof(struct libtar_node));
162
+ if (n == NULL)
163
+ return -1;
164
+ n->data = data;
165
+ l->nents++;
166
+
167
+ #ifdef DS_DEBUG
168
+ printf(" libtar_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("<== libtar_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(" libtar_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("<== libtar_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("<== libtar_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(" libtar_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("<== libtar_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("<== libtar_list_add(): added middle,"
244
+ " returning 0\n");
245
+ #endif
246
+ return 0;
247
+ }
248
+
249
+ #ifdef DS_DEBUG
250
+ printf(" libtar_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("<== libtar_list_add(): added end, returning 0\n");
261
+ #endif
262
+ return 0;
263
+ }
264
+
265
+
266
+ /*
267
+ ** libtar_list_del() - remove the element pointed to by n
268
+ ** from the list l
269
+ */
270
+ void
271
+ libtar_list_del(libtar_list_t *l, libtar_listptr_t *n)
272
+ {
273
+ libtar_listptr_t m;
274
+
275
+ #ifdef DS_DEBUG
276
+ printf("==> libtar_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
+ ** libtar_list_next() - get the next element in the list
299
+ ** returns:
300
+ ** 1 success
301
+ ** 0 end of list
302
+ */
303
+ int
304
+ libtar_list_next(libtar_list_t *l,
305
+ libtar_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
+ ** libtar_list_prev() - get the previous element in the list
318
+ ** returns:
319
+ ** 1 success
320
+ ** 0 end of list
321
+ */
322
+ int
323
+ libtar_list_prev(libtar_list_t *l,
324
+ libtar_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
+ ** libtar_str_match() - string matching function
337
+ ** returns:
338
+ ** 1 match
339
+ ** 0 no match
340
+ */
341
+ int
342
+ libtar_str_match(char *check, char *data)
343
+ {
344
+ return !strcmp(check, data);
345
+ }
346
+
347
+
348
+ /*
349
+ ** libtar_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
+ libtar_list_add_str(libtar_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 (libtar_list_add(l, strdup(tokp)))
368
+ return -1;
369
+ }
370
+
371
+ return 0;
372
+ }
373
+
374
+
375
+ /*
376
+ ** libtar_list_search() - find an entry in a list
377
+ ** returns:
378
+ ** 1 match found
379
+ ** 0 no match
380
+ */
381
+ int
382
+ libtar_list_search(libtar_list_t *l,
383
+ libtar_listptr_t *n, void *data,
384
+ libtar_matchfunc_t matchfunc)
385
+ {
386
+ #ifdef DS_DEBUG
387
+ printf("==> libtar_list_search(l=0x%lx, n=0x%lx, \"%s\")\n",
388
+ l, n, (char *)data);
389
+ #endif
390
+
391
+ if (matchfunc == NULL)
392
+ matchfunc = (libtar_matchfunc_t)libtar_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
+ ** libtar_list_dup() - copy an existing list
417
+ */
418
+ libtar_list_t *
419
+ libtar_list_dup(libtar_list_t *l)
420
+ {
421
+ libtar_list_t *newlist;
422
+ libtar_listptr_t n;
423
+
424
+ newlist = libtar_list_new(l->flags, l->cmpfunc);
425
+ for (n = l->first; n != NULL; n = n->next)
426
+ libtar_list_add(newlist, n->data);
427
+
428
+ #ifdef DS_DEBUG
429
+ printf("returning from libtar_list_dup()\n");
430
+ #endif
431
+ return newlist;
432
+ }
433
+
434
+
435
+ /*
436
+ ** libtar_list_merge() - merge two lists into a new list
437
+ */
438
+ libtar_list_t *
439
+ libtar_list_merge(libtar_cmpfunc_t cmpfunc, int flags,
440
+ libtar_list_t *list1,
441
+ libtar_list_t *list2)
442
+ {
443
+ libtar_list_t *newlist;
444
+ libtar_listptr_t n;
445
+
446
+ newlist = libtar_list_new(flags, cmpfunc);
447
+
448
+ n = NULL;
449
+ while (libtar_list_next(list1, &n) != 0)
450
+ libtar_list_add(newlist, n->data);
451
+ n = NULL;
452
+ while (libtar_list_next(list2, &n) != 0)
453
+ libtar_list_add(newlist, n->data);
454
+
455
+ return newlist;
456
+ }
457
+
458
+
@@ -0,0 +1,196 @@
1
+ /* listhash/libtar_listhash.h. Generated from listhash.h.in by configure. */
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
+ ** libtar_listhash.h - header file for listhash module
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
+ #ifndef libtar_LISTHASH_H
16
+ #define libtar_LISTHASH_H
17
+
18
+
19
+ /***** list.c **********************************************************/
20
+
21
+ /*
22
+ ** Comparison function (used to determine order of elements in a list)
23
+ ** returns less than, equal to, or greater than 0
24
+ ** if data1 is less than, equal to, or greater than data2
25
+ */
26
+ typedef int (*libtar_cmpfunc_t)(void *, void *);
27
+
28
+ /*
29
+ ** Free function (for freeing allocated memory in each element)
30
+ */
31
+ typedef void (*libtar_freefunc_t)(void *);
32
+
33
+ /*
34
+ ** Plugin function for libtar_list_iterate()
35
+ */
36
+ typedef int (*libtar_iterate_func_t)(void *, void *);
37
+
38
+ /*
39
+ ** Matching function (used to find elements in a list)
40
+ ** first argument is the data to search for
41
+ ** second argument is the list element it's being compared to
42
+ ** returns 0 if no match is found, non-zero otherwise
43
+ */
44
+ typedef int (*libtar_matchfunc_t)(void *, void *);
45
+
46
+
47
+ struct libtar_node
48
+ {
49
+ void *data;
50
+ struct libtar_node *next;
51
+ struct libtar_node *prev;
52
+ };
53
+ typedef struct libtar_node *libtar_listptr_t;
54
+
55
+ struct libtar_list
56
+ {
57
+ libtar_listptr_t first;
58
+ libtar_listptr_t last;
59
+ libtar_cmpfunc_t cmpfunc;
60
+ int flags;
61
+ unsigned int nents;
62
+ };
63
+ typedef struct libtar_list libtar_list_t;
64
+
65
+
66
+ /* values for flags */
67
+ #define LIST_USERFUNC 0 /* use cmpfunc() to order */
68
+ #define LIST_STACK 1 /* new elements go in front */
69
+ #define LIST_QUEUE 2 /* new elements go at the end */
70
+
71
+
72
+ /* reset a list pointer */
73
+ void libtar_listptr_reset(libtar_listptr_t *);
74
+
75
+ /* retrieve the data being pointed to */
76
+ void *libtar_listptr_data(libtar_listptr_t *);
77
+
78
+ /* creates a new, empty list */
79
+ libtar_list_t *libtar_list_new(int, libtar_cmpfunc_t);
80
+
81
+ /* call a function for every element in a list */
82
+ int libtar_list_iterate(libtar_list_t *,
83
+ libtar_iterate_func_t, void *);
84
+
85
+ /* empty the list */
86
+ void libtar_list_empty(libtar_list_t *,
87
+ libtar_freefunc_t);
88
+
89
+ /* remove and free() the entire list */
90
+ void libtar_list_free(libtar_list_t *,
91
+ libtar_freefunc_t);
92
+
93
+ /* add elements */
94
+ int libtar_list_add(libtar_list_t *, void *);
95
+
96
+ /* removes an element from the list - returns -1 on error */
97
+ void libtar_list_del(libtar_list_t *,
98
+ libtar_listptr_t *);
99
+
100
+ /* returns 1 when valid data is returned, or 0 at end of list */
101
+ int libtar_list_next(libtar_list_t *,
102
+ libtar_listptr_t *);
103
+
104
+ /* returns 1 when valid data is returned, or 0 at end of list */
105
+ int libtar_list_prev(libtar_list_t *,
106
+ libtar_listptr_t *);
107
+
108
+ /* return 1 if the data matches a list entry, 0 otherwise */
109
+ int libtar_list_search(libtar_list_t *,
110
+ libtar_listptr_t *, void *,
111
+ libtar_matchfunc_t);
112
+
113
+ /* return number of elements from list */
114
+ unsigned int libtar_list_nents(libtar_list_t *);
115
+
116
+ /* adds elements from a string delimited by delim */
117
+ int libtar_list_add_str(libtar_list_t *, char *, char *);
118
+
119
+ /* string matching function */
120
+ int libtar_str_match(char *, char *);
121
+
122
+
123
+ /***** hash.c **********************************************************/
124
+
125
+ /*
126
+ ** Hashing function (determines which bucket the given key hashes into)
127
+ ** first argument is the key to hash
128
+ ** second argument is the total number of buckets
129
+ ** returns the bucket number
130
+ */
131
+ typedef unsigned int (*libtar_hashfunc_t)(void *, unsigned int);
132
+
133
+
134
+ struct libtar_hashptr
135
+ {
136
+ int bucket;
137
+ libtar_listptr_t node;
138
+ };
139
+ typedef struct libtar_hashptr libtar_hashptr_t;
140
+
141
+ struct libtar_hash
142
+ {
143
+ int numbuckets;
144
+ libtar_list_t **table;
145
+ libtar_hashfunc_t hashfunc;
146
+ unsigned int nents;
147
+ };
148
+ typedef struct libtar_hash libtar_hash_t;
149
+
150
+
151
+ /* reset a hash pointer */
152
+ void libtar_hashptr_reset(libtar_hashptr_t *);
153
+
154
+ /* retrieve the data being pointed to */
155
+ void *libtar_hashptr_data(libtar_hashptr_t *);
156
+
157
+ /* default hash function, optimized for 7-bit strings */
158
+ unsigned int libtar_str_hashfunc(char *, unsigned int);
159
+
160
+ /* return number of elements from hash */
161
+ unsigned int libtar_hash_nents(libtar_hash_t *);
162
+
163
+ /* create a new hash */
164
+ libtar_hash_t *libtar_hash_new(int, libtar_hashfunc_t);
165
+
166
+ /* empty the hash */
167
+ void libtar_hash_empty(libtar_hash_t *,
168
+ libtar_freefunc_t);
169
+
170
+ /* delete all the libtar_nodes of the hash and clean up */
171
+ void libtar_hash_free(libtar_hash_t *,
172
+ libtar_freefunc_t);
173
+
174
+ /* returns 1 when valid data is returned, or 0 at end of list */
175
+ int libtar_hash_next(libtar_hash_t *,
176
+ libtar_hashptr_t *);
177
+
178
+ /* return 1 if the data matches a list entry, 0 otherwise */
179
+ int libtar_hash_search(libtar_hash_t *,
180
+ libtar_hashptr_t *, void *,
181
+ libtar_matchfunc_t);
182
+
183
+ /* return 1 if the key matches a list entry, 0 otherwise */
184
+ int libtar_hash_getkey(libtar_hash_t *,
185
+ libtar_hashptr_t *, void *,
186
+ libtar_matchfunc_t);
187
+
188
+ /* inserting data */
189
+ int libtar_hash_add(libtar_hash_t *, void *);
190
+
191
+ /* delete an entry */
192
+ int libtar_hash_del(libtar_hash_t *,
193
+ libtar_hashptr_t *);
194
+
195
+ #endif /* ! libtar_LISTHASH_H */
196
+
@@ -0,0 +1,4 @@
1
+ #ifndef __PWD_H__
2
+ #define __PWD_H__
3
+
4
+ #endif
@@ -0,0 +1,8 @@
1
+ #ifndef __SYS_PARAM_H__
2
+ #define __SYS_PARAM_H__
3
+
4
+ #include <stdlib.h>
5
+
6
+ #define MAXPATHLEN _MAX_PATH
7
+
8
+ #endif
@@ -0,0 +1,35 @@
1
+ #ifndef __TAR_H__
2
+ #define __TAR_H__
3
+
4
+ /* General definitions */
5
+ #define TMAGIC "ustar" // ustar plus null byte.
6
+ #define TMAGLEN 6 // Length of the above.
7
+ #define TVERSION "00" // 00 without a null byte.
8
+ #define TVERSLEN 2 // Length of the above.
9
+
10
+ /* Typeflag field definitions */
11
+ #define REGTYPE '0' // Regular file.
12
+ #define AREGTYPE '\0' // Regular file.
13
+ #define LNKTYPE '1' // Link.
14
+ #define SYMTYPE '2' // Symbolic link.
15
+ #define CHRTYPE '3' // Character special.
16
+ #define BLKTYPE '4' // Block special.
17
+ #define DIRTYPE '5' // Directory.
18
+ #define FIFOTYPE '6' // FIFO special.
19
+ #define CONTTYPE '7' // Reserved.
20
+
21
+ /* Mode field bit definitions (octal) */
22
+ #define TSUID 04000 // Set UID on execution.
23
+ #define TSGID 02000 // Set GID on execution.
24
+ #define TSVTX 01000 // On directories, restricted deletion flag.
25
+ #define TUREAD 00400 // Read by owner.
26
+ #define TUWRITE 00200 // Write by owner special.
27
+ #define TUEXEC 00100 // Execute/search by owner.
28
+ #define TGREAD 00040 // Read by group.
29
+ #define TGWRITE 00020 // Write by group.
30
+ #define TGEXEC 00010 // Execute/search by group.
31
+ #define TOREAD 00004 // Read by other.
32
+ #define TOWRITE 00002 // Write by other.
33
+ #define TOEXEC 00001 // Execute/search by other.
34
+
35
+ #endif
@@ -0,0 +1,6 @@
1
+ #ifndef __UTIME_H__
2
+ #define __UTIME_H__
3
+
4
+ #include <sys/utime.h>
5
+
6
+ #endif
@@ -0,0 +1,10 @@
1
+ #ifndef __WIN32_TYPES_H__
2
+ #define __WIN32_TYPES_H__
3
+
4
+ typedef int ssize_t;
5
+ typedef int mode_t;
6
+ typedef int pid_t;
7
+ typedef int uid_t;
8
+ typedef int gid_t;
9
+
10
+ #endif