diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/ar.c | 61 | ||||
-rw-r--r-- | archival/bbunzip.c | 10 | ||||
-rw-r--r-- | archival/bzip2.c | 2 | ||||
-rw-r--r-- | archival/cpio.c | 2 | ||||
-rw-r--r-- | archival/dpkg.c | 2 | ||||
-rw-r--r-- | archival/dpkg_deb.c | 2 | ||||
-rw-r--r-- | archival/libarchive/bz/blocksort.c | 2 | ||||
-rw-r--r-- | archival/libarchive/data_extract_all.c | 4 | ||||
-rw-r--r-- | archival/libarchive/data_extract_to_command.c | 2 | ||||
-rw-r--r-- | archival/libarchive/decompress_gunzip.c | 4 | ||||
-rw-r--r-- | archival/libarchive/get_header_ar.c | 2 | ||||
-rw-r--r-- | archival/libarchive/unpack_ar_archive.c | 2 | ||||
-rw-r--r-- | archival/rpm.c | 12 | ||||
-rw-r--r-- | archival/tar.c | 27 |
14 files changed, 74 insertions, 60 deletions
diff --git a/archival/ar.c b/archival/ar.c index 66930f0b8..eb734a685 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
@@ -48,19 +48,9 @@ | |||
48 | 48 | ||
49 | //kbuild:lib-$(CONFIG_AR) += ar.o | 49 | //kbuild:lib-$(CONFIG_AR) += ar.o |
50 | 50 | ||
51 | //usage:#define ar_trivial_usage | ||
52 | //usage: "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES" | ||
53 | //usage:#define ar_full_usage "\n\n" | ||
54 | //usage: "Extract or list FILES from an ar archive\n" | ||
55 | //usage: "\n -o Preserve original dates" | ||
56 | //usage: "\n -p Extract to stdout" | ||
57 | //usage: "\n -t List" | ||
58 | //usage: "\n -x Extract" | ||
59 | //usage: "\n -v Verbose" | ||
60 | |||
61 | #include "libbb.h" | 51 | #include "libbb.h" |
62 | #include "bb_archive.h" | 52 | #include "bb_archive.h" |
63 | #include "ar.h" | 53 | #include "ar_.h" |
64 | 54 | ||
65 | #if ENABLE_FEATURE_AR_CREATE | 55 | #if ENABLE_FEATURE_AR_CREATE |
66 | /* filter out entries with same names as specified on the command line */ | 56 | /* filter out entries with same names as specified on the command line */ |
@@ -236,23 +226,36 @@ static void FAST_FUNC header_verbose_list_ar(const file_header_t *file_header) | |||
236 | ); | 226 | ); |
237 | } | 227 | } |
238 | 228 | ||
239 | #define AR_OPT_VERBOSE (1 << 0) | 229 | //usage:#define ar_trivial_usage |
240 | #define AR_OPT_PRESERVE_DATE (1 << 1) | 230 | //usage: "x|p|t"IF_FEATURE_AR_CREATE("|r")" [-ov] ARCHIVE [FILE]..." |
241 | /* "ar r" implies create, but warns about it. c suppresses warning. | 231 | //usage:#define ar_full_usage "\n\n" |
242 | * bbox accepts but ignores it: */ | 232 | //usage: "Extract or list FILEs from an ar archive"IF_FEATURE_AR_CREATE(", or create it")"\n" |
243 | #define AR_OPT_CREATE (1 << 2) | 233 | //usage: "\n x Extract" |
244 | 234 | //usage: "\n p Extract to stdout" | |
245 | #define AR_CMD_PRINT (1 << 3) | 235 | //usage: "\n t List" |
246 | #define FIRST_CMD AR_CMD_PRINT | 236 | //usage: IF_FEATURE_AR_CREATE( |
247 | #define AR_CMD_LIST (1 << 4) | 237 | //usage: "\n r Create" |
248 | #define AR_CMD_EXTRACT (1 << 5) | 238 | //usage: ) |
249 | #define AR_CMD_INSERT (1 << 6) | 239 | //usage: "\n -o Restore mtime" |
240 | //usage: "\n -v Verbose" | ||
250 | 241 | ||
251 | int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 242 | int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
252 | int ar_main(int argc UNUSED_PARAM, char **argv) | 243 | int ar_main(int argc UNUSED_PARAM, char **argv) |
253 | { | 244 | { |
254 | archive_handle_t *archive_handle; | 245 | archive_handle_t *archive_handle; |
255 | unsigned opt, t; | 246 | unsigned opt, t; |
247 | enum { | ||
248 | OPT_VERBOSE = (1 << 0), | ||
249 | OPT_PRESERVE_DATE = (1 << 1), | ||
250 | /* "ar r" implies create, but warns about it. c suppresses warning. | ||
251 | * bbox accepts but ignores it: */ | ||
252 | OPT_CREATE = (1 << 2), | ||
253 | CMD_PRINT = (1 << 3), | ||
254 | FIRST_CMD = CMD_PRINT, | ||
255 | CMD_LIST = (1 << 4), | ||
256 | CMD_EXTRACT = (1 << 5), | ||
257 | CMD_INSERT = ((1 << 6) * ENABLE_FEATURE_AR_CREATE), | ||
258 | }; | ||
256 | 259 | ||
257 | archive_handle = init_handle(); | 260 | archive_handle = init_handle(); |
258 | 261 | ||
@@ -272,26 +275,26 @@ int ar_main(int argc UNUSED_PARAM, char **argv) | |||
272 | if (t & (t-1)) /* more than one of p,t,x[,r] are specified */ | 275 | if (t & (t-1)) /* more than one of p,t,x[,r] are specified */ |
273 | bb_show_usage(); | 276 | bb_show_usage(); |
274 | 277 | ||
275 | if (opt & AR_CMD_PRINT) { | 278 | if (opt & CMD_PRINT) { |
276 | archive_handle->action_data = data_extract_to_stdout; | 279 | archive_handle->action_data = data_extract_to_stdout; |
277 | } | 280 | } |
278 | if (opt & AR_CMD_LIST) { | 281 | if (opt & CMD_LIST) { |
279 | archive_handle->action_header = header_list; | 282 | archive_handle->action_header = header_list; |
280 | } | 283 | } |
281 | if (opt & AR_CMD_EXTRACT) { | 284 | if (opt & CMD_EXTRACT) { |
282 | archive_handle->action_data = data_extract_all; | 285 | archive_handle->action_data = data_extract_all; |
283 | } | 286 | } |
284 | if (opt & AR_OPT_PRESERVE_DATE) { | 287 | if (opt & OPT_PRESERVE_DATE) { |
285 | archive_handle->ah_flags |= ARCHIVE_RESTORE_DATE; | 288 | archive_handle->ah_flags |= ARCHIVE_RESTORE_DATE; |
286 | } | 289 | } |
287 | if (opt & AR_OPT_VERBOSE) { | 290 | if (opt & OPT_VERBOSE) { |
288 | archive_handle->action_header = header_verbose_list_ar; | 291 | archive_handle->action_header = header_verbose_list_ar; |
289 | } | 292 | } |
290 | #if ENABLE_FEATURE_AR_CREATE | 293 | #if ENABLE_FEATURE_AR_CREATE |
291 | archive_handle->ar__name = *argv; | 294 | archive_handle->ar__name = *argv; |
292 | #endif | 295 | #endif |
293 | archive_handle->src_fd = xopen(*argv++, | 296 | archive_handle->src_fd = xopen(*argv++, |
294 | (opt & AR_CMD_INSERT) | 297 | (opt & CMD_INSERT) |
295 | ? O_RDWR | O_CREAT | 298 | ? O_RDWR | O_CREAT |
296 | : O_RDONLY | 299 | : O_RDONLY |
297 | ); | 300 | ); |
@@ -303,7 +306,7 @@ int ar_main(int argc UNUSED_PARAM, char **argv) | |||
303 | } | 306 | } |
304 | 307 | ||
305 | #if ENABLE_FEATURE_AR_CREATE | 308 | #if ENABLE_FEATURE_AR_CREATE |
306 | if (opt & AR_CMD_INSERT) | 309 | if (opt & CMD_INSERT) |
307 | return write_ar_archive(archive_handle); | 310 | return write_ar_archive(archive_handle); |
308 | #endif | 311 | #endif |
309 | 312 | ||
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 320fe4fd1..2beb92763 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -221,7 +221,7 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) | |||
221 | //usage:#define uncompress_trivial_usage | 221 | //usage:#define uncompress_trivial_usage |
222 | //usage: "[-cf] [FILE]..." | 222 | //usage: "[-cf] [FILE]..." |
223 | //usage:#define uncompress_full_usage "\n\n" | 223 | //usage:#define uncompress_full_usage "\n\n" |
224 | //usage: "Decompress .Z file[s]\n" | 224 | //usage: "Decompress FILEs (or stdin)\n" |
225 | //usage: "\n -c Write to stdout" | 225 | //usage: "\n -c Write to stdout" |
226 | //usage: "\n -f Overwrite" | 226 | //usage: "\n -f Overwrite" |
227 | 227 | ||
@@ -463,7 +463,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) | |||
463 | //usage:#define unlzma_trivial_usage | 463 | //usage:#define unlzma_trivial_usage |
464 | //usage: "[-cfk] [FILE]..." | 464 | //usage: "[-cfk] [FILE]..." |
465 | //usage:#define unlzma_full_usage "\n\n" | 465 | //usage:#define unlzma_full_usage "\n\n" |
466 | //usage: "Decompress FILE (or stdin)\n" | 466 | //usage: "Decompress FILEs (or stdin)\n" |
467 | //usage: "\n -c Write to stdout" | 467 | //usage: "\n -c Write to stdout" |
468 | //usage: "\n -f Force" | 468 | //usage: "\n -f Force" |
469 | //usage: "\n -k Keep input files" | 469 | //usage: "\n -k Keep input files" |
@@ -471,7 +471,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) | |||
471 | //usage:#define lzma_trivial_usage | 471 | //usage:#define lzma_trivial_usage |
472 | //usage: "-d [-cfk] [FILE]..." | 472 | //usage: "-d [-cfk] [FILE]..." |
473 | //usage:#define lzma_full_usage "\n\n" | 473 | //usage:#define lzma_full_usage "\n\n" |
474 | //usage: "Decompress FILE (or stdin)\n" | 474 | //usage: "Decompress FILEs (or stdin)\n" |
475 | //usage: "\n -d Decompress" | 475 | //usage: "\n -d Decompress" |
476 | //usage: "\n -c Write to stdout" | 476 | //usage: "\n -c Write to stdout" |
477 | //usage: "\n -f Force" | 477 | //usage: "\n -f Force" |
@@ -534,7 +534,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
534 | //usage:#define unxz_trivial_usage | 534 | //usage:#define unxz_trivial_usage |
535 | //usage: "[-cfk] [FILE]..." | 535 | //usage: "[-cfk] [FILE]..." |
536 | //usage:#define unxz_full_usage "\n\n" | 536 | //usage:#define unxz_full_usage "\n\n" |
537 | //usage: "Decompress FILE (or stdin)\n" | 537 | //usage: "Decompress FILEs (or stdin)\n" |
538 | //usage: "\n -c Write to stdout" | 538 | //usage: "\n -c Write to stdout" |
539 | //usage: "\n -f Force" | 539 | //usage: "\n -f Force" |
540 | //usage: "\n -k Keep input files" | 540 | //usage: "\n -k Keep input files" |
@@ -543,7 +543,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
543 | //usage:#define xz_trivial_usage | 543 | //usage:#define xz_trivial_usage |
544 | //usage: "-d [-cfk] [FILE]..." | 544 | //usage: "-d [-cfk] [FILE]..." |
545 | //usage:#define xz_full_usage "\n\n" | 545 | //usage:#define xz_full_usage "\n\n" |
546 | //usage: "Decompress FILE (or stdin)\n" | 546 | //usage: "Decompress FILEs (or stdin)\n" |
547 | //usage: "\n -d Decompress" | 547 | //usage: "\n -d Decompress" |
548 | //usage: "\n -c Write to stdout" | 548 | //usage: "\n -c Write to stdout" |
549 | //usage: "\n -f Force" | 549 | //usage: "\n -f Force" |
diff --git a/archival/bzip2.c b/archival/bzip2.c index d0390a92a..ac5db0880 100644 --- a/archival/bzip2.c +++ b/archival/bzip2.c | |||
@@ -50,7 +50,7 @@ | |||
50 | //kbuild:lib-$(CONFIG_BZIP2) += bzip2.o | 50 | //kbuild:lib-$(CONFIG_BZIP2) += bzip2.o |
51 | 51 | ||
52 | //usage:#define bzip2_trivial_usage | 52 | //usage:#define bzip2_trivial_usage |
53 | //usage: "[OPTIONS] [FILE]..." | 53 | //usage: "[-cfk" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789] [FILE]..." |
54 | //usage:#define bzip2_full_usage "\n\n" | 54 | //usage:#define bzip2_full_usage "\n\n" |
55 | //usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" | 55 | //usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" |
56 | //usage: "\n -1..9 Compression level" | 56 | //usage: "\n -1..9 Compression level" |
diff --git a/archival/cpio.c b/archival/cpio.c index 94b4b8174..94303389e 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
@@ -68,7 +68,7 @@ | |||
68 | //usage: "\n -H newc Archive format" | 68 | //usage: "\n -H newc Archive format" |
69 | //usage: ) | 69 | //usage: ) |
70 | //usage: "\n -d Make leading directories" | 70 | //usage: "\n -d Make leading directories" |
71 | //usage: "\n -m Preserve mtime" | 71 | //usage: "\n -m Restore mtime" |
72 | //usage: "\n -v Verbose" | 72 | //usage: "\n -v Verbose" |
73 | //usage: "\n -u Overwrite" | 73 | //usage: "\n -u Overwrite" |
74 | //usage: "\n -F FILE Input (-t,-i,-p) or output (-o) file" | 74 | //usage: "\n -F FILE Input (-t,-i,-p) or output (-o) file" |
diff --git a/archival/dpkg.c b/archival/dpkg.c index 61631bd4d..8e1f9431d 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -1309,7 +1309,7 @@ postrm abort-install <old_version> | |||
1309 | postrm abort-upgrade <old_version> | 1309 | postrm abort-upgrade <old_version> |
1310 | postrm disappear <overwriter> <version> | 1310 | postrm disappear <overwriter> <version> |
1311 | */ | 1311 | */ |
1312 | static const char *const all_control_files[] = { | 1312 | static const char *const all_control_files[] ALIGN_PTR = { |
1313 | "preinst", "postinst", "prerm", "postrm", | 1313 | "preinst", "postinst", "prerm", "postrm", |
1314 | "list", "md5sums", "shlibs", "conffiles", | 1314 | "list", "md5sums", "shlibs", "conffiles", |
1315 | "config", "templates" | 1315 | "config", "templates" |
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index c2c4cbbcc..a5a80439d 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c | |||
@@ -28,7 +28,7 @@ | |||
28 | //usage: "\n -f Print control fields" | 28 | //usage: "\n -f Print control fields" |
29 | //usage: "\n -e Extract control files to DIR (default: ./DEBIAN)" | 29 | //usage: "\n -e Extract control files to DIR (default: ./DEBIAN)" |
30 | //usage: "\n -x Extract files to DIR (no default)" | 30 | //usage: "\n -x Extract files to DIR (no default)" |
31 | //usage: "\n -X Verbose -x" | 31 | //usage: "\n -X Verbose extract" |
32 | //usage: | 32 | //usage: |
33 | //usage:#define dpkg_deb_example_usage | 33 | //usage:#define dpkg_deb_example_usage |
34 | //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" | 34 | //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" |
diff --git a/archival/libarchive/bz/blocksort.c b/archival/libarchive/bz/blocksort.c index 92d6d8251..062fd0f54 100644 --- a/archival/libarchive/bz/blocksort.c +++ b/archival/libarchive/bz/blocksort.c | |||
@@ -459,7 +459,7 @@ int mainGtU(EState* state, | |||
459 | * usually small, typically <= 20. | 459 | * usually small, typically <= 20. |
460 | */ | 460 | */ |
461 | static | 461 | static |
462 | const uint32_t incs[14] = { | 462 | const uint32_t incs[14] ALIGN4 = { |
463 | 1, 4, 13, 40, 121, 364, 1093, 3280, | 463 | 1, 4, 13, 40, 121, 364, 1093, 3280, |
464 | 9841, 29524, 88573, 265720, | 464 | 9841, 29524, 88573, 265720, |
465 | 797161, 2391484 | 465 | 797161, 2391484 |
diff --git a/archival/libarchive/data_extract_all.c b/archival/libarchive/data_extract_all.c index 3142405a3..049c2c156 100644 --- a/archival/libarchive/data_extract_all.c +++ b/archival/libarchive/data_extract_all.c | |||
@@ -159,6 +159,10 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) | |||
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | case S_IFDIR: | 161 | case S_IFDIR: |
162 | //TODO: this causes problems if tarball contains a r-xr-xr-x directory: | ||
163 | // we create this directory, and then fail to create files inside it | ||
164 | // (if tar xf isn't run as root). | ||
165 | // GNU tar works around this by chmod-ing directories *after* all files are extracted. | ||
162 | res = mkdir(dst_name, file_header->mode); | 166 | res = mkdir(dst_name, file_header->mode); |
163 | if ((res != 0) | 167 | if ((res != 0) |
164 | && (errno != EISDIR) /* btw, Linux doesn't return this */ | 168 | && (errno != EISDIR) /* btw, Linux doesn't return this */ |
diff --git a/archival/libarchive/data_extract_to_command.c b/archival/libarchive/data_extract_to_command.c index 0fcabb4a9..f8b2ff8d2 100644 --- a/archival/libarchive/data_extract_to_command.c +++ b/archival/libarchive/data_extract_to_command.c | |||
@@ -20,7 +20,7 @@ enum { | |||
20 | TAR_MAX, | 20 | TAR_MAX, |
21 | }; | 21 | }; |
22 | 22 | ||
23 | static const char *const tar_var[] = { | 23 | static const char *const tar_var[] ALIGN_PTR = { |
24 | // "FILETYPE", | 24 | // "FILETYPE", |
25 | "MODE", | 25 | "MODE", |
26 | "FILENAME", | 26 | "FILENAME", |
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c index c0332d414..b2a3eb1c2 100644 --- a/archival/libarchive/decompress_gunzip.c +++ b/archival/libarchive/decompress_gunzip.c | |||
@@ -194,14 +194,14 @@ struct cp_ext { | |||
194 | }; | 194 | }; |
195 | /* Copy lengths and extra bits for literal codes 257..285 */ | 195 | /* Copy lengths and extra bits for literal codes 257..285 */ |
196 | /* note: see note #13 above about the 258 in this list. */ | 196 | /* note: see note #13 above about the 258 in this list. */ |
197 | static const struct cp_ext lit = { | 197 | static const struct cp_ext lit ALIGN2 = { |
198 | /*257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 */ | 198 | /*257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 */ |
199 | /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 */ | 199 | /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 */ |
200 | { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 }, | 200 | { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 }, |
201 | { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99 } /* 99 == invalid */ | 201 | { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99 } /* 99 == invalid */ |
202 | }; | 202 | }; |
203 | /* Copy offsets and extra bits for distance codes 0..29 */ | 203 | /* Copy offsets and extra bits for distance codes 0..29 */ |
204 | static const struct cp_ext dist = { | 204 | static const struct cp_ext dist ALIGN2 = { |
205 | /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 */ | 205 | /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 */ |
206 | { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }, | 206 | { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 }, |
207 | { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 } | 207 | { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 } |
diff --git a/archival/libarchive/get_header_ar.c b/archival/libarchive/get_header_ar.c index b6ecd596c..3a19d6ff7 100644 --- a/archival/libarchive/get_header_ar.c +++ b/archival/libarchive/get_header_ar.c | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | #include "libbb.h" | 7 | #include "libbb.h" |
8 | #include "bb_archive.h" | 8 | #include "bb_archive.h" |
9 | #include "ar.h" | 9 | #include "ar_.h" |
10 | 10 | ||
11 | /* WARNING: Clobbers str[len], so fields must be read in reverse order! */ | 11 | /* WARNING: Clobbers str[len], so fields must be read in reverse order! */ |
12 | static unsigned read_num(char *str, int base, int len) | 12 | static unsigned read_num(char *str, int base, int len) |
diff --git a/archival/libarchive/unpack_ar_archive.c b/archival/libarchive/unpack_ar_archive.c index 584c18ce8..125d424c9 100644 --- a/archival/libarchive/unpack_ar_archive.c +++ b/archival/libarchive/unpack_ar_archive.c | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | #include "libbb.h" | 5 | #include "libbb.h" |
6 | #include "bb_archive.h" | 6 | #include "bb_archive.h" |
7 | #include "ar.h" | 7 | #include "ar_.h" |
8 | 8 | ||
9 | void FAST_FUNC unpack_ar_archive(archive_handle_t *ar_archive) | 9 | void FAST_FUNC unpack_ar_archive(archive_handle_t *ar_archive) |
10 | { | 10 | { |
diff --git a/archival/rpm.c b/archival/rpm.c index 0d8f641b9..63d13d0e1 100644 --- a/archival/rpm.c +++ b/archival/rpm.c | |||
@@ -83,7 +83,9 @@ struct globals { | |||
83 | void *map; | 83 | void *map; |
84 | rpm_index *mytags; | 84 | rpm_index *mytags; |
85 | int tagcount; | 85 | int tagcount; |
86 | unsigned mapsize, pagesize; | 86 | unsigned mapsize; |
87 | IF_VARIABLE_ARCH_PAGESIZE(unsigned pagesize;) | ||
88 | #define G_pagesize cached_pagesize(G.pagesize) | ||
87 | } FIX_ALIASING; | 89 | } FIX_ALIASING; |
88 | #define G (*(struct globals*)bb_common_bufsiz1) | 90 | #define G (*(struct globals*)bb_common_bufsiz1) |
89 | #define INIT_G() do { setup_common_bufsiz(); } while (0) | 91 | #define INIT_G() do { setup_common_bufsiz(); } while (0) |
@@ -142,11 +144,11 @@ static int rpm_gettags(const char *filename) | |||
142 | 144 | ||
143 | #if !ENABLE_PLATFORM_MINGW32 | 145 | #if !ENABLE_PLATFORM_MINGW32 |
144 | /* Map the store */ | 146 | /* Map the store */ |
145 | storepos = (storepos + G.pagesize) & -(int)G.pagesize; | 147 | storepos = (storepos + G_pagesize) & -(int)G_pagesize; |
146 | /* remember size for munmap */ | 148 | /* remember size for munmap */ |
147 | G.mapsize = storepos; | 149 | G.mapsize = storepos; |
148 | /* some NOMMU systems prefer MAP_PRIVATE over MAP_SHARED */ | 150 | /* some NOMMU systems prefer MAP_PRIVATE over MAP_SHARED */ |
149 | G.map = mmap(0, storepos, PROT_READ, MAP_PRIVATE, fd, 0); | 151 | G.map = mmap_read(fd, storepos); |
150 | if (G.map == MAP_FAILED) | 152 | if (G.map == MAP_FAILED) |
151 | bb_perror_msg_and_die("mmap '%s'", filename); | 153 | bb_perror_msg_and_die("mmap '%s'", filename); |
152 | #else | 154 | #else |
@@ -368,7 +370,7 @@ int rpm_main(int argc, char **argv) | |||
368 | int opt, func = 0; | 370 | int opt, func = 0; |
369 | 371 | ||
370 | INIT_G(); | 372 | INIT_G(); |
371 | G.pagesize = getpagesize(); | 373 | INIT_PAGESIZE(G.pagesize); |
372 | 374 | ||
373 | while ((opt = getopt(argc, argv, "iqpldc")) != -1) { | 375 | while ((opt = getopt(argc, argv, "iqpldc")) != -1) { |
374 | switch (opt) { | 376 | switch (opt) { |
@@ -535,7 +537,7 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv) | |||
535 | int rpm_fd; | 537 | int rpm_fd; |
536 | 538 | ||
537 | INIT_G(); | 539 | INIT_G(); |
538 | G.pagesize = getpagesize(); | 540 | INIT_PAGESIZE(G.pagesize); |
539 | 541 | ||
540 | rpm_fd = rpm_gettags(argv[1]); | 542 | rpm_fd = rpm_gettags(argv[1]); |
541 | 543 | ||
diff --git a/archival/tar.c b/archival/tar.c index 1796d4c60..6c1591bdc 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -794,7 +794,7 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
794 | //usage: IF_FEATURE_TAR_NOPRESERVE_TIME("m") | 794 | //usage: IF_FEATURE_TAR_NOPRESERVE_TIME("m") |
795 | //usage: "vokO] " | 795 | //usage: "vokO] " |
796 | //usage: "[-f TARFILE] [-C DIR] " | 796 | //usage: "[-f TARFILE] [-C DIR] " |
797 | //usage: IF_FEATURE_TAR_FROM("[-T FILE] [-X FILE] "IF_FEATURE_TAR_LONG_OPTIONS("[--exclude PATTERN]... ")) | 797 | //usage: IF_FEATURE_TAR_FROM("[-T FILE] [-X FILE] "IF_FEATURE_TAR_LONG_OPTIONS("[OPTION]... ")) |
798 | //usage: "[FILE]..." | 798 | //usage: "[FILE]..." |
799 | //usage:#define tar_full_usage "\n\n" | 799 | //usage:#define tar_full_usage "\n\n" |
800 | //usage: IF_FEATURE_TAR_CREATE("Create, extract, ") | 800 | //usage: IF_FEATURE_TAR_CREATE("Create, extract, ") |
@@ -828,6 +828,11 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
828 | //usage: IF_FEATURE_SEAMLESS_BZ2( | 828 | //usage: IF_FEATURE_SEAMLESS_BZ2( |
829 | //usage: "\n -j (De)compress using bzip2" | 829 | //usage: "\n -j (De)compress using bzip2" |
830 | //usage: ) | 830 | //usage: ) |
831 | //usage: IF_FEATURE_SEAMLESS_LZMA( | ||
832 | //usage: IF_FEATURE_TAR_LONG_OPTIONS( | ||
833 | //usage: "\n --lzma (De)compress using lzma" | ||
834 | //usage: ) | ||
835 | //usage: ) | ||
831 | //usage: "\n -a (De)compress based on extension" | 836 | //usage: "\n -a (De)compress based on extension" |
832 | //usage: IF_FEATURE_TAR_CREATE( | 837 | //usage: IF_FEATURE_TAR_CREATE( |
833 | //usage: "\n -h Follow symlinks" | 838 | //usage: "\n -h Follow symlinks" |
@@ -839,21 +844,21 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
839 | //usage: "\n --exclude PATTERN Glob pattern to exclude" | 844 | //usage: "\n --exclude PATTERN Glob pattern to exclude" |
840 | //usage: ) | 845 | //usage: ) |
841 | //usage: ) | 846 | //usage: ) |
847 | //usage: IF_FEATURE_TAR_LONG_OPTIONS( | ||
848 | //usage: "\n --overwrite Replace existing files" | ||
849 | //usage: "\n --strip-components NUM NUM of leading components to strip" | ||
850 | //usage: "\n --no-recursion Don't descend in directories" | ||
851 | //usage: "\n --numeric-owner Use numeric user:group" | ||
852 | //usage: "\n --no-same-permissions Don't restore access permissions" | ||
853 | //usage: IF_FEATURE_TAR_TO_COMMAND( | ||
854 | //usage: "\n --to-command COMMAND Pipe files to COMMAND" | ||
855 | //usage: ) | ||
856 | //usage: ) | ||
842 | //usage: | 857 | //usage: |
843 | //usage:#define tar_example_usage | 858 | //usage:#define tar_example_usage |
844 | //usage: "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" | 859 | //usage: "$ zcat /tmp/tarball.tar.gz | tar -xf -\n" |
845 | //usage: "$ tar -cf /tmp/tarball.tar /usr/local\n" | 860 | //usage: "$ tar -cf /tmp/tarball.tar /usr/local\n" |
846 | 861 | ||
847 | // Supported but aren't in --help: | ||
848 | // lzma | ||
849 | // no-recursion | ||
850 | // numeric-owner | ||
851 | // no-same-permissions | ||
852 | // overwrite | ||
853 | //IF_FEATURE_TAR_TO_COMMAND( | ||
854 | // to-command | ||
855 | //) | ||
856 | |||
857 | enum { | 862 | enum { |
858 | OPTBIT_KEEP_OLD = 8, | 863 | OPTBIT_KEEP_OLD = 8, |
859 | IF_FEATURE_TAR_CREATE( OPTBIT_CREATE ,) | 864 | IF_FEATURE_TAR_CREATE( OPTBIT_CREATE ,) |