lib-y:=
lib-$(CONFIG_AR) += ar.o
-lib-$(CONFIG_BUNZIP2) += bbunzip.o ### bunzip2.o
-lib-$(CONFIG_UNLZMA) += bbunzip.o ### unlzma.o
+lib-$(CONFIG_BUNZIP2) += bbunzip.o
+lib-$(CONFIG_UNLZMA) += bbunzip.o
lib-$(CONFIG_CPIO) += cpio.o
lib-$(CONFIG_DPKG) += dpkg.o
lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o
-lib-$(CONFIG_GUNZIP) += bbunzip.o ### gunzip.o
+lib-$(CONFIG_GUNZIP) += bbunzip.o
lib-$(CONFIG_GZIP) += gzip.o
lib-$(CONFIG_RPM2CPIO) += rpm2cpio.o
lib-$(CONFIG_RPM) += rpm.o
lib-$(CONFIG_TAR) += tar.o
-lib-$(CONFIG_UNCOMPRESS) += bbunzip.o ### uncompress.o
+lib-$(CONFIG_UNCOMPRESS) += bbunzip.o
lib-$(CONFIG_UNZIP) += unzip.o
return exitcode;
}
-#if ENABLE_BUNZIP2
-
static
-char* make_new_name_bunzip2(char *filename)
+char* make_new_name_generic(char *filename, const char *expected_ext)
{
char *extension = strrchr(filename, '.');
- if (!extension || strcmp(extension, ".bz2") != 0) {
+ if (!extension || strcmp(extension + 1, expected_ext) != 0) {
/* Mimic GNU gunzip - "real" bunzip2 tries to */
/* unpack file anyway, to file.out */
return NULL;
return filename;
}
+#if ENABLE_BUNZIP2
+
+static
+char* make_new_name_bunzip2(char *filename)
+{
+ return make_new_name_generic(filename, "bz2");
+}
+
static
USE_DESKTOP(long long) int unpack_bunzip2(void)
{
if (!extension)
return NULL;
- if (strcmp(extension, ".gz") == 0
+ extension++;
+ if (strcmp(extension, "tgz" + 1) == 0
#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
- || strcmp(extension, ".Z") == 0
+ || strcmp(extension, "Z") == 0
#endif
) {
- *extension = '\0';
- } else if(strcmp(extension, ".tgz") == 0) {
+ extension[-1] = '\0';
+ } else if(strcmp(extension, "tgz") == 0) {
filename = xstrdup(filename);
extension = strrchr(filename, '.');
extension[2] = 'a';
static
char* make_new_name_unlzma(char *filename)
{
- char *extension = strrchr(filename, '.');
- if (!extension || strcmp(extension, ".lzma") != 0)
- return NULL;
- *extension = '\0';
- return filename;
+ return make_new_name_generic(filename, "lzma");
}
static
static
char* make_new_name_uncompress(char *filename)
{
- char *extension = strrchr(filename, '.');
- if (!extension || strcmp(extension, ".Z") != 0)
- return NULL;
- *extension = '\0';
- return filename;
+ return make_new_name_generic(filename, "Z");
}
static