tarruby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +99 -0
- data/ext/extconf.rb +19 -0
- data/ext/libtar/COPYRIGHT +35 -0
- data/ext/libtar/ChangeLog +243 -0
- data/ext/libtar/ChangeLog-1.0.x +141 -0
- data/ext/libtar/INSTALL +183 -0
- data/ext/libtar/Makefile.in +51 -0
- data/ext/libtar/README +121 -0
- data/ext/libtar/TODO +10 -0
- data/ext/libtar/autoconf/ac_path_generic.m4 +136 -0
- data/ext/libtar/autoconf/aclocal.m4 +199 -0
- data/ext/libtar/autoconf/encap.m4 +133 -0
- data/ext/libtar/autoconf/install-sh +251 -0
- data/ext/libtar/autom4te.cache/output.0 +8102 -0
- data/ext/libtar/autom4te.cache/requests +112 -0
- data/ext/libtar/autom4te.cache/traces.0 +382 -0
- data/ext/libtar/compat/ChangeLog +31 -0
- data/ext/libtar/compat/README +12 -0
- data/ext/libtar/compat/TODO +4 -0
- data/ext/libtar/compat/basename.c +91 -0
- data/ext/libtar/compat/compat.h +260 -0
- data/ext/libtar/compat/dirname.c +96 -0
- data/ext/libtar/compat/fnmatch.c +237 -0
- data/ext/libtar/compat/gethostbyname_r.c +41 -0
- data/ext/libtar/compat/gethostname.c +36 -0
- data/ext/libtar/compat/getservbyname_r.c +41 -0
- data/ext/libtar/compat/glob.c +898 -0
- data/ext/libtar/compat/inet_aton.c +27 -0
- data/ext/libtar/compat/module.ac +591 -0
- data/ext/libtar/compat/snprintf.c +788 -0
- data/ext/libtar/compat/strdup.c +62 -0
- data/ext/libtar/compat/strlcat.c +72 -0
- data/ext/libtar/compat/strlcpy.c +68 -0
- data/ext/libtar/compat/strmode.c +199 -0
- data/ext/libtar/compat/strrstr.c +40 -0
- data/ext/libtar/compat/strsep.c +87 -0
- data/ext/libtar/config.h.in +187 -0
- data/ext/libtar/configure +8102 -0
- data/ext/libtar/configure.ac +114 -0
- data/ext/libtar/doc/Makefile.in +152 -0
- data/ext/libtar/doc/tar_append_file.3 +50 -0
- data/ext/libtar/doc/tar_block_read.3 +24 -0
- data/ext/libtar/doc/tar_extract_all.3 +43 -0
- data/ext/libtar/doc/tar_extract_file.3 +84 -0
- data/ext/libtar/doc/tar_open.3 +97 -0
- data/ext/libtar/doc/th_get_pathname.3 +63 -0
- data/ext/libtar/doc/th_print_long_ls.3 +22 -0
- data/ext/libtar/doc/th_read.3 +34 -0
- data/ext/libtar/doc/th_set_from_stat.3 +45 -0
- data/ext/libtar/lib/Makefile.in +92 -0
- data/ext/libtar/lib/append.c +272 -0
- data/ext/libtar/lib/block.c +384 -0
- data/ext/libtar/lib/decode.c +130 -0
- data/ext/libtar/lib/encode.c +237 -0
- data/ext/libtar/lib/extract.c +656 -0
- data/ext/libtar/lib/handle.c +150 -0
- data/ext/libtar/lib/internal.h +46 -0
- data/ext/libtar/lib/libtar.h +311 -0
- data/ext/libtar/lib/output.c +146 -0
- data/ext/libtar/lib/util.c +153 -0
- data/ext/libtar/lib/wrapper.c +175 -0
- data/ext/libtar/libtar/Makefile.in +73 -0
- data/ext/libtar/libtar/libtar.c +363 -0
- data/ext/libtar/listhash/ChangeLog +15 -0
- data/ext/libtar/listhash/TODO +21 -0
- data/ext/libtar/listhash/hash.c.in +344 -0
- data/ext/libtar/listhash/hash_new.3.in +74 -0
- data/ext/libtar/listhash/list.c.in +458 -0
- data/ext/libtar/listhash/list_new.3.in +86 -0
- data/ext/libtar/listhash/listhash.h.in +196 -0
- data/ext/libtar/listhash/module.ac +21 -0
- data/ext/libtar/win32/config.h +190 -0
- data/ext/libtar/win32/dirent.c +115 -0
- data/ext/libtar/win32/dirent.h +24 -0
- data/ext/libtar/win32/grp.h +4 -0
- data/ext/libtar/win32/listhash/libtar_hash.c +344 -0
- data/ext/libtar/win32/listhash/libtar_list.c +458 -0
- data/ext/libtar/win32/listhash/libtar_listhash.h +196 -0
- data/ext/libtar/win32/pwd.h +4 -0
- data/ext/libtar/win32/sys/param.h +8 -0
- data/ext/libtar/win32/tar.h +35 -0
- data/ext/libtar/win32/utime.h +6 -0
- data/ext/libtar/win32/win32/types.h +10 -0
- data/ext/tarruby.c +648 -0
- metadata +150 -0
@@ -0,0 +1,196 @@
|
|
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@_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 @LISTHASH_PREFIX@_LISTHASH_H
|
16
|
+
#define @LISTHASH_PREFIX@_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 (*@LISTHASH_PREFIX@_cmpfunc_t)(void *, void *);
|
27
|
+
|
28
|
+
/*
|
29
|
+
** Free function (for freeing allocated memory in each element)
|
30
|
+
*/
|
31
|
+
typedef void (*@LISTHASH_PREFIX@_freefunc_t)(void *);
|
32
|
+
|
33
|
+
/*
|
34
|
+
** Plugin function for @LISTHASH_PREFIX@_list_iterate()
|
35
|
+
*/
|
36
|
+
typedef int (*@LISTHASH_PREFIX@_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 (*@LISTHASH_PREFIX@_matchfunc_t)(void *, void *);
|
45
|
+
|
46
|
+
|
47
|
+
struct @LISTHASH_PREFIX@_node
|
48
|
+
{
|
49
|
+
void *data;
|
50
|
+
struct @LISTHASH_PREFIX@_node *next;
|
51
|
+
struct @LISTHASH_PREFIX@_node *prev;
|
52
|
+
};
|
53
|
+
typedef struct @LISTHASH_PREFIX@_node *@LISTHASH_PREFIX@_listptr_t;
|
54
|
+
|
55
|
+
struct @LISTHASH_PREFIX@_list
|
56
|
+
{
|
57
|
+
@LISTHASH_PREFIX@_listptr_t first;
|
58
|
+
@LISTHASH_PREFIX@_listptr_t last;
|
59
|
+
@LISTHASH_PREFIX@_cmpfunc_t cmpfunc;
|
60
|
+
int flags;
|
61
|
+
unsigned int nents;
|
62
|
+
};
|
63
|
+
typedef struct @LISTHASH_PREFIX@_list @LISTHASH_PREFIX@_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 @LISTHASH_PREFIX@_listptr_reset(@LISTHASH_PREFIX@_listptr_t *);
|
74
|
+
|
75
|
+
/* retrieve the data being pointed to */
|
76
|
+
void *@LISTHASH_PREFIX@_listptr_data(@LISTHASH_PREFIX@_listptr_t *);
|
77
|
+
|
78
|
+
/* creates a new, empty list */
|
79
|
+
@LISTHASH_PREFIX@_list_t *@LISTHASH_PREFIX@_list_new(int, @LISTHASH_PREFIX@_cmpfunc_t);
|
80
|
+
|
81
|
+
/* call a function for every element in a list */
|
82
|
+
int @LISTHASH_PREFIX@_list_iterate(@LISTHASH_PREFIX@_list_t *,
|
83
|
+
@LISTHASH_PREFIX@_iterate_func_t, void *);
|
84
|
+
|
85
|
+
/* empty the list */
|
86
|
+
void @LISTHASH_PREFIX@_list_empty(@LISTHASH_PREFIX@_list_t *,
|
87
|
+
@LISTHASH_PREFIX@_freefunc_t);
|
88
|
+
|
89
|
+
/* remove and free() the entire list */
|
90
|
+
void @LISTHASH_PREFIX@_list_free(@LISTHASH_PREFIX@_list_t *,
|
91
|
+
@LISTHASH_PREFIX@_freefunc_t);
|
92
|
+
|
93
|
+
/* add elements */
|
94
|
+
int @LISTHASH_PREFIX@_list_add(@LISTHASH_PREFIX@_list_t *, void *);
|
95
|
+
|
96
|
+
/* removes an element from the list - returns -1 on error */
|
97
|
+
void @LISTHASH_PREFIX@_list_del(@LISTHASH_PREFIX@_list_t *,
|
98
|
+
@LISTHASH_PREFIX@_listptr_t *);
|
99
|
+
|
100
|
+
/* returns 1 when valid data is returned, or 0 at end of list */
|
101
|
+
int @LISTHASH_PREFIX@_list_next(@LISTHASH_PREFIX@_list_t *,
|
102
|
+
@LISTHASH_PREFIX@_listptr_t *);
|
103
|
+
|
104
|
+
/* returns 1 when valid data is returned, or 0 at end of list */
|
105
|
+
int @LISTHASH_PREFIX@_list_prev(@LISTHASH_PREFIX@_list_t *,
|
106
|
+
@LISTHASH_PREFIX@_listptr_t *);
|
107
|
+
|
108
|
+
/* return 1 if the data matches a list entry, 0 otherwise */
|
109
|
+
int @LISTHASH_PREFIX@_list_search(@LISTHASH_PREFIX@_list_t *,
|
110
|
+
@LISTHASH_PREFIX@_listptr_t *, void *,
|
111
|
+
@LISTHASH_PREFIX@_matchfunc_t);
|
112
|
+
|
113
|
+
/* return number of elements from list */
|
114
|
+
unsigned int @LISTHASH_PREFIX@_list_nents(@LISTHASH_PREFIX@_list_t *);
|
115
|
+
|
116
|
+
/* adds elements from a string delimited by delim */
|
117
|
+
int @LISTHASH_PREFIX@_list_add_str(@LISTHASH_PREFIX@_list_t *, char *, char *);
|
118
|
+
|
119
|
+
/* string matching function */
|
120
|
+
int @LISTHASH_PREFIX@_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 (*@LISTHASH_PREFIX@_hashfunc_t)(void *, unsigned int);
|
132
|
+
|
133
|
+
|
134
|
+
struct @LISTHASH_PREFIX@_hashptr
|
135
|
+
{
|
136
|
+
int bucket;
|
137
|
+
@LISTHASH_PREFIX@_listptr_t node;
|
138
|
+
};
|
139
|
+
typedef struct @LISTHASH_PREFIX@_hashptr @LISTHASH_PREFIX@_hashptr_t;
|
140
|
+
|
141
|
+
struct @LISTHASH_PREFIX@_hash
|
142
|
+
{
|
143
|
+
int numbuckets;
|
144
|
+
@LISTHASH_PREFIX@_list_t **table;
|
145
|
+
@LISTHASH_PREFIX@_hashfunc_t hashfunc;
|
146
|
+
unsigned int nents;
|
147
|
+
};
|
148
|
+
typedef struct @LISTHASH_PREFIX@_hash @LISTHASH_PREFIX@_hash_t;
|
149
|
+
|
150
|
+
|
151
|
+
/* reset a hash pointer */
|
152
|
+
void @LISTHASH_PREFIX@_hashptr_reset(@LISTHASH_PREFIX@_hashptr_t *);
|
153
|
+
|
154
|
+
/* retrieve the data being pointed to */
|
155
|
+
void *@LISTHASH_PREFIX@_hashptr_data(@LISTHASH_PREFIX@_hashptr_t *);
|
156
|
+
|
157
|
+
/* default hash function, optimized for 7-bit strings */
|
158
|
+
unsigned int @LISTHASH_PREFIX@_str_hashfunc(char *, unsigned int);
|
159
|
+
|
160
|
+
/* return number of elements from hash */
|
161
|
+
unsigned int @LISTHASH_PREFIX@_hash_nents(@LISTHASH_PREFIX@_hash_t *);
|
162
|
+
|
163
|
+
/* create a new hash */
|
164
|
+
@LISTHASH_PREFIX@_hash_t *@LISTHASH_PREFIX@_hash_new(int, @LISTHASH_PREFIX@_hashfunc_t);
|
165
|
+
|
166
|
+
/* empty the hash */
|
167
|
+
void @LISTHASH_PREFIX@_hash_empty(@LISTHASH_PREFIX@_hash_t *,
|
168
|
+
@LISTHASH_PREFIX@_freefunc_t);
|
169
|
+
|
170
|
+
/* delete all the @LISTHASH_PREFIX@_nodes of the hash and clean up */
|
171
|
+
void @LISTHASH_PREFIX@_hash_free(@LISTHASH_PREFIX@_hash_t *,
|
172
|
+
@LISTHASH_PREFIX@_freefunc_t);
|
173
|
+
|
174
|
+
/* returns 1 when valid data is returned, or 0 at end of list */
|
175
|
+
int @LISTHASH_PREFIX@_hash_next(@LISTHASH_PREFIX@_hash_t *,
|
176
|
+
@LISTHASH_PREFIX@_hashptr_t *);
|
177
|
+
|
178
|
+
/* return 1 if the data matches a list entry, 0 otherwise */
|
179
|
+
int @LISTHASH_PREFIX@_hash_search(@LISTHASH_PREFIX@_hash_t *,
|
180
|
+
@LISTHASH_PREFIX@_hashptr_t *, void *,
|
181
|
+
@LISTHASH_PREFIX@_matchfunc_t);
|
182
|
+
|
183
|
+
/* return 1 if the key matches a list entry, 0 otherwise */
|
184
|
+
int @LISTHASH_PREFIX@_hash_getkey(@LISTHASH_PREFIX@_hash_t *,
|
185
|
+
@LISTHASH_PREFIX@_hashptr_t *, void *,
|
186
|
+
@LISTHASH_PREFIX@_matchfunc_t);
|
187
|
+
|
188
|
+
/* inserting data */
|
189
|
+
int @LISTHASH_PREFIX@_hash_add(@LISTHASH_PREFIX@_hash_t *, void *);
|
190
|
+
|
191
|
+
/* delete an entry */
|
192
|
+
int @LISTHASH_PREFIX@_hash_del(@LISTHASH_PREFIX@_hash_t *,
|
193
|
+
@LISTHASH_PREFIX@_hashptr_t *);
|
194
|
+
|
195
|
+
#endif /* ! @LISTHASH_PREFIX@_LISTHASH_H */
|
196
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
AC_DEFUN(subdir[_INIT], [
|
2
|
+
AC_REQUIRE([COMPAT_FUNC_STRLCPY])
|
3
|
+
AC_REQUIRE([COMPAT_FUNC_STRSEP])
|
4
|
+
|
5
|
+
if test -z "$2"; then
|
6
|
+
LISTHASH_PREFIX="${PACKAGE_NAME}";
|
7
|
+
else
|
8
|
+
LISTHASH_PREFIX="$2";
|
9
|
+
fi
|
10
|
+
AC_SUBST([LISTHASH_PREFIX])
|
11
|
+
|
12
|
+
LISTHASH_DIR="$1";
|
13
|
+
AC_SUBST([LISTHASH_DIR])
|
14
|
+
|
15
|
+
AC_CONFIG_FILES([$1/${LISTHASH_PREFIX}_listhash.h:$1/listhash.h.in])
|
16
|
+
AC_CONFIG_FILES([$1/${LISTHASH_PREFIX}_list.c:$1/list.c.in])
|
17
|
+
AC_CONFIG_FILES([$1/${LISTHASH_PREFIX}_hash.c:$1/hash.c.in])
|
18
|
+
AC_CONFIG_FILES([$1/${LISTHASH_PREFIX}_list_new.3:$1/list_new.3.in])
|
19
|
+
AC_CONFIG_FILES([$1/${LISTHASH_PREFIX}_hash_new.3:$1/hash_new.3.in])
|
20
|
+
])
|
21
|
+
|
@@ -0,0 +1,190 @@
|
|
1
|
+
/* config.h.in. Generated from configure.ac by autoheader. */
|
2
|
+
|
3
|
+
/* Define if your system has a working basename */
|
4
|
+
/* #undef HAVE_BASENAME */
|
5
|
+
|
6
|
+
/* Define to 1 if you have the <ctype.h> header file. */
|
7
|
+
#define HAVE_CTYPE_H 1
|
8
|
+
|
9
|
+
/* Define to 1 if the system has the type `dev_t'. */
|
10
|
+
/* #undef HAVE_DEV_T */
|
11
|
+
|
12
|
+
/* Define if your system has a working dirname */
|
13
|
+
/* #undef HAVE_DIRNAME */
|
14
|
+
|
15
|
+
/* Define to 1 if your system has a working POSIX `fnmatch' function. */
|
16
|
+
/* #undef HAVE_FNMATCH */
|
17
|
+
|
18
|
+
/* Define to 1 if you have the <fnmatch.h> header file. */
|
19
|
+
/* #undef HAVE_FNMATCH_H */
|
20
|
+
|
21
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
22
|
+
/* #undef HAVE_INTTYPES_H */
|
23
|
+
|
24
|
+
/* Define to 1 if you have the `lchown' function. */
|
25
|
+
/* #undef HAVE_LCHOWN */
|
26
|
+
|
27
|
+
/* Define to 1 if you have the <libgen.h> header file. */
|
28
|
+
/* #undef HAVE_LIBGEN_H */
|
29
|
+
|
30
|
+
/* Define to 1 if you have the `z' library (-lz). */
|
31
|
+
#define HAVE_LIBZ 1
|
32
|
+
|
33
|
+
/* Define to 1 if the system has the type `major_t'. */
|
34
|
+
/* #undef HAVE_MAJOR_T */
|
35
|
+
|
36
|
+
/* Define to 1 if you have the <memory.h> header file. */
|
37
|
+
/* #undef HAVE_MEMORY_H */
|
38
|
+
|
39
|
+
/* Define to 1 if the system has the type `minor_t'. */
|
40
|
+
/* #undef HAVE_MINOR_T */
|
41
|
+
|
42
|
+
/* Define to 1 if the system has the type `nlink_t'. */
|
43
|
+
/* #undef HAVE_NLINK_T */
|
44
|
+
|
45
|
+
/* Define if your system has a working snprintf */
|
46
|
+
/* #undef HAVE_SNPRINTF */
|
47
|
+
|
48
|
+
/* Define to 1 if the system has the type `socklen_t'. */
|
49
|
+
/* #undef HAVE_SOCKLEN_T */
|
50
|
+
|
51
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
52
|
+
/* #undef HAVE_STDINT_H */
|
53
|
+
|
54
|
+
/* Define to 1 if you have the <stdlib.h> header file. */
|
55
|
+
/* #undef HAVE_STDLIB_H */
|
56
|
+
|
57
|
+
/* Define if you have the strdup function */
|
58
|
+
/* #undef HAVE_STRDUP */
|
59
|
+
|
60
|
+
/* Define to 1 if you have the `strftime' function. */
|
61
|
+
/* #undef HAVE_STRFTIME */
|
62
|
+
|
63
|
+
/* Define to 1 if you have the <strings.h> header file. */
|
64
|
+
/* #undef HAVE_STRINGS_H */
|
65
|
+
|
66
|
+
/* Define to 1 if you have the <string.h> header file. */
|
67
|
+
/* #undef HAVE_STRING_H */
|
68
|
+
|
69
|
+
/* Define if you have the strlcpy function */
|
70
|
+
/* #undef HAVE_STRLCPY */
|
71
|
+
|
72
|
+
/* Define if you have the strmode function */
|
73
|
+
/* #undef HAVE_STRMODE */
|
74
|
+
|
75
|
+
/* Define if you have the strsep function */
|
76
|
+
/* #undef HAVE_STRSEP */
|
77
|
+
|
78
|
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
79
|
+
/* #undef HAVE_SYS_STAT_H */
|
80
|
+
|
81
|
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
82
|
+
/* #undef HAVE_SYS_TYPES_H */
|
83
|
+
|
84
|
+
/* Define to 1 if the system has the type `uint64_t'. */
|
85
|
+
/* #undef HAVE_UINT64_T */
|
86
|
+
|
87
|
+
/* Define to 1 if you have the <unistd.h> header file. */
|
88
|
+
/* #undef HAVE_UNISTD_H */
|
89
|
+
|
90
|
+
/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
|
91
|
+
*/
|
92
|
+
/* #undef MAJOR_IN_MKDEV */
|
93
|
+
|
94
|
+
/* Define to 1 if `major', `minor', and `makedev' are declared in
|
95
|
+
<sysmacros.h>. */
|
96
|
+
/* #undef MAJOR_IN_SYSMACROS */
|
97
|
+
|
98
|
+
/* Define as 1 if makedev expects three arguments */
|
99
|
+
/* #undef MAKEDEV_THREE_ARGS */
|
100
|
+
|
101
|
+
/* Define if you want to use the basename function */
|
102
|
+
#define NEED_BASENAME 1
|
103
|
+
|
104
|
+
/* Define if you want to use the dirname function */
|
105
|
+
#define NEED_DIRNAME 1
|
106
|
+
|
107
|
+
/* Define if you want to use the fnmatch function */
|
108
|
+
#define NEED_FNMATCH 1
|
109
|
+
|
110
|
+
/* Define if you want to use the glob function */
|
111
|
+
#define NEED_GLOB 1
|
112
|
+
|
113
|
+
/* Define if you want to use the makedev function */
|
114
|
+
#define NEED_MAKEDEV 1
|
115
|
+
|
116
|
+
/* Define if you want to use the snprintf function */
|
117
|
+
/* #undef NEED_SNPRINTF */
|
118
|
+
|
119
|
+
/* Define if you want to use the strdup function */
|
120
|
+
/* #undef NEED_STRDUP */
|
121
|
+
|
122
|
+
/* Define if you want to use the strlcpy function */
|
123
|
+
#define NEED_STRLCPY 1
|
124
|
+
|
125
|
+
/* Define if you want to use the strmode function */
|
126
|
+
#define NEED_STRMODE 1
|
127
|
+
|
128
|
+
/* Define if you want to use the strsep function */
|
129
|
+
#define NEED_STRSEP 1
|
130
|
+
|
131
|
+
/* Define to the address where bug reports for this package should be sent. */
|
132
|
+
#define PACKAGE_BUGREPORT ""
|
133
|
+
|
134
|
+
/* Define to the full name of this package. */
|
135
|
+
#define PACKAGE_NAME "libtar"
|
136
|
+
|
137
|
+
/* Define to the full name and version of this package. */
|
138
|
+
#define PACKAGE_STRING "libtar 1.2.11"
|
139
|
+
|
140
|
+
/* Define to the one symbol short name of this package. */
|
141
|
+
#define PACKAGE_TARNAME "libtar"
|
142
|
+
|
143
|
+
/* Define to the version of this package. */
|
144
|
+
#define PACKAGE_VERSION "1.2.11"
|
145
|
+
|
146
|
+
/* Define to 1 if you have the ANSI C header files. */
|
147
|
+
#define STDC_HEADERS 1
|
148
|
+
|
149
|
+
/* Define to 1 if on AIX 3.
|
150
|
+
System headers sometimes define this.
|
151
|
+
We just want to avoid a redefinition error message. */
|
152
|
+
/* #ifndef _ALL_SOURCE */
|
153
|
+
/* # undef _ALL_SOURCE */
|
154
|
+
/* #endif */
|
155
|
+
|
156
|
+
/* Define to empty if `const' does not conform to ANSI C. */
|
157
|
+
/* #undef const */
|
158
|
+
|
159
|
+
/* Define to `unsigned long' if not defined in system header files. */
|
160
|
+
/* #undef dev_t */
|
161
|
+
|
162
|
+
/* Define to `int' if <sys/types.h> doesn't define. */
|
163
|
+
/* #undef gid_t */
|
164
|
+
|
165
|
+
/* Define to `unsigned int' if not defined in system header files. */
|
166
|
+
/* #undef major_t */
|
167
|
+
|
168
|
+
/* Define to `unsigned int' if not defined in system header files. */
|
169
|
+
/* #undef minor_t */
|
170
|
+
|
171
|
+
/* Define to `int' if <sys/types.h> does not define. */
|
172
|
+
/* #undef mode_t */
|
173
|
+
|
174
|
+
/* Define to `unsigned short' if not defined in system header files. */
|
175
|
+
/* #undef nlink_t */
|
176
|
+
|
177
|
+
/* Define to `long' if <sys/types.h> does not define. */
|
178
|
+
/* #undef off_t */
|
179
|
+
|
180
|
+
/* Define to `unsigned' if <sys/types.h> does not define. */
|
181
|
+
/* #undef size_t */
|
182
|
+
|
183
|
+
/* Define to `unsigned long' if not defined in system header files. */
|
184
|
+
/* #undef socklen_t */
|
185
|
+
|
186
|
+
/* Define to `int' if <sys/types.h> doesn't define. */
|
187
|
+
/* #undef uid_t */
|
188
|
+
|
189
|
+
/* Define to `long long' if not defined in system header files. */
|
190
|
+
/* #undef uint64_t */
|
@@ -0,0 +1,115 @@
|
|
1
|
+
#include <windows.h>
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include <malloc.h>
|
4
|
+
#include <sys/types.h>
|
5
|
+
#include <sys/stat.h>
|
6
|
+
#include <errno.h>
|
7
|
+
#include "dirent.h"
|
8
|
+
|
9
|
+
#define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
|
10
|
+
|
11
|
+
DIR *opendir0(const char *name, int *errorp) {
|
12
|
+
char *path;
|
13
|
+
HANDLE h;
|
14
|
+
WIN32_FIND_DATAA *fd;
|
15
|
+
DIR *dir;
|
16
|
+
int namlen;
|
17
|
+
struct stat st;
|
18
|
+
|
19
|
+
if (name == NULL) {
|
20
|
+
return NULL;
|
21
|
+
}
|
22
|
+
|
23
|
+
if ((namlen = strlen(name)) == -1) {
|
24
|
+
return NULL;
|
25
|
+
}
|
26
|
+
|
27
|
+
if (stat(name, &st) == -1) {
|
28
|
+
return NULL;
|
29
|
+
}
|
30
|
+
|
31
|
+
if (!S_ISDIR(st.st_mode)) {
|
32
|
+
if (errorp) {
|
33
|
+
*errorp = ENOTDIR;
|
34
|
+
}
|
35
|
+
|
36
|
+
return NULL;
|
37
|
+
}
|
38
|
+
|
39
|
+
if (name[namlen -1] == '\\' || name[namlen -1] == '/') {
|
40
|
+
path = _alloca(namlen + 2);
|
41
|
+
strcpy_s(path, namlen + 2, name);
|
42
|
+
path[namlen] = '*';
|
43
|
+
path[namlen + 1] = '\0';
|
44
|
+
} else {
|
45
|
+
path = _alloca(namlen + 3);
|
46
|
+
strcpy_s(path, namlen + 3, name);
|
47
|
+
|
48
|
+
path[namlen] = (strchr(name, '/') != NULL) ? '/' : '\\';
|
49
|
+
path[namlen + 1] = '*';
|
50
|
+
path[namlen + 2] = '\0';
|
51
|
+
}
|
52
|
+
|
53
|
+
if ((fd = malloc(sizeof(WIN32_FIND_DATA))) == NULL) {
|
54
|
+
return NULL;
|
55
|
+
}
|
56
|
+
|
57
|
+
if ((h = FindFirstFileA(path, fd)) == INVALID_HANDLE_VALUE) {
|
58
|
+
free(fd);
|
59
|
+
return NULL;
|
60
|
+
}
|
61
|
+
|
62
|
+
if ((dir = malloc(sizeof(DIR))) == NULL) {
|
63
|
+
FindClose(h);
|
64
|
+
free(fd);
|
65
|
+
return NULL;
|
66
|
+
}
|
67
|
+
|
68
|
+
dir->h = h;
|
69
|
+
dir->fd = fd;
|
70
|
+
dir->has_next = TRUE;
|
71
|
+
|
72
|
+
return dir;
|
73
|
+
}
|
74
|
+
|
75
|
+
struct dirent *readdir(DIR *dir) {
|
76
|
+
char *cFileName;
|
77
|
+
char *d_name;
|
78
|
+
|
79
|
+
if (dir == NULL) {
|
80
|
+
return NULL;
|
81
|
+
}
|
82
|
+
|
83
|
+
if (dir->fd == NULL) {
|
84
|
+
return NULL;
|
85
|
+
}
|
86
|
+
|
87
|
+
if (!dir->has_next) {
|
88
|
+
return NULL;
|
89
|
+
}
|
90
|
+
|
91
|
+
cFileName = dir->fd->cFileName;
|
92
|
+
d_name = dir->entry.d_name;
|
93
|
+
strcpy_s(d_name, _MAX_PATH, cFileName);
|
94
|
+
dir->has_next = FindNextFileA(dir->h, dir->fd);
|
95
|
+
|
96
|
+
return &dir->entry;
|
97
|
+
}
|
98
|
+
|
99
|
+
int closedir(DIR *dir) {
|
100
|
+
if (dir == NULL) {
|
101
|
+
return -1;
|
102
|
+
}
|
103
|
+
|
104
|
+
if (dir->h && dir->h != INVALID_HANDLE_VALUE) {
|
105
|
+
FindClose(dir->h);
|
106
|
+
}
|
107
|
+
|
108
|
+
if (dir->fd) {
|
109
|
+
free(dir->fd);
|
110
|
+
}
|
111
|
+
|
112
|
+
free(dir);
|
113
|
+
|
114
|
+
return 0;
|
115
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#ifndef __DIRENT_H__
|
2
|
+
#define __DIRENT_H__
|
3
|
+
|
4
|
+
#include <windows.h>
|
5
|
+
#include <sys/types.h>
|
6
|
+
|
7
|
+
struct dirent {
|
8
|
+
ino_t d_ino;
|
9
|
+
char d_name[_MAX_PATH];
|
10
|
+
};
|
11
|
+
|
12
|
+
typedef struct {
|
13
|
+
HANDLE h;
|
14
|
+
WIN32_FIND_DATAA *fd;
|
15
|
+
BOOL has_next;
|
16
|
+
struct dirent entry;
|
17
|
+
} DIR;
|
18
|
+
|
19
|
+
DIR *opendir0(const char *name, int *errorp);
|
20
|
+
#define opendir(n) opendir0((n), NULL)
|
21
|
+
struct dirent *readdir(DIR *dir);
|
22
|
+
int closedir(DIR *dir);
|
23
|
+
|
24
|
+
#endif
|