static int archive_compressor_program_open(struct archive_write_filter *f) { struct private_data *data = (struct private_data *)f->data; return __archive_write_program_open(f, data->pdata, data->cmd); }
static int archive_write_grzip_open(struct archive_write_filter *f) { struct write_grzip *data = (struct write_grzip *)f->data; return __archive_write_program_open(f, data->pdata, "grzip"); }
static int archive_write_lrzip_open(struct archive_write_filter *f) { struct write_lrzip *data = (struct write_lrzip *)f->data; struct archive_string as; int r; archive_string_init(&as); archive_strcpy(&as, "lrzip -q"); /* Specify compression type. */ switch (data->compression) { case lzma:/* default compression */ break; case bzip2: archive_strcat(&as, " -b"); break; case gzip: archive_strcat(&as, " -g"); break; case lzo: archive_strcat(&as, " -l"); break; case none: archive_strcat(&as, " -n"); break; case zpaq: archive_strcat(&as, " -z"); break; } /* Specify compression level. */ if (data->compression_level > 0) { archive_strcat(&as, " -L "); archive_strappend_char(&as, '0' + data->compression_level); } r = __archive_write_program_open(f, data->pdata, as.s); archive_string_free(&as); return (r); }
static int archive_compressor_bzip2_open(struct archive_write_filter *f) { struct private_data *data = (struct private_data *)f->data; struct archive_string as; int r; archive_string_init(&as); archive_strcpy(&as, "bzip2"); /* Specify compression level. */ if (data->compression_level > 0) { archive_strcat(&as, " -"); archive_strappend_char(&as, '0' + data->compression_level); } f->write = archive_compressor_bzip2_write; r = __archive_write_program_open(f, data->pdata, as.s); archive_string_free(&as); return (r); }