3
0

bbunzip.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Common code for gunzip-like applets
  4. *
  5. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  6. */
  7. #include "libbb.h"
  8. #include "bb_archive.h"
  9. /* lzop_main() uses bbunpack(), need this: */
  10. //kbuild:lib-$(CONFIG_LZOP) += bbunzip.o
  11. /* Note: must be kept in sync with archival/lzop.c */
  12. enum {
  13. OPT_STDOUT = 1 << 0,
  14. OPT_FORCE = 1 << 1,
  15. /* only some decompressors: */
  16. OPT_VERBOSE = 1 << 2,
  17. OPT_QUIET = 1 << 3,
  18. OPT_DECOMPRESS = 1 << 4,
  19. OPT_TEST = 1 << 5,
  20. SEAMLESS_MAGIC = (1 << 31) * SEAMLESS_COMPRESSION,
  21. };
  22. static
  23. int open_to_or_warn(int to_fd, const char *filename, int flags, int mode)
  24. {
  25. int fd = open3_or_warn(filename, flags, mode);
  26. if (fd < 0) {
  27. return 1;
  28. }
  29. xmove_fd(fd, to_fd);
  30. return 0;
  31. }
  32. char* FAST_FUNC append_ext(char *filename, const char *expected_ext)
  33. {
  34. return xasprintf("%s.%s", filename, expected_ext);
  35. }
  36. int FAST_FUNC bbunpack(char **argv,
  37. IF_DESKTOP(long long) int FAST_FUNC (*unpacker)(transformer_state_t *xstate),
  38. char* FAST_FUNC (*make_new_name)(char *filename, const char *expected_ext),
  39. const char *expected_ext
  40. )
  41. {
  42. struct stat stat_buf;
  43. IF_DESKTOP(long long) int status = 0;
  44. char *filename, *new_name;
  45. smallint exitcode = 0;
  46. transformer_state_t xstate;
  47. do {
  48. /* NB: new_name is *maybe* malloc'ed! */
  49. new_name = NULL;
  50. filename = *argv; /* can be NULL - 'streaming' bunzip2 */
  51. if (filename && LONE_DASH(filename))
  52. filename = NULL;
  53. /* Open src */
  54. if (filename) {
  55. if (!(option_mask32 & SEAMLESS_MAGIC)) {
  56. if (stat(filename, &stat_buf) != 0) {
  57. err_name:
  58. bb_simple_perror_msg(filename);
  59. err:
  60. exitcode = 1;
  61. goto free_name;
  62. }
  63. if (open_to_or_warn(STDIN_FILENO, filename, O_RDONLY, 0))
  64. goto err;
  65. } else {
  66. /* "clever zcat" with FILE */
  67. /* fail_if_not_compressed because zcat refuses uncompressed input */
  68. int fd = open_zipped(filename, /*fail_if_not_compressed:*/ 1);
  69. if (fd < 0)
  70. goto err_name;
  71. xmove_fd(fd, STDIN_FILENO);
  72. }
  73. } else
  74. if (option_mask32 & SEAMLESS_MAGIC) {
  75. /* "clever zcat" on stdin */
  76. if (setup_unzip_on_fd(STDIN_FILENO, /*fail_if_not_compressed*/ 1))
  77. goto err;
  78. }
  79. /* Special cases: test, stdout */
  80. if (option_mask32 & (OPT_STDOUT|OPT_TEST)) {
  81. if (option_mask32 & OPT_TEST)
  82. if (open_to_or_warn(STDOUT_FILENO, bb_dev_null, O_WRONLY, 0))
  83. xfunc_die();
  84. filename = NULL;
  85. }
  86. /* Open dst if we are going to unpack to file */
  87. if (filename) {
  88. new_name = make_new_name(filename, expected_ext);
  89. if (!new_name) {
  90. bb_error_msg("%s: unknown suffix - ignored", filename);
  91. goto err;
  92. }
  93. /* -f: overwrite existing output files */
  94. if (option_mask32 & OPT_FORCE) {
  95. unlink(new_name);
  96. }
  97. /* O_EXCL: "real" bunzip2 doesn't overwrite files */
  98. /* GNU gunzip does not bail out, but goes to next file */
  99. if (open_to_or_warn(STDOUT_FILENO, new_name, O_WRONLY | O_CREAT | O_EXCL,
  100. stat_buf.st_mode))
  101. goto err;
  102. }
  103. /* Check that the input is sane */
  104. if (!(option_mask32 & OPT_FORCE) && isatty(STDIN_FILENO)) {
  105. bb_error_msg_and_die("compressed data not read from terminal, "
  106. "use -f to force it");
  107. }
  108. if (!(option_mask32 & SEAMLESS_MAGIC)) {
  109. init_transformer_state(&xstate);
  110. xstate.signature_skipped = 0;
  111. /*xstate.src_fd = STDIN_FILENO; - already is */
  112. xstate.dst_fd = STDOUT_FILENO;
  113. status = unpacker(&xstate);
  114. if (status < 0)
  115. exitcode = 1;
  116. } else {
  117. if (bb_copyfd_eof(STDIN_FILENO, STDOUT_FILENO) < 0)
  118. /* Disk full, tty closed, etc. No point in continuing */
  119. xfunc_die();
  120. }
  121. if (!(option_mask32 & OPT_STDOUT))
  122. xclose(STDOUT_FILENO); /* with error check! */
  123. if (filename) {
  124. char *del = new_name;
  125. if (status >= 0) {
  126. unsigned new_name_len;
  127. /* TODO: restore other things? */
  128. if (xstate.mtime != 0) {
  129. struct timeval times[2];
  130. times[1].tv_sec = times[0].tv_sec = xstate.mtime;
  131. times[1].tv_usec = times[0].tv_usec = 0;
  132. /* Note: we closed it first.
  133. * On some systems calling utimes
  134. * then closing resets the mtime
  135. * back to current time. */
  136. utimes(new_name, times); /* ignoring errors */
  137. }
  138. if (ENABLE_DESKTOP)
  139. new_name_len = strlen(new_name);
  140. /* Restore source filename (unless tgz -> tar case) */
  141. if (new_name == filename) {
  142. new_name_len = strlen(filename);
  143. filename[new_name_len] = '.';
  144. }
  145. /* Extreme bloat for gunzip compat */
  146. /* Some users do want this info... */
  147. if (ENABLE_DESKTOP && (option_mask32 & OPT_VERBOSE)) {
  148. unsigned percent = status
  149. ? ((uoff_t)stat_buf.st_size * 100u / (unsigned long long)status)
  150. : 0;
  151. fprintf(stderr, "%s: %u%% - replaced with %.*s\n",
  152. filename,
  153. 100u - percent,
  154. new_name_len, new_name
  155. );
  156. }
  157. /* Delete _source_ file */
  158. del = filename;
  159. }
  160. xunlink(del);
  161. free_name:
  162. if (new_name != filename)
  163. free(new_name);
  164. }
  165. } while (*argv && *++argv);
  166. if (option_mask32 & OPT_STDOUT)
  167. xclose(STDOUT_FILENO); /* with error check! */
  168. return exitcode;
  169. }
  170. #if ENABLE_UNCOMPRESS || ENABLE_BUNZIP2 || ENABLE_UNLZMA || ENABLE_UNXZ
  171. static
  172. char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext)
  173. {
  174. char *extension = strrchr(filename, '.');
  175. if (!extension || strcmp(extension + 1, expected_ext) != 0) {
  176. /* Mimic GNU gunzip - "real" bunzip2 tries to */
  177. /* unpack file anyway, to file.out */
  178. return NULL;
  179. }
  180. *extension = '\0';
  181. return filename;
  182. }
  183. #endif
  184. /*
  185. * Uncompress applet for busybox (c) 2002 Glenn McGrath
  186. *
  187. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  188. */
  189. //usage:#define uncompress_trivial_usage
  190. //usage: "[-cf] [FILE]..."
  191. //usage:#define uncompress_full_usage "\n\n"
  192. //usage: "Decompress .Z file[s]\n"
  193. //usage: "\n -c Write to stdout"
  194. //usage: "\n -f Overwrite"
  195. //config:config UNCOMPRESS
  196. //config: bool "uncompress"
  197. //config: default n # ancient
  198. //config: help
  199. //config: uncompress is used to decompress archives created by compress.
  200. //config: Not much used anymore, replaced by gzip/gunzip.
  201. //applet:IF_UNCOMPRESS(APPLET(uncompress, BB_DIR_BIN, BB_SUID_DROP))
  202. //kbuild:lib-$(CONFIG_UNCOMPRESS) += bbunzip.o
  203. #if ENABLE_UNCOMPRESS
  204. int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  205. int uncompress_main(int argc UNUSED_PARAM, char **argv)
  206. {
  207. getopt32(argv, "cf");
  208. argv += optind;
  209. return bbunpack(argv, unpack_Z_stream, make_new_name_generic, "Z");
  210. }
  211. #endif
  212. /*
  213. * Gzip implementation for busybox
  214. *
  215. * Based on GNU gzip v1.2.4 Copyright (C) 1992-1993 Jean-loup Gailly.
  216. *
  217. * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
  218. * based on gzip sources
  219. *
  220. * Adjusted further by Erik Andersen <andersen@codepoet.org> to support files as
  221. * well as stdin/stdout, and to generally behave itself wrt command line
  222. * handling.
  223. *
  224. * General cleanup to better adhere to the style guide and make use of standard
  225. * busybox functions by Glenn McGrath
  226. *
  227. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  228. *
  229. * gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
  230. * Copyright (C) 1992-1993 Jean-loup Gailly
  231. * The unzip code was written and put in the public domain by Mark Adler.
  232. * Portions of the lzw code are derived from the public domain 'compress'
  233. * written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,
  234. * Ken Turkowski, Dave Mack and Peter Jannesen.
  235. */
  236. //usage:#define gunzip_trivial_usage
  237. //usage: "[-cft] [FILE]..."
  238. //usage:#define gunzip_full_usage "\n\n"
  239. //usage: "Decompress FILEs (or stdin)\n"
  240. //usage: "\n -c Write to stdout"
  241. //usage: "\n -f Force"
  242. //usage: "\n -t Test file integrity"
  243. //usage:
  244. //usage:#define gunzip_example_usage
  245. //usage: "$ ls -la /tmp/BusyBox*\n"
  246. //usage: "-rw-rw-r-- 1 andersen andersen 557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n"
  247. //usage: "$ gunzip /tmp/BusyBox-0.43.tar.gz\n"
  248. //usage: "$ ls -la /tmp/BusyBox*\n"
  249. //usage: "-rw-rw-r-- 1 andersen andersen 1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n"
  250. //usage:
  251. //usage:#define zcat_trivial_usage
  252. //usage: "[FILE]..."
  253. //usage:#define zcat_full_usage "\n\n"
  254. //usage: "Decompress to stdout"
  255. //config:config GUNZIP
  256. //config: bool "gunzip"
  257. //config: default y
  258. //config: help
  259. //config: gunzip is used to decompress archives created by gzip.
  260. //config: You can use the `-t' option to test the integrity of
  261. //config: an archive, without decompressing it.
  262. //config:
  263. //config:config FEATURE_GUNZIP_LONG_OPTIONS
  264. //config: bool "Enable long options"
  265. //config: default y
  266. //config: depends on GUNZIP && LONG_OPTS
  267. //config: help
  268. //config: Enable use of long options.
  269. //applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
  270. //applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat))
  271. //kbuild:lib-$(CONFIG_GZIP) += bbunzip.o
  272. //kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o
  273. #if ENABLE_GUNZIP
  274. static
  275. char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM)
  276. {
  277. char *extension = strrchr(filename, '.');
  278. if (!extension)
  279. return NULL;
  280. extension++;
  281. if (strcmp(extension, "tgz" + 1) == 0
  282. #if ENABLE_FEATURE_SEAMLESS_Z
  283. || (extension[0] == 'Z' && extension[1] == '\0')
  284. #endif
  285. ) {
  286. extension[-1] = '\0';
  287. } else if (strcmp(extension, "tgz") == 0) {
  288. filename = xstrdup(filename);
  289. extension = strrchr(filename, '.');
  290. extension[2] = 'a';
  291. extension[3] = 'r';
  292. } else {
  293. return NULL;
  294. }
  295. return filename;
  296. }
  297. #if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
  298. static const char gunzip_longopts[] ALIGN1 =
  299. "stdout\0" No_argument "c"
  300. "to-stdout\0" No_argument "c"
  301. "force\0" No_argument "f"
  302. "test\0" No_argument "t"
  303. "no-name\0" No_argument "n"
  304. ;
  305. #endif
  306. /*
  307. * Linux kernel build uses gzip -d -n. We accept and ignore it.
  308. * Man page says:
  309. * -n --no-name
  310. * gzip: do not save the original file name and time stamp.
  311. * (The original name is always saved if the name had to be truncated.)
  312. * gunzip: do not restore the original file name/time even if present
  313. * (remove only the gzip suffix from the compressed file name).
  314. * This option is the default when decompressing.
  315. * -N --name
  316. * gzip: always save the original file name and time stamp (this is the default)
  317. * gunzip: restore the original file name and time stamp if present.
  318. */
  319. int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  320. int gunzip_main(int argc UNUSED_PARAM, char **argv)
  321. {
  322. #if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
  323. applet_long_options = gunzip_longopts;
  324. #endif
  325. getopt32(argv, "cfvqdtn");
  326. argv += optind;
  327. /* If called as zcat...
  328. * Normally, "zcat" is just "gunzip -c".
  329. * But if seamless magic is enabled, then we are much more clever.
  330. */
  331. if (applet_name[1] == 'c')
  332. option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC;
  333. return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL);
  334. }
  335. #endif
  336. /*
  337. * Modified for busybox by Glenn McGrath
  338. * Added support output to stdout by Thomas Lundquist <thomasez@zelow.no>
  339. *
  340. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  341. */
  342. //usage:#define bunzip2_trivial_usage
  343. //usage: "[-cf] [FILE]..."
  344. //usage:#define bunzip2_full_usage "\n\n"
  345. //usage: "Decompress FILEs (or stdin)\n"
  346. //usage: "\n -c Write to stdout"
  347. //usage: "\n -f Force"
  348. //usage:#define bzcat_trivial_usage
  349. //usage: "[FILE]..."
  350. //usage:#define bzcat_full_usage "\n\n"
  351. //usage: "Decompress to stdout"
  352. //config:config BUNZIP2
  353. //config: bool "bunzip2"
  354. //config: default y
  355. //config: help
  356. //config: bunzip2 is a compression utility using the Burrows-Wheeler block
  357. //config: sorting text compression algorithm, and Huffman coding. Compression
  358. //config: is generally considerably better than that achieved by more
  359. //config: conventional LZ77/LZ78-based compressors, and approaches the
  360. //config: performance of the PPM family of statistical compressors.
  361. //config:
  362. //config: Unless you have a specific application which requires bunzip2, you
  363. //config: should probably say N here.
  364. //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
  365. //applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat))
  366. //kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o
  367. //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o
  368. #if ENABLE_BUNZIP2
  369. int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  370. int bunzip2_main(int argc UNUSED_PARAM, char **argv)
  371. {
  372. getopt32(argv, "cfvqdt");
  373. argv += optind;
  374. if (applet_name[2] == 'c') /* bzcat */
  375. option_mask32 |= OPT_STDOUT;
  376. return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2");
  377. }
  378. #endif
  379. /*
  380. * Small lzma deflate implementation.
  381. * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
  382. *
  383. * Based on bunzip.c from busybox
  384. *
  385. * Licensed under GPLv2, see file LICENSE in this source tree.
  386. */
  387. //usage:#define unlzma_trivial_usage
  388. //usage: "[-cf] [FILE]..."
  389. //usage:#define unlzma_full_usage "\n\n"
  390. //usage: "Decompress FILE (or stdin)\n"
  391. //usage: "\n -c Write to stdout"
  392. //usage: "\n -f Force"
  393. //usage:
  394. //usage:#define lzma_trivial_usage
  395. //usage: "-d [-cf] [FILE]..."
  396. //usage:#define lzma_full_usage "\n\n"
  397. //usage: "Decompress FILE (or stdin)\n"
  398. //usage: "\n -d Decompress"
  399. //usage: "\n -c Write to stdout"
  400. //usage: "\n -f Force"
  401. //usage:
  402. //usage:#define lzcat_trivial_usage
  403. //usage: "[FILE]..."
  404. //usage:#define lzcat_full_usage "\n\n"
  405. //usage: "Decompress to stdout"
  406. //usage:
  407. //usage:#define unxz_trivial_usage
  408. //usage: "[-cf] [FILE]..."
  409. //usage:#define unxz_full_usage "\n\n"
  410. //usage: "Decompress FILE (or stdin)\n"
  411. //usage: "\n -c Write to stdout"
  412. //usage: "\n -f Force"
  413. //usage:
  414. //usage:#define xz_trivial_usage
  415. //usage: "-d [-cf] [FILE]..."
  416. //usage:#define xz_full_usage "\n\n"
  417. //usage: "Decompress FILE (or stdin)\n"
  418. //usage: "\n -d Decompress"
  419. //usage: "\n -c Write to stdout"
  420. //usage: "\n -f Force"
  421. //usage:
  422. //usage:#define xzcat_trivial_usage
  423. //usage: "[FILE]..."
  424. //usage:#define xzcat_full_usage "\n\n"
  425. //usage: "Decompress to stdout"
  426. //config:config UNLZMA
  427. //config: bool "unlzma"
  428. //config: default y
  429. //config: help
  430. //config: unlzma is a compression utility using the Lempel-Ziv-Markov chain
  431. //config: compression algorithm, and range coding. Compression
  432. //config: is generally considerably better than that achieved by the bzip2
  433. //config: compressors.
  434. //config:
  435. //config: The BusyBox unlzma applet is limited to decompression only.
  436. //config: On an x86 system, this applet adds about 4K.
  437. //config:
  438. //config:config FEATURE_LZMA_FAST
  439. //config: bool "Optimize unlzma for speed"
  440. //config: default n
  441. //config: depends on UNLZMA
  442. //config: help
  443. //config: This option reduces decompression time by about 25% at the cost of
  444. //config: a 1K bigger binary.
  445. //config:
  446. //config:config LZMA
  447. //config: bool "Provide lzma alias which supports only unpacking"
  448. //config: default y
  449. //config: depends on UNLZMA
  450. //config: help
  451. //config: Enable this option if you want commands like "lzma -d" to work.
  452. //config: IOW: you'll get lzma applet, but it will always require -d option.
  453. //applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP))
  454. //applet:IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat))
  455. //applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma))
  456. //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o
  457. #if ENABLE_UNLZMA
  458. int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  459. int unlzma_main(int argc UNUSED_PARAM, char **argv)
  460. {
  461. IF_LZMA(int opts =) getopt32(argv, "cfvqdt");
  462. # if ENABLE_LZMA
  463. /* lzma without -d or -t? */
  464. if (applet_name[2] == 'm' && !(opts & (OPT_DECOMPRESS|OPT_TEST)))
  465. bb_show_usage();
  466. # endif
  467. /* lzcat? */
  468. if (applet_name[2] == 'c')
  469. option_mask32 |= OPT_STDOUT;
  470. argv += optind;
  471. return bbunpack(argv, unpack_lzma_stream, make_new_name_generic, "lzma");
  472. }
  473. #endif
  474. //config:config UNXZ
  475. //config: bool "unxz"
  476. //config: default y
  477. //config: help
  478. //config: unxz is a unlzma successor.
  479. //config:
  480. //config:config XZ
  481. //config: bool "Provide xz alias which supports only unpacking"
  482. //config: default y
  483. //config: depends on UNXZ
  484. //config: help
  485. //config: Enable this option if you want commands like "xz -d" to work.
  486. //config: IOW: you'll get xz applet, but it will always require -d option.
  487. //applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP))
  488. //applet:IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat))
  489. //applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz))
  490. //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o
  491. #if ENABLE_UNXZ
  492. int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  493. int unxz_main(int argc UNUSED_PARAM, char **argv)
  494. {
  495. IF_XZ(int opts =) getopt32(argv, "cfvqdt");
  496. # if ENABLE_XZ
  497. /* xz without -d or -t? */
  498. if (applet_name[2] == '\0' && !(opts & (OPT_DECOMPRESS|OPT_TEST)))
  499. bb_show_usage();
  500. # endif
  501. /* xzcat? */
  502. if (applet_name[2] == 'c')
  503. option_mask32 |= OPT_STDOUT;
  504. argv += optind;
  505. return bbunpack(argv, unpack_xz_stream, make_new_name_generic, "xz");
  506. }
  507. #endif