Module: Archive
- Defined in:
- ext/libarchive.c
Defined Under Namespace
Classes: Entry, Error, Reader, Writer
Constant Summary collapse
- VERSION =
rb_str_new2(VERSION)
- COMPRESSION_NONE =
INT2NUM(ARCHIVE_COMPRESSION_NONE)
- COMPRESSION_GZIP =
INT2NUM(ARCHIVE_COMPRESSION_GZIP)
- COMPRESSION_BZIP2 =
INT2NUM(ARCHIVE_COMPRESSION_BZIP2)
- COMPRESSION_COMPRESS =
INT2NUM(ARCHIVE_COMPRESSION_COMPRESS)
- FORMAT_BASE_MASK =
rb_define_const(rb_mArchive, “COMPRESSION_PROGRAM”, INT2NUM(ARCHIVE_COMPRESSION_PROGRAM)); rb_define_const(rb_mArchive, “COMPRESSION_LZMA”, INT2NUM(ARCHIVE_COMPRESSION_LZMA));
INT2NUM(ARCHIVE_FORMAT_BASE_MASK)
- FORMAT_CPIO =
INT2NUM(ARCHIVE_FORMAT_CPIO)
- FORMAT_CPIO_POSIX =
INT2NUM(ARCHIVE_FORMAT_CPIO_POSIX)
- FORMAT_CPIO_BIN_LE =
INT2NUM(ARCHIVE_FORMAT_CPIO_BIN_LE)
- FORMAT_CPIO_BIN_BE =
INT2NUM(ARCHIVE_FORMAT_CPIO_BIN_BE)
- FORMAT_CPIO_SVR4_NOCRC =
INT2NUM(ARCHIVE_FORMAT_CPIO_SVR4_NOCRC)
- FORMAT_CPIO_SVR4_CRC =
INT2NUM(ARCHIVE_FORMAT_CPIO_SVR4_CRC)
- FORMAT_SHAR =
INT2NUM(ARCHIVE_FORMAT_SHAR)
- FORMAT_SHAR_BASE =
INT2NUM(ARCHIVE_FORMAT_SHAR_BASE)
- FORMAT_SHAR_DUMP =
INT2NUM(ARCHIVE_FORMAT_SHAR_DUMP)
- FORMAT_TAR =
INT2NUM(ARCHIVE_FORMAT_TAR)
- FORMAT_TAR_USTAR =
INT2NUM(ARCHIVE_FORMAT_TAR_USTAR)
- FORMAT_TAR_PAX_INTERCHANGE =
INT2NUM(ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE)
- FORMAT_TAR_PAX_RESTRICTED =
INT2NUM(ARCHIVE_FORMAT_TAR_PAX_RESTRICTED)
- FORMAT_TAR_GNUTAR =
INT2NUM(ARCHIVE_FORMAT_TAR_GNUTAR)
- FORMAT_ISO9660 =
INT2NUM(ARCHIVE_FORMAT_ISO9660)
- FORMAT_ISO9660_ROCKRIDGE =
INT2NUM(ARCHIVE_FORMAT_ISO9660_ROCKRIDGE)
- FORMAT_ZIP =
INT2NUM(ARCHIVE_FORMAT_ZIP)
- FORMAT_EMPTY =
INT2NUM(ARCHIVE_FORMAT_EMPTY)
- FORMAT_AR =
INT2NUM(ARCHIVE_FORMAT_AR)
- FORMAT_AR_GNU =
INT2NUM(ARCHIVE_FORMAT_AR_GNU)
- FORMAT_AR_BSD =
INT2NUM(ARCHIVE_FORMAT_AR_BSD)
- FORMAT_MTREE =
INT2NUM(ARCHIVE_FORMAT_MTREE)
- EXTRACT_OWNER =
INT2NUM(ARCHIVE_EXTRACT_OWNER)
- EXTRACT_PERM =
INT2NUM(ARCHIVE_EXTRACT_PERM)
- EXTRACT_TIME =
INT2NUM(ARCHIVE_EXTRACT_TIME)
- EXTRACT_NO_OVERWRITE =
INT2NUM(ARCHIVE_EXTRACT_NO_OVERWRITE)
- EXTRACT_UNLINK =
INT2NUM(ARCHIVE_EXTRACT_UNLINK)
- EXTRACT_ACL =
INT2NUM(ARCHIVE_EXTRACT_ACL)
- EXTRACT_FFLAGS =
INT2NUM(ARCHIVE_EXTRACT_FFLAGS)
- EXTRACT_XATTR =
INT2NUM(ARCHIVE_EXTRACT_XATTR)
- EXTRACT_SECURE_SYMLINKS =
INT2NUM(ARCHIVE_EXTRACT_SECURE_SYMLINKS)
- EXTRACT_SECURE_NODOTDOT =
INT2NUM(ARCHIVE_EXTRACT_SECURE_NODOTDOT)
- EXTRACT_NO_AUTODIR =
INT2NUM(ARCHIVE_EXTRACT_NO_AUTODIR)
- EXTRACT_NO_OVERWRITE_NEWER =
INT2NUM(ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER)
- EXTRACT_SPARSE =
INT2NUM(ARCHIVE_EXTRACT_SPARSE)
Class Method Summary collapse
- .read_open_filename(*args) ⇒ Object
- .read_open_memory(*args) ⇒ Object
- .version_number ⇒ Object
- .version_string ⇒ Object
- .write_open_filename(v_filename, v_compression, v_format) ⇒ Object
- .write_open_memory(v_memory, v_compression, v_format) ⇒ Object
Class Method Details
.read_open_filename(*args) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'ext/libarchive_reader.c', line 101
static VALUE rb_libarchive_reader_s_open_filename(int argc, VALUE *argv, VALUE self) {
VALUE v_filename, v_compression, v_format;
const char *filename = NULL;
int compression = -1, format = -1;
const char *cmd = NULL;
rb_scan_args(argc, argv, "12", &v_filename, &v_compression, &v_format);
Check_Type(v_filename, T_STRING);
filename = RSTRING_PTR(v_filename);
if (T_STRING == TYPE(v_compression)) {
compression = -1;
cmd = RSTRING_PTR(v_compression);
} else if (!NIL_P(v_compression)) {
compression = NUM2INT(v_compression);
}
if (!NIL_P(v_format)) {
format = NUM2INT(v_format);
}
return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_filename0, (void *) filename, compression, format, cmd);
}
|
.read_open_memory(*args) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'ext/libarchive_reader.c', line 130
static VALUE rb_libarchive_reader_s_open_memory(int argc, VALUE *argv, VALUE self) {
VALUE v_memory, v_compression, v_format;
int compression = -1, format = -1;
const char *cmd = NULL;
rb_scan_args(argc, argv, "12", &v_memory, &v_compression, &v_format);
Check_Type(v_memory, T_STRING);
if (T_STRING == TYPE(v_compression)) {
compression = -1;
cmd = RSTRING_PTR(v_compression);
} else if (!NIL_P(v_compression)) {
compression = NUM2INT(v_compression);
}
if (!NIL_P(v_format)) {
format = NUM2INT(v_format);
}
return rb_libarchive_reader_s_open0(rb_libarchive_reader_s_open_memory0, (void *) v_memory, compression, format, cmd);
}
|
.version_number ⇒ Object
7 8 9 10 11 12 13 |
# File 'ext/libarchive.c', line 7 VALUE (VALUE self) { #if ARCHIVE_VERSION >= 2005000 return INT2NUM(archive_version_number()); #else return INT2NUM(archive_version_stamp()); #endif } |
.version_string ⇒ Object
16 17 18 19 20 21 22 |
# File 'ext/libarchive.c', line 16 VALUE (VALUE self) { #if ARCHIVE_VERSION_NUMBER >= 2005000 return rb_str_new2(archive_version_string()); #else return rb_str_new2(archive_version()); #endif } |
.write_open_filename(v_filename, v_compression, v_format) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'ext/libarchive_writer.c', line 83
static VALUE rb_libarchive_writer_s_open_filename(VALUE self, VALUE v_filename, VALUE v_compression, VALUE v_format) {
const char *filename = NULL;
int compression, format;
const char *cmd = NULL;
Check_Type(v_filename, T_STRING);
if (RSTRING_LEN(v_filename) < 1) {
rb_raise(rb_eArchiveError, "Open writer failed: No such file or directory");
}
filename = RSTRING_PTR(v_filename);
if (T_STRING == TYPE(v_compression)) {
compression = -1;
cmd = RSTRING_PTR(v_compression);
} else {
compression = NUM2INT(v_compression);
}
format = NUM2INT(v_format);
return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_filename0, (void *) filename, compression, format, cmd);
}
|
.write_open_memory(v_memory, v_compression, v_format) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'ext/libarchive_writer.c', line 114
static VALUE rb_libarchive_writer_s_open_memory(VALUE self, VALUE v_memory, VALUE v_compression, VALUE v_format) {
int compression, format;
const char *cmd = NULL;
Check_Type(v_memory, T_STRING);
if (T_STRING == TYPE(v_compression)) {
compression = -1;
cmd = RSTRING_PTR(v_compression);
} else {
compression = NUM2INT(v_compression);
}
format = NUM2INT(v_format);
return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_memory0, (void *) v_memory, compression, format, cmd);
}
|