summaryrefslogtreecommitdiff
path: root/archival/unlzma.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-01 15:55:11 +0000
committerDenis Vlasenko2006-10-01 15:55:11 +0000
commit97a8dd3857aea9730382e2975a2ee2000fd23ebb (patch)
tree608f73898f3ed5f466dff68189625fa9328a15be /archival/unlzma.c
parentf8aa109a9f7c67b291f240fb3ed91da90f26359b (diff)
downloadbusybox-97a8dd3857aea9730382e2975a2ee2000fd23ebb.zip
busybox-97a8dd3857aea9730382e2975a2ee2000fd23ebb.tar.gz
g[un]zip: add support for -v (verbose).
Add CONFIG_DESKTOP, almost all bloat from this change is hidden under that.
Diffstat (limited to 'archival/unlzma.c')
-rw-r--r--archival/unlzma.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/archival/unlzma.c b/archival/unlzma.c
index fe542b6..b87a3fe 100644
--- a/archival/unlzma.c
+++ b/archival/unlzma.c
@@ -8,6 +8,8 @@
* Licensed under GPL v2, see file LICENSE in this tarball for details.
*/
+/* Why our g[un]zip/bunzip2 are so ugly compared to this beauty? */
+
#include "busybox.h"
#include "unarchive.h"
@@ -15,15 +17,16 @@
int unlzma_main(int argc, char **argv)
{
+ USE_DESKTOP(long long) int status;
char *filename;
unsigned long opt;
- int status, src_fd, dst_fd;
+ int src_fd, dst_fd;
opt = bb_getopt_ulflags(argc, argv, "c");
/* Set input filename and number */
filename = argv[optind];
- if ((filename) && (filename[0] != '-') && (filename[1] != '\0')) {
+ if (filename && (filename[0] != '-') && (filename[1] != '\0')) {
/* Open input file */
src_fd = xopen(filename, O_RDONLY);
} else {
@@ -50,13 +53,12 @@ int unlzma_main(int argc, char **argv)
dst_fd = STDOUT_FILENO;
status = unlzma(src_fd, dst_fd);
if (filename) {
- if (!status)
+ if (status >= 0) /* if success delete src, else delete dst */
filename[strlen(filename)] = '.';
if (unlink(filename) < 0) {
bb_error_msg_and_die("cannot remove %s", filename);
}
}
- return status;
+ return (status < 0);
}
-