aboutsummaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-08-03 15:41:12 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-08-03 15:41:12 +0000
commit5e2a5391f9142bca773aab4c829615895b69a6b7 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /archival/unzip.c
parente883e03918a0e26e390ea23996abdb8fc1925f88 (diff)
downloadbusybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.tar.gz
busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.tar.bz2
busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.zip
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.) git-svn-id: svn://busybox.net/trunk/busybox@15767 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index 012f355e2..68083e987 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -24,13 +24,8 @@
24 * - central directory 24 * - central directory
25 */ 25 */
26 26
27#include <fcntl.h>
28#include <stdlib.h>
29#include <string.h>
30#include <unistd.h>
31#include <errno.h>
32#include "unarchive.h"
33#include "busybox.h" 27#include "busybox.h"
28#include "unarchive.h"
34 29
35#define ZIP_FILEHEADER_MAGIC SWAP_LE32(0x04034b50) 30#define ZIP_FILEHEADER_MAGIC SWAP_LE32(0x04034b50)
36#define ZIP_CDS_MAGIC SWAP_LE32(0x02014b50) 31#define ZIP_CDS_MAGIC SWAP_LE32(0x02014b50)
@@ -68,7 +63,7 @@ static void unzip_skip(int fd, off_t skip)
68static void unzip_create_leading_dirs(char *fn) 63static void unzip_create_leading_dirs(char *fn)
69{ 64{
70 /* Create all leading directories */ 65 /* Create all leading directories */
71 char *name = bb_xstrdup(fn); 66 char *name = xstrdup(fn);
72 if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) { 67 if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
73 bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */ 68 bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
74 } 69 }
@@ -143,7 +138,7 @@ int unzip_main(int argc, char **argv)
143 break; 138 break;
144 139
145 case 1 : /* The zip file */ 140 case 1 : /* The zip file */
146 src_fn = bb_xstrndup(optarg, strlen(optarg)+4); 141 src_fn = xstrndup(optarg, strlen(optarg)+4);
147 opt_range++; 142 opt_range++;
148 break; 143 break;
149 144
@@ -212,7 +207,7 @@ int unzip_main(int argc, char **argv)
212 207
213 /* Change dir if necessary */ 208 /* Change dir if necessary */
214 if (base_dir) 209 if (base_dir)
215 bb_xchdir(base_dir); 210 xchdir(base_dir);
216 211
217 if (verbosity != v_silent) 212 if (verbosity != v_silent)
218 printf("Archive: %s\n", src_fn); 213 printf("Archive: %s\n", src_fn);
@@ -338,7 +333,7 @@ int unzip_main(int argc, char **argv)
338 overwrite = o_always; 333 overwrite = o_always;
339 case 'y': /* Open file and fall into unzip */ 334 case 'y': /* Open file and fall into unzip */
340 unzip_create_leading_dirs(dst_fn); 335 unzip_create_leading_dirs(dst_fn);
341 dst_fd = bb_xopen(dst_fn, O_WRONLY | O_CREAT); 336 dst_fd = xopen(dst_fn, O_WRONLY | O_CREAT);
342 case -1: /* Unzip */ 337 case -1: /* Unzip */
343 if (verbosity == v_normal) { 338 if (verbosity == v_normal) {
344 printf(" inflating: %s\n", dst_fn); 339 printf(" inflating: %s\n", dst_fn);
@@ -366,7 +361,7 @@ int unzip_main(int argc, char **argv)
366 bb_perror_msg_and_die("Cannot read input"); 361 bb_perror_msg_and_die("Cannot read input");
367 } 362 }
368 free(dst_fn); 363 free(dst_fn);
369 dst_fn = bb_xstrdup(key_buf); 364 dst_fn = xstrdup(key_buf);
370 chomp(dst_fn); 365 chomp(dst_fn);
371 goto _check_file; 366 goto _check_file;
372 367