aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/bbunzip.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index b332eecd6..3735e3282 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -132,7 +132,10 @@ int FAST_FUNC bbunpack(char **argv,
132 132
133 if (filename) { 133 if (filename) {
134 char *del = new_name; 134 char *del = new_name;
135
135 if (status >= 0) { 136 if (status >= 0) {
137 unsigned new_name_len;
138
136 /* TODO: restore other things? */ 139 /* TODO: restore other things? */
137 if (aux.mtime != 0) { 140 if (aux.mtime != 0) {
138 struct timeval times[2]; 141 struct timeval times[2];
@@ -146,22 +149,29 @@ int FAST_FUNC bbunpack(char **argv,
146 utimes(new_name, times); /* ignoring errors */ 149 utimes(new_name, times); /* ignoring errors */
147 } 150 }
148 151
149 /* Delete _compressed_ file */ 152 if (ENABLE_DESKTOP)
153 new_name_len = strlen(new_name);
154 /* Restore source filename (unless tgz -> tar case) */
155 if (new_name == filename) {
156 new_name_len = strlen(filename);
157 filename[new_name_len] = '.';
158 }
159 /* Extreme bloat for gunzip compat */
160 /* Some users do want this info... */
161 if (ENABLE_DESKTOP && (option_mask32 & OPT_VERBOSE)) {
162 unsigned percent = status
163 ? ((uoff_t)stat_buf.st_size * 100u / (unsigned long long)status)
164 : 0;
165 fprintf(stderr, "%s: %u%% - replaced with %.*s\n",
166 filename,
167 100u - percent,
168 new_name_len, new_name
169 );
170 }
171 /* Delete _source_ file */
150 del = filename; 172 del = filename;
151 /* restore extension (unless tgz -> tar case) */
152 if (new_name == filename)
153 filename[strlen(filename)] = '.';
154 } 173 }
155 xunlink(del); 174 xunlink(del);
156
157#if 0 /* Currently buggy - wrong name: "a.gz: 261% - replaced with a.gz" */
158 /* Extreme bloat for gunzip compat */
159 if (ENABLE_DESKTOP && (option_mask32 & OPT_VERBOSE) && status >= 0) {
160 fprintf(stderr, "%s: %u%% - replaced with %s\n",
161 filename, (unsigned)(stat_buf.st_size*100 / (status+1)), new_name);
162 }
163#endif
164
165 free_name: 175 free_name:
166 if (new_name != filename) 176 if (new_name != filename)
167 free(new_name); 177 free(new_name);