int archive_read_support_compression_all(struct archive *a) { /* Bzip falls back to "bunzip2" command-line */ archive_read_support_compression_bzip2(a); /* The decompress code doesn't use an outside library. */ archive_read_support_compression_compress(a); /* Gzip decompress falls back to "gunzip" command-line. */ archive_read_support_compression_gzip(a); /* The LZMA file format has a very weak signature, so it * may not be feasible to keep this here, but we'll try. * This will come back out if there are problems. */ /* Lzma falls back to "unlzma" command-line program. */ archive_read_support_compression_lzma(a); /* Xz falls back to "unxz" command-line program. */ archive_read_support_compression_xz(a); /* The decode code doesn't use an outside library. */ archive_read_support_compression_uu(a); /* The decode code doesn't use an outside library. */ #ifndef __minix archive_read_support_compression_rpm(a); #endif /* Note: We always return ARCHIVE_OK here, even if some of the * above return ARCHIVE_WARN. The intent here is to enable * "as much as possible." Clients who need specific * compression should enable those individually so they can * verify the level of support. */ /* Clear any warning messages set by the above functions. */ archive_clear_error(a); return (ARCHIVE_OK); }
int archive_read_support_compression_all(struct archive *a) { #if HAVE_BZLIB_H archive_read_support_compression_bzip2(a); #endif /* The decompress code doesn't use an outside library. */ archive_read_support_compression_compress(a); #if HAVE_ZLIB_H archive_read_support_compression_gzip(a); #endif return (ARCHIVE_OK); }
static void extract(const char *filename, int do_extract, int flags) { struct archive *a; struct archive *ext; struct archive_entry *entry; int r; a = archive_read_new(); ext = archive_write_disk_new(); archive_write_disk_set_options(ext, flags); #ifndef NO_BZIP2_EXTRACT archive_read_support_compression_bzip2(a); #endif #ifndef NO_GZIP_EXTRACT archive_read_support_compression_gzip(a); #endif #ifndef NO_COMPRESS_EXTRACT archive_read_support_compression_compress(a); #endif #ifndef NO_TAR_EXTRACT archive_read_support_format_tar(a); #endif #ifndef NO_CPIO_EXTRACT archive_read_support_format_cpio(a); #endif #ifndef NO_LOOKUP archive_write_disk_set_standard_lookup(ext); #endif if (filename != NULL && strcmp(filename, "-") == 0) filename = NULL; if ((r = archive_read_open_file(a, filename, 10240))) { errmsg(archive_error_string(a)); errmsg("\n"); exit(r); } for (;;) { r = archive_read_next_header(a, &entry); if (r == ARCHIVE_EOF) break; if (r != ARCHIVE_OK) { errmsg(archive_error_string(a)); errmsg("\n"); exit(1); } if (verbose && do_extract) msg("x "); if (verbose || !do_extract) msg(archive_entry_pathname(entry)); if (do_extract) { r = archive_write_header(ext, entry); if (r != ARCHIVE_OK) errmsg(archive_error_string(a)); else copy_data(a, ext); } if (verbose || !do_extract) msg("\n"); } archive_read_close(a); archive_read_finish(a); exit(0); }