libarchive-ruby-fs 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec3a5f103bd985b220902f6c3ba10cd42b47324a
4
- data.tar.gz: 73ab5d60a2d788ed0be1a6619783a1995693a7ee
3
+ metadata.gz: 788f782744aff4f52934514361f24584aff674aa
4
+ data.tar.gz: a3b758b0f302be84f7bdaf61123a40449c8f5d90
5
5
  SHA512:
6
- metadata.gz: e324aa79ea7719499dc4b866f49a18a17a5462a15edfbd76e44ce6c9a1a8ae5892ae999d5709da4f3c29c148fae848ff2a63a9309ff5f8b2e2a4703010a0a950
7
- data.tar.gz: 7bd835c6d8f7d69e458392efd88d56575f15948643e554d24858082ae26b53bcd0575028e29c85c24dbd13cb72f69715a7c57886d1586b374a352717220a9cef
6
+ metadata.gz: 36354307c51c708533a20f91f8272350ed1237ef8d3cd2c1a98684c7485d9580e5bfeb6c34060ce07fd026a219b61c355c732c75812b6e438e725fd6328b2dbf
7
+ data.tar.gz: 6a848bb4f3bafd344206aab3cbfd6b6676ebd66444c87a4f34d8728fac0305b979745cfb603be5cc76cfb18c0c33985220ac5ad2a30169740fbf2b36202d8f68
@@ -1,31 +1,31 @@
1
- #include <errno.h>
2
- #include <archive.h>
3
-
4
- static struct {
5
- int code;
6
- int (*setter)(struct archive *);
7
- } codes[] = {
8
- { ARCHIVE_COMPRESSION_NONE, archive_read_support_compression_none },
9
- { ARCHIVE_COMPRESSION_GZIP, archive_read_support_compression_gzip },
10
- { ARCHIVE_COMPRESSION_BZIP2, archive_read_support_compression_bzip2 },
11
- { ARCHIVE_COMPRESSION_COMPRESS, archive_read_support_compression_compress },
12
- // XXX:
13
- /*
14
- { ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
15
- { ARCHIVE_COMPRESSION_LZMA, archive_read_support_compression_lzma },
16
- */
17
- { -1, NULL },
18
- };
19
-
20
- int archive_read_support_compression(struct archive *a, int code) {
21
- int i;
22
-
23
- for (i = 0; codes[i].code >= 0; i++) {
24
- if (codes[i].code == code) {
25
- return codes[i].setter(a);
26
- }
27
- }
28
-
29
- archive_set_error(a, EINVAL, "No such compression");
30
- return ARCHIVE_FATAL;
31
- }
1
+ #include <errno.h>
2
+ #include <archive.h>
3
+
4
+ static struct {
5
+ int code;
6
+ int (*setter)(struct archive *);
7
+ } codes[] = {
8
+ { ARCHIVE_COMPRESSION_NONE, archive_read_support_compression_none },
9
+ { ARCHIVE_COMPRESSION_GZIP, archive_read_support_compression_gzip },
10
+ { ARCHIVE_COMPRESSION_BZIP2, archive_read_support_compression_bzip2 },
11
+ { ARCHIVE_COMPRESSION_COMPRESS, archive_read_support_compression_compress },
12
+ // XXX:
13
+ /*
14
+ { ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
15
+ { ARCHIVE_COMPRESSION_LZMA, archive_read_support_compression_lzma },
16
+ */
17
+ { -1, NULL },
18
+ };
19
+
20
+ int archive_read_support_compression(struct archive *a, int code) {
21
+ int i;
22
+
23
+ for (i = 0; codes[i].code >= 0; i++) {
24
+ if (codes[i].code == code) {
25
+ return codes[i].setter(a);
26
+ }
27
+ }
28
+
29
+ archive_set_error(a, EINVAL, "No such compression");
30
+ return ARCHIVE_FATAL;
31
+ }
@@ -1,6 +1,6 @@
1
- #ifndef _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
2
- #define _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
3
-
4
- int archive_read_support_compression(struct archive *a, int code);
5
-
6
- #endif
1
+ #ifndef _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
2
+ #define _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
3
+
4
+ int archive_read_support_compression(struct archive *a, int code);
5
+
6
+ #endif
@@ -1,32 +1,32 @@
1
- #include <errno.h>
2
- #include <archive.h>
3
-
4
- static struct {
5
- int code;
6
- int (*setter)(struct archive *);
7
- } codes[] = {
8
- { ARCHIVE_FORMAT_CPIO, archive_read_support_format_cpio },
9
- { ARCHIVE_FORMAT_TAR, archive_read_support_format_tar },
10
- { ARCHIVE_FORMAT_TAR_GNUTAR, archive_read_support_format_gnutar },
11
- { ARCHIVE_FORMAT_ISO9660, archive_read_support_format_iso9660 },
12
- { ARCHIVE_FORMAT_ZIP, archive_read_support_format_zip },
13
- { ARCHIVE_FORMAT_EMPTY, archive_read_support_format_empty },
14
- { ARCHIVE_FORMAT_AR, archive_read_support_format_ar },
15
- #ifdef ARCHIVE_FORMAT_MTREE
16
- { ARCHIVE_FORMAT_MTREE, archive_read_support_format_mtree },
17
- #endif
18
- { -1, NULL },
19
- };
20
-
21
- int archive_read_support_format(struct archive *a, int code) {
22
- int i;
23
-
24
- for (i = 0; codes[i].code >= 0; i++) {
25
- if (codes[i].code == code) {
26
- return codes[i].setter(a);
27
- }
28
- }
29
-
30
- archive_set_error(a, EINVAL, "No such format");
31
- return ARCHIVE_FATAL;
32
- }
1
+ #include <errno.h>
2
+ #include <archive.h>
3
+
4
+ static struct {
5
+ int code;
6
+ int (*setter)(struct archive *);
7
+ } codes[] = {
8
+ { ARCHIVE_FORMAT_CPIO, archive_read_support_format_cpio },
9
+ { ARCHIVE_FORMAT_TAR, archive_read_support_format_tar },
10
+ { ARCHIVE_FORMAT_TAR_GNUTAR, archive_read_support_format_gnutar },
11
+ { ARCHIVE_FORMAT_ISO9660, archive_read_support_format_iso9660 },
12
+ { ARCHIVE_FORMAT_ZIP, archive_read_support_format_zip },
13
+ { ARCHIVE_FORMAT_EMPTY, archive_read_support_format_empty },
14
+ { ARCHIVE_FORMAT_AR, archive_read_support_format_ar },
15
+ #ifdef ARCHIVE_FORMAT_MTREE
16
+ { ARCHIVE_FORMAT_MTREE, archive_read_support_format_mtree },
17
+ #endif
18
+ { -1, NULL },
19
+ };
20
+
21
+ int archive_read_support_format(struct archive *a, int code) {
22
+ int i;
23
+
24
+ for (i = 0; codes[i].code >= 0; i++) {
25
+ if (codes[i].code == code) {
26
+ return codes[i].setter(a);
27
+ }
28
+ }
29
+
30
+ archive_set_error(a, EINVAL, "No such format");
31
+ return ARCHIVE_FATAL;
32
+ }
@@ -1,6 +1,6 @@
1
- #ifndef _ARCHIVE_READ_SUPPORT_FORMAT_H_
2
- #define _ARCHIVE_READ_SUPPORT_FORMAT_H_
3
-
4
- int archive_read_support_format(struct archive *a, int code);
5
-
6
- #endif
1
+ #ifndef _ARCHIVE_READ_SUPPORT_FORMAT_H_
2
+ #define _ARCHIVE_READ_SUPPORT_FORMAT_H_
3
+
4
+ int archive_read_support_format(struct archive *a, int code);
5
+
6
+ #endif
@@ -1,25 +1,25 @@
1
- #include <archive.h>
2
- #include <ruby.h>
3
-
4
- static int rb_str_write_open(struct archive *a, void *client_data) {
5
- if (archive_write_get_bytes_in_last_block(a) == -1) {
6
- archive_write_set_bytes_in_last_block(a, 1);
7
- }
8
-
9
- return ARCHIVE_OK;
10
- }
11
-
12
- static int rb_str_write_close(struct archive *a, void *client_data) {
13
- return ARCHIVE_OK;
14
- }
15
-
16
-
17
- static ssize_t rb_str_write(struct archive *a, void *client_data, const void *buff, size_t length) {
18
- VALUE str = (VALUE) client_data;
19
- rb_str_cat(str, buff, length);
20
- return length;
21
- }
22
-
23
- int archive_write_open_rb_str(struct archive *a, VALUE str) {
24
- return archive_write_open(a, (void *) str, rb_str_write_open, rb_str_write, rb_str_write_close);
25
- }
1
+ #include <archive.h>
2
+ #include <ruby.h>
3
+
4
+ static int rb_str_write_open(struct archive *a, void *client_data) {
5
+ if (archive_write_get_bytes_in_last_block(a) == -1) {
6
+ archive_write_set_bytes_in_last_block(a, 1);
7
+ }
8
+
9
+ return ARCHIVE_OK;
10
+ }
11
+
12
+ static int rb_str_write_close(struct archive *a, void *client_data) {
13
+ return ARCHIVE_OK;
14
+ }
15
+
16
+
17
+ static ssize_t rb_str_write(struct archive *a, void *client_data, const void *buff, size_t length) {
18
+ VALUE str = (VALUE) client_data;
19
+ rb_str_cat(str, buff, length);
20
+ return length;
21
+ }
22
+
23
+ int archive_write_open_rb_str(struct archive *a, VALUE str) {
24
+ return archive_write_open(a, (void *) str, rb_str_write_open, rb_str_write, rb_str_write_close);
25
+ }
@@ -1,6 +1,6 @@
1
- #ifndef _ARCHIVE_WRITE_OPEN_RB_STR_H_
2
- #define _ARCHIVE_WRITE_OPEN_RB_STR_H_
3
-
4
- int archive_write_open_rb_str(struct archive *a, VALUE str);
5
-
6
- #endif
1
+ #ifndef _ARCHIVE_WRITE_OPEN_RB_STR_H_
2
+ #define _ARCHIVE_WRITE_OPEN_RB_STR_H_
3
+
4
+ int archive_write_open_rb_str(struct archive *a, VALUE str);
5
+
6
+ #endif
@@ -1,32 +1,32 @@
1
- #include <errno.h>
2
- #include <archive.h>
3
-
4
- static struct {
5
- int code;
6
- int (*setter)(struct archive *);
7
- } codes[] = {
8
- { ARCHIVE_COMPRESSION_NONE, archive_write_set_compression_none },
9
- { ARCHIVE_COMPRESSION_GZIP, archive_write_set_compression_gzip },
10
- { ARCHIVE_COMPRESSION_BZIP2, archive_write_set_compression_bzip2 },
11
- #if ARCHIVE_VERSION_NUMBER >= 2005000
12
- { ARCHIVE_COMPRESSION_COMPRESS, archive_write_set_compression_compress },
13
- #endif
14
- // XXX:
15
- /*
16
- { ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
17
- */
18
- { -1, NULL },
19
- };
20
-
21
- int archive_write_set_compression(struct archive *a, int code) {
22
- int i;
23
-
24
- for (i = 0; codes[i].code >= 0; i++) {
25
- if (codes[i].code == code) {
26
- return codes[i].setter(a);
27
- }
28
- }
29
-
30
- archive_set_error(a, EINVAL, "No such compression");
31
- return ARCHIVE_FATAL;
32
- }
1
+ #include <errno.h>
2
+ #include <archive.h>
3
+
4
+ static struct {
5
+ int code;
6
+ int (*setter)(struct archive *);
7
+ } codes[] = {
8
+ { ARCHIVE_COMPRESSION_NONE, archive_write_set_compression_none },
9
+ { ARCHIVE_COMPRESSION_GZIP, archive_write_set_compression_gzip },
10
+ { ARCHIVE_COMPRESSION_BZIP2, archive_write_set_compression_bzip2 },
11
+ #if ARCHIVE_VERSION_NUMBER >= 2005000
12
+ { ARCHIVE_COMPRESSION_COMPRESS, archive_write_set_compression_compress },
13
+ #endif
14
+ // XXX:
15
+ /*
16
+ { ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
17
+ */
18
+ { -1, NULL },
19
+ };
20
+
21
+ int archive_write_set_compression(struct archive *a, int code) {
22
+ int i;
23
+
24
+ for (i = 0; codes[i].code >= 0; i++) {
25
+ if (codes[i].code == code) {
26
+ return codes[i].setter(a);
27
+ }
28
+ }
29
+
30
+ archive_set_error(a, EINVAL, "No such compression");
31
+ return ARCHIVE_FATAL;
32
+ }
@@ -1,6 +1,6 @@
1
- #ifndef _ARCHIVE_WRITE_SET_COMPRESSION_H_
2
- #define _ARCHIVE_WRITE_SET_COMPRESSION_H_
3
-
4
- int archive_write_set_compression(struct archive *a, int code);
5
-
6
- #endif
1
+ #ifndef _ARCHIVE_WRITE_SET_COMPRESSION_H_
2
+ #define _ARCHIVE_WRITE_SET_COMPRESSION_H_
3
+
4
+ int archive_write_set_compression(struct archive *a, int code);
5
+
6
+ #endif
@@ -1,20 +1,20 @@
1
- require 'mkmf'
2
-
3
- unless (libarchive_cfg = pkg_config('libarchive'))
4
- abort 'Failed to locate pkg-config file for libarchive.'
5
- end
6
-
7
- unless have_library('archive')
8
- abort 'Failed to test-link against libarchive.'
9
- end
10
-
11
- non_std_location = libarchive_cfg.detect { |flag| flag =~ /^-L/ }
12
- if non_std_location
13
- non_std_location.gsub!('-L', '')
14
- $LDFLAGS << " -Wl,-rpath,#{non_std_location}"
15
- message "embedding path to library into rblibarchive.so: #{non_std_location}\n"
16
- end
17
-
18
- with_cppflags("#{(libarchive_cfg.detect { |flag| flag =~ /^-I/ })}") do
19
- create_makefile('rblibarchive')
20
- end
1
+ require 'mkmf'
2
+
3
+ unless (libarchive_cfg = pkg_config('libarchive'))
4
+ abort 'Failed to locate pkg-config file for libarchive.'
5
+ end
6
+
7
+ unless have_library('archive')
8
+ abort 'Failed to test-link against libarchive.'
9
+ end
10
+
11
+ non_std_location = libarchive_cfg.detect { |flag| flag =~ /^-L/ }
12
+ if non_std_location
13
+ non_std_location.gsub!('-L', '')
14
+ $LDFLAGS << " -Wl,-rpath,#{non_std_location}"
15
+ message "embedding path to library into rblibarchive.so: #{non_std_location}\n"
16
+ end
17
+
18
+ with_cppflags("#{(libarchive_cfg.detect { |flag| flag =~ /^-I/ })}") do
19
+ create_makefile('rblibarchive')
20
+ end
@@ -1,92 +1,92 @@
1
- #include "libarchive_internal.h"
2
-
3
- VALUE rb_mArchive;
4
- VALUE rb_eArchiveError;
5
-
6
- /* */
7
- VALUE rb_libarchive_s_version_number(VALUE self) {
8
- #if ARCHIVE_VERSION >= 2005000
9
- return INT2NUM(archive_version_number());
10
- #else
11
- return INT2NUM(archive_version_stamp());
12
- #endif
13
- }
14
-
15
- /* */
16
- VALUE rb_libarchive_s_version_string(VALUE self) {
17
- #if ARCHIVE_VERSION_NUMBER >= 2005000
18
- return rb_str_new2(archive_version_string());
19
- #else
20
- return rb_str_new2(archive_version());
21
- #endif
22
- }
23
-
24
- void DLLEXPORT Init_rblibarchive() {
25
- rb_mArchive = rb_define_module("LibArchiveRubyFs");
26
-
27
- rb_define_const(rb_mArchive, "COMPRESSION_NONE", INT2NUM(ARCHIVE_COMPRESSION_NONE));
28
- #ifdef HAVE_ZLIB_H
29
- rb_define_const(rb_mArchive, "COMPRESSION_GZIP", INT2NUM(ARCHIVE_COMPRESSION_GZIP));
30
- #endif
31
- #ifdef HAVE_BZLIB_H
32
- rb_define_const(rb_mArchive, "COMPRESSION_BZIP2", INT2NUM(ARCHIVE_COMPRESSION_BZIP2));
33
- #endif
34
- rb_define_const(rb_mArchive, "COMPRESSION_COMPRESS", INT2NUM(ARCHIVE_COMPRESSION_COMPRESS));
35
- // XXX:
36
- /*
37
- rb_define_const(rb_mArchive, "COMPRESSION_PROGRAM", INT2NUM(ARCHIVE_COMPRESSION_PROGRAM));
38
- rb_define_const(rb_mArchive, "COMPRESSION_LZMA", INT2NUM(ARCHIVE_COMPRESSION_LZMA));
39
- */
40
-
41
- rb_define_const(rb_mArchive, "FORMAT_BASE_MASK", INT2NUM(ARCHIVE_FORMAT_BASE_MASK));
42
- rb_define_const(rb_mArchive, "FORMAT_CPIO", INT2NUM(ARCHIVE_FORMAT_CPIO));
43
- rb_define_const(rb_mArchive, "FORMAT_CPIO_POSIX", INT2NUM(ARCHIVE_FORMAT_CPIO_POSIX));
44
- rb_define_const(rb_mArchive, "FORMAT_CPIO_BIN_LE", INT2NUM(ARCHIVE_FORMAT_CPIO_BIN_LE));
45
- rb_define_const(rb_mArchive, "FORMAT_CPIO_BIN_BE", INT2NUM(ARCHIVE_FORMAT_CPIO_BIN_BE));
46
- rb_define_const(rb_mArchive, "FORMAT_CPIO_SVR4_NOCRC", INT2NUM(ARCHIVE_FORMAT_CPIO_SVR4_NOCRC));
47
- rb_define_const(rb_mArchive, "FORMAT_CPIO_SVR4_CRC", INT2NUM(ARCHIVE_FORMAT_CPIO_SVR4_CRC));
48
- rb_define_const(rb_mArchive, "FORMAT_SHAR", INT2NUM(ARCHIVE_FORMAT_SHAR));
49
- rb_define_const(rb_mArchive, "FORMAT_SHAR_BASE", INT2NUM(ARCHIVE_FORMAT_SHAR_BASE));
50
- rb_define_const(rb_mArchive, "FORMAT_SHAR_DUMP", INT2NUM(ARCHIVE_FORMAT_SHAR_DUMP));
51
- rb_define_const(rb_mArchive, "FORMAT_TAR", INT2NUM(ARCHIVE_FORMAT_TAR));
52
- rb_define_const(rb_mArchive, "FORMAT_TAR_USTAR", INT2NUM(ARCHIVE_FORMAT_TAR_USTAR));
53
- rb_define_const(rb_mArchive, "FORMAT_TAR_PAX_INTERCHANGE", INT2NUM(ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE));
54
- rb_define_const(rb_mArchive, "FORMAT_TAR_PAX_RESTRICTED", INT2NUM(ARCHIVE_FORMAT_TAR_PAX_RESTRICTED));
55
- rb_define_const(rb_mArchive, "FORMAT_TAR_GNUTAR", INT2NUM(ARCHIVE_FORMAT_TAR_GNUTAR));
56
- rb_define_const(rb_mArchive, "FORMAT_ISO9660", INT2NUM(ARCHIVE_FORMAT_ISO9660));
57
- rb_define_const(rb_mArchive, "FORMAT_ISO9660_ROCKRIDGE", INT2NUM(ARCHIVE_FORMAT_ISO9660_ROCKRIDGE));
58
- rb_define_const(rb_mArchive, "FORMAT_ZIP", INT2NUM(ARCHIVE_FORMAT_ZIP));
59
- rb_define_const(rb_mArchive, "FORMAT_EMPTY", INT2NUM(ARCHIVE_FORMAT_EMPTY));
60
- rb_define_const(rb_mArchive, "FORMAT_AR", INT2NUM(ARCHIVE_FORMAT_AR));
61
- rb_define_const(rb_mArchive, "FORMAT_AR_GNU", INT2NUM(ARCHIVE_FORMAT_AR_GNU));
62
- rb_define_const(rb_mArchive, "FORMAT_AR_BSD", INT2NUM(ARCHIVE_FORMAT_AR_BSD));
63
- #ifdef ARCHIVE_FORMAT_MTREE
64
- rb_define_const(rb_mArchive, "FORMAT_MTREE", INT2NUM(ARCHIVE_FORMAT_MTREE));
65
- #endif
66
-
67
- rb_define_const(rb_mArchive, "EXTRACT_OWNER", INT2NUM(ARCHIVE_EXTRACT_OWNER));
68
- rb_define_const(rb_mArchive, "EXTRACT_PERM", INT2NUM(ARCHIVE_EXTRACT_PERM));
69
- rb_define_const(rb_mArchive, "EXTRACT_TIME", INT2NUM(ARCHIVE_EXTRACT_TIME));
70
- rb_define_const(rb_mArchive, "EXTRACT_NO_OVERWRITE", INT2NUM(ARCHIVE_EXTRACT_NO_OVERWRITE));
71
- rb_define_const(rb_mArchive, "EXTRACT_UNLINK", INT2NUM(ARCHIVE_EXTRACT_UNLINK));
72
- rb_define_const(rb_mArchive, "EXTRACT_ACL", INT2NUM(ARCHIVE_EXTRACT_ACL));
73
- rb_define_const(rb_mArchive, "EXTRACT_FFLAGS", INT2NUM(ARCHIVE_EXTRACT_FFLAGS));
74
- rb_define_const(rb_mArchive, "EXTRACT_XATTR", INT2NUM(ARCHIVE_EXTRACT_XATTR));
75
- rb_define_const(rb_mArchive, "EXTRACT_SECURE_SYMLINKS", INT2NUM(ARCHIVE_EXTRACT_SECURE_SYMLINKS));
76
- rb_define_const(rb_mArchive, "EXTRACT_SECURE_NODOTDOT", INT2NUM(ARCHIVE_EXTRACT_SECURE_NODOTDOT));
77
- rb_define_const(rb_mArchive, "EXTRACT_NO_AUTODIR", INT2NUM(ARCHIVE_EXTRACT_NO_AUTODIR));
78
- rb_define_const(rb_mArchive, "EXTRACT_NO_OVERWRITE_NEWER", INT2NUM(ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER));
79
- #ifdef ARCHIVE_EXTRACT_SPARSE
80
- rb_define_const(rb_mArchive, "EXTRACT_SPARSE", INT2NUM(ARCHIVE_EXTRACT_SPARSE));
81
- #endif
82
-
83
- rb_define_module_function(rb_mArchive, "version_number", rb_libarchive_s_version_number, 0);
84
- rb_define_module_function(rb_mArchive, "version_string", rb_libarchive_s_version_string, 0);
85
-
86
- rb_eArchiveError = rb_define_class_under(rb_mArchive, "Error", rb_eStandardError);
87
-
88
- Init_libarchive_reader();
89
- Init_libarchive_writer();
90
- Init_libarchive_archive();
91
- Init_libarchive_entry();
92
- }
1
+ #include "libarchive_internal.h"
2
+
3
+ VALUE rb_mArchive;
4
+ VALUE rb_eArchiveError;
5
+
6
+ /* */
7
+ VALUE rb_libarchive_s_version_number(VALUE self) {
8
+ #if ARCHIVE_VERSION >= 2005000
9
+ return INT2NUM(archive_version_number());
10
+ #else
11
+ return INT2NUM(archive_version_stamp());
12
+ #endif
13
+ }
14
+
15
+ /* */
16
+ VALUE rb_libarchive_s_version_string(VALUE self) {
17
+ #if ARCHIVE_VERSION_NUMBER >= 2005000
18
+ return rb_str_new2(archive_version_string());
19
+ #else
20
+ return rb_str_new2(archive_version());
21
+ #endif
22
+ }
23
+
24
+ void DLLEXPORT Init_rblibarchive() {
25
+ rb_mArchive = rb_define_module("LibArchiveRubyFs");
26
+
27
+ rb_define_const(rb_mArchive, "COMPRESSION_NONE", INT2NUM(ARCHIVE_COMPRESSION_NONE));
28
+ #ifdef HAVE_ZLIB_H
29
+ rb_define_const(rb_mArchive, "COMPRESSION_GZIP", INT2NUM(ARCHIVE_COMPRESSION_GZIP));
30
+ #endif
31
+ #ifdef HAVE_BZLIB_H
32
+ rb_define_const(rb_mArchive, "COMPRESSION_BZIP2", INT2NUM(ARCHIVE_COMPRESSION_BZIP2));
33
+ #endif
34
+ rb_define_const(rb_mArchive, "COMPRESSION_COMPRESS", INT2NUM(ARCHIVE_COMPRESSION_COMPRESS));
35
+ // XXX:
36
+ /*
37
+ rb_define_const(rb_mArchive, "COMPRESSION_PROGRAM", INT2NUM(ARCHIVE_COMPRESSION_PROGRAM));
38
+ rb_define_const(rb_mArchive, "COMPRESSION_LZMA", INT2NUM(ARCHIVE_COMPRESSION_LZMA));
39
+ */
40
+
41
+ rb_define_const(rb_mArchive, "FORMAT_BASE_MASK", INT2NUM(ARCHIVE_FORMAT_BASE_MASK));
42
+ rb_define_const(rb_mArchive, "FORMAT_CPIO", INT2NUM(ARCHIVE_FORMAT_CPIO));
43
+ rb_define_const(rb_mArchive, "FORMAT_CPIO_POSIX", INT2NUM(ARCHIVE_FORMAT_CPIO_POSIX));
44
+ rb_define_const(rb_mArchive, "FORMAT_CPIO_BIN_LE", INT2NUM(ARCHIVE_FORMAT_CPIO_BIN_LE));
45
+ rb_define_const(rb_mArchive, "FORMAT_CPIO_BIN_BE", INT2NUM(ARCHIVE_FORMAT_CPIO_BIN_BE));
46
+ rb_define_const(rb_mArchive, "FORMAT_CPIO_SVR4_NOCRC", INT2NUM(ARCHIVE_FORMAT_CPIO_SVR4_NOCRC));
47
+ rb_define_const(rb_mArchive, "FORMAT_CPIO_SVR4_CRC", INT2NUM(ARCHIVE_FORMAT_CPIO_SVR4_CRC));
48
+ rb_define_const(rb_mArchive, "FORMAT_SHAR", INT2NUM(ARCHIVE_FORMAT_SHAR));
49
+ rb_define_const(rb_mArchive, "FORMAT_SHAR_BASE", INT2NUM(ARCHIVE_FORMAT_SHAR_BASE));
50
+ rb_define_const(rb_mArchive, "FORMAT_SHAR_DUMP", INT2NUM(ARCHIVE_FORMAT_SHAR_DUMP));
51
+ rb_define_const(rb_mArchive, "FORMAT_TAR", INT2NUM(ARCHIVE_FORMAT_TAR));
52
+ rb_define_const(rb_mArchive, "FORMAT_TAR_USTAR", INT2NUM(ARCHIVE_FORMAT_TAR_USTAR));
53
+ rb_define_const(rb_mArchive, "FORMAT_TAR_PAX_INTERCHANGE", INT2NUM(ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE));
54
+ rb_define_const(rb_mArchive, "FORMAT_TAR_PAX_RESTRICTED", INT2NUM(ARCHIVE_FORMAT_TAR_PAX_RESTRICTED));
55
+ rb_define_const(rb_mArchive, "FORMAT_TAR_GNUTAR", INT2NUM(ARCHIVE_FORMAT_TAR_GNUTAR));
56
+ rb_define_const(rb_mArchive, "FORMAT_ISO9660", INT2NUM(ARCHIVE_FORMAT_ISO9660));
57
+ rb_define_const(rb_mArchive, "FORMAT_ISO9660_ROCKRIDGE", INT2NUM(ARCHIVE_FORMAT_ISO9660_ROCKRIDGE));
58
+ rb_define_const(rb_mArchive, "FORMAT_ZIP", INT2NUM(ARCHIVE_FORMAT_ZIP));
59
+ rb_define_const(rb_mArchive, "FORMAT_EMPTY", INT2NUM(ARCHIVE_FORMAT_EMPTY));
60
+ rb_define_const(rb_mArchive, "FORMAT_AR", INT2NUM(ARCHIVE_FORMAT_AR));
61
+ rb_define_const(rb_mArchive, "FORMAT_AR_GNU", INT2NUM(ARCHIVE_FORMAT_AR_GNU));
62
+ rb_define_const(rb_mArchive, "FORMAT_AR_BSD", INT2NUM(ARCHIVE_FORMAT_AR_BSD));
63
+ #ifdef ARCHIVE_FORMAT_MTREE
64
+ rb_define_const(rb_mArchive, "FORMAT_MTREE", INT2NUM(ARCHIVE_FORMAT_MTREE));
65
+ #endif
66
+
67
+ rb_define_const(rb_mArchive, "EXTRACT_OWNER", INT2NUM(ARCHIVE_EXTRACT_OWNER));
68
+ rb_define_const(rb_mArchive, "EXTRACT_PERM", INT2NUM(ARCHIVE_EXTRACT_PERM));
69
+ rb_define_const(rb_mArchive, "EXTRACT_TIME", INT2NUM(ARCHIVE_EXTRACT_TIME));
70
+ rb_define_const(rb_mArchive, "EXTRACT_NO_OVERWRITE", INT2NUM(ARCHIVE_EXTRACT_NO_OVERWRITE));
71
+ rb_define_const(rb_mArchive, "EXTRACT_UNLINK", INT2NUM(ARCHIVE_EXTRACT_UNLINK));
72
+ rb_define_const(rb_mArchive, "EXTRACT_ACL", INT2NUM(ARCHIVE_EXTRACT_ACL));
73
+ rb_define_const(rb_mArchive, "EXTRACT_FFLAGS", INT2NUM(ARCHIVE_EXTRACT_FFLAGS));
74
+ rb_define_const(rb_mArchive, "EXTRACT_XATTR", INT2NUM(ARCHIVE_EXTRACT_XATTR));
75
+ rb_define_const(rb_mArchive, "EXTRACT_SECURE_SYMLINKS", INT2NUM(ARCHIVE_EXTRACT_SECURE_SYMLINKS));
76
+ rb_define_const(rb_mArchive, "EXTRACT_SECURE_NODOTDOT", INT2NUM(ARCHIVE_EXTRACT_SECURE_NODOTDOT));
77
+ rb_define_const(rb_mArchive, "EXTRACT_NO_AUTODIR", INT2NUM(ARCHIVE_EXTRACT_NO_AUTODIR));
78
+ rb_define_const(rb_mArchive, "EXTRACT_NO_OVERWRITE_NEWER", INT2NUM(ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER));
79
+ #ifdef ARCHIVE_EXTRACT_SPARSE
80
+ rb_define_const(rb_mArchive, "EXTRACT_SPARSE", INT2NUM(ARCHIVE_EXTRACT_SPARSE));
81
+ #endif
82
+
83
+ rb_define_module_function(rb_mArchive, "version_number", rb_libarchive_s_version_number, 0);
84
+ rb_define_module_function(rb_mArchive, "version_string", rb_libarchive_s_version_string, 0);
85
+
86
+ rb_eArchiveError = rb_define_class_under(rb_mArchive, "Error", rb_eStandardError);
87
+
88
+ Init_libarchive_reader();
89
+ Init_libarchive_writer();
90
+ Init_libarchive_archive();
91
+ Init_libarchive_entry();
92
+ }