read.c (228763) | read.c (228776) |
---|---|
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include "bsdtar_platform.h" | 1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include "bsdtar_platform.h" |
27__FBSDID("$FreeBSD: head/contrib/libarchive/tar/read.c 228763 2011-12-21 11:13:29Z mm $"); | 27__FBSDID("$FreeBSD: head/contrib/libarchive/tar/read.c 228776 2011-12-21 15:30:49Z mm $"); |
28 29#ifdef HAVE_SYS_TYPES_H 30#include <sys/types.h> 31#endif 32#ifdef HAVE_SYS_PARAM_H 33#include <sys/param.h> 34#endif 35#ifdef HAVE_SYS_STAT_H --- 62 unchanged lines hidden (view full) --- 98static void 99progress_func(void *cookie) 100{ 101 struct progress_data *progress_data = cookie; 102 struct bsdtar *bsdtar = progress_data->bsdtar; 103 struct archive *a = progress_data->archive; 104 struct archive_entry *entry = progress_data->entry; 105 uint64_t comp, uncomp; | 28 29#ifdef HAVE_SYS_TYPES_H 30#include <sys/types.h> 31#endif 32#ifdef HAVE_SYS_PARAM_H 33#include <sys/param.h> 34#endif 35#ifdef HAVE_SYS_STAT_H --- 62 unchanged lines hidden (view full) --- 98static void 99progress_func(void *cookie) 100{ 101 struct progress_data *progress_data = cookie; 102 struct bsdtar *bsdtar = progress_data->bsdtar; 103 struct archive *a = progress_data->archive; 104 struct archive_entry *entry = progress_data->entry; 105 uint64_t comp, uncomp; |
106 int compression; |
|
106 107 if (!need_report()) 108 return; 109 110 if (bsdtar->verbose) 111 fprintf(stderr, "\n"); 112 if (a != NULL) { 113 comp = archive_position_compressed(a); 114 uncomp = archive_position_uncompressed(a); | 107 108 if (!need_report()) 109 return; 110 111 if (bsdtar->verbose) 112 fprintf(stderr, "\n"); 113 if (a != NULL) { 114 comp = archive_position_compressed(a); 115 uncomp = archive_position_uncompressed(a); |
116 if (comp > uncomp) 117 compression = 0; 118 else 119 compression = (int)((uncomp - comp) * 100 / uncomp); |
|
115 fprintf(stderr, 116 "In: %s bytes, compression %d%%;", | 120 fprintf(stderr, 121 "In: %s bytes, compression %d%%;", |
117 tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp)); | 122 tar_i64toa(comp), compression); |
118 fprintf(stderr, " Out: %d files, %s bytes\n", 119 archive_file_count(a), tar_i64toa(uncomp)); 120 } 121 if (entry != NULL) { 122 safe_fprintf(stderr, "Current: %s", 123 archive_entry_pathname(entry)); 124 fprintf(stderr, " (%s bytes)\n", 125 tar_i64toa(archive_entry_size(entry))); --- 83 unchanged lines hidden (view full) --- 209 archive_entry_set_uname(entry, NULL); 210 } 211 if (bsdtar->gid >= 0) { 212 archive_entry_set_gid(entry, bsdtar->gid); 213 archive_entry_set_gname(entry, NULL); 214 } 215 if (bsdtar->uname) 216 archive_entry_set_uname(entry, bsdtar->uname); | 123 fprintf(stderr, " Out: %d files, %s bytes\n", 124 archive_file_count(a), tar_i64toa(uncomp)); 125 } 126 if (entry != NULL) { 127 safe_fprintf(stderr, "Current: %s", 128 archive_entry_pathname(entry)); 129 fprintf(stderr, " (%s bytes)\n", 130 tar_i64toa(archive_entry_size(entry))); --- 83 unchanged lines hidden (view full) --- 214 archive_entry_set_uname(entry, NULL); 215 } 216 if (bsdtar->gid >= 0) { 217 archive_entry_set_gid(entry, bsdtar->gid); 218 archive_entry_set_gname(entry, NULL); 219 } 220 if (bsdtar->uname) 221 archive_entry_set_uname(entry, bsdtar->uname); |
217 if (bsdtar->gname >= 0) | 222 if (bsdtar->gname) |
218 archive_entry_set_gname(entry, bsdtar->gname); 219 220 /* 221 * Exclude entries that are too old. 222 */ 223 st = archive_entry_stat(entry); 224 if (bsdtar->newer_ctime_sec > 0) { 225 if (st->st_ctime < bsdtar->newer_ctime_sec) --- 220 unchanged lines hidden --- | 223 archive_entry_set_gname(entry, bsdtar->gname); 224 225 /* 226 * Exclude entries that are too old. 227 */ 228 st = archive_entry_stat(entry); 229 if (bsdtar->newer_ctime_sec > 0) { 230 if (st->st_ctime < bsdtar->newer_ctime_sec) --- 220 unchanged lines hidden --- |