File mc-vfs-uncompress.diff of Package mc46

--- vfs/extfs/sfs.ini.orig	2020-07-11 11:39:41.282800393 +0300
+++ vfs/extfs/sfs.ini	2020-07-11 11:41:24.652803700 +0300
@@ -12,6 +12,8 @@
 ubz2/1	bzip2 -d < %1 > %3
 lzma/1	lzma < %1 > %3
 ulzma/1	lzma -d < %1 > %3
+zst/1	zstd < %1 > %3
+uzst/1	zstd -d < %1 > %3
 xz/1	xz < %1 > %3
 uxz/1	xz -d < %1 > %3
 tar/1	tar cf %3 %1
--- vfs/cpio.c.orig	2020-07-11 11:24:03.564770386 +0300
+++ vfs/cpio.c	2020-07-11 11:24:49.021771840 +0300
@@ -166,7 +166,7 @@
     mc_stat (name, &(super->u.arch.st));
     super->u.arch.type = CPIO_UNKNOWN;
 
-    type = get_compression_type (fd);
+    type = get_compression_type (fd, extension(name));
     if (type != COMPRESSION_NONE) {
 	char *s;
 
--- vfs/tar.c.orig	2020-07-11 11:18:34.775759864 +0300
+++ vfs/tar.c	2020-07-11 11:25:10.184772517 +0300
@@ -233,7 +233,7 @@
     archive->u.arch.type = TAR_UNKNOWN;
 
     /* Find out the method to handle this tar file */
-    type = get_compression_type (result);
+    type = get_compression_type (result, extension(name));
     mc_lseek (result, 0, SEEK_SET);
     if (type != COMPRESSION_NONE) {
 	char *s;
--- src/view.c.orig2	2020-07-11 11:25:56.063773986 +0300
+++ src/view.c	2020-07-11 11:26:27.918775005 +0300
@@ -1545,7 +1545,7 @@
 	    /* Must be one of those nice files that grow (/proc) */
 	    view_set_datasource_vfs_pipe (view, fd);
 	} else {
-	    type = get_compression_type (fd);
+	    type = get_compression_type (fd, extension(file));
 
 	    if (view->magic_mode && (type != COMPRESSION_NONE)) {
 		g_free (view->filename);
--- src/util.h.orig2	2020-07-11 11:20:55.533764369 +0300
+++ src/util.h	2020-07-11 11:29:36.335781034 +0300
@@ -189,12 +189,13 @@
 	COMPRESSION_BZIP,
 	COMPRESSION_BZIP2,
 	COMPRESSION_LZMA,
-	COMPRESSION_XZ
+	COMPRESSION_XZ,
+	COMPRESSION_ZST
 };
 
 /* Looks for ``magic'' bytes at the start of the VFS file to guess the
  * compression type. Side effect: modifies the file position. */
-enum compression_type get_compression_type (int fd);
+enum compression_type get_compression_type (int fd, char * fext);
 const char *decompress_extension (int type);
 
 /* Hook functions */
--- src/util.c.orig2	2020-07-11 11:48:25.606817171 +0300
+++ src/util.c	2020-07-11 11:38:36.000000000 +0300
@@ -1290,7 +1290,7 @@
 #endif /* !USE_VFS */
 
 enum compression_type
-get_compression_type (int fd)
+get_compression_type (int fd, char * fext)
 {
     unsigned char magic[16];
 
@@ -1298,6 +1298,15 @@
     if (mc_read (fd, (char *) magic, 4) != 4)
 	return COMPRESSION_NONE;
 
+    if (NULL != fext) {
+	if (!strcmp(fext, "zst")) return COMPRESSION_ZST;
+	else if (!strcmp(fext, "xz")) return COMPRESSION_XZ;
+	else if (!strcmp(fext, "gz")) return COMPRESSION_GZIP;
+	else if (!strcmp(fext, "bz2")) return COMPRESSION_BZIP2;
+	else if (!strcmp(fext, "bz")) return COMPRESSION_BZIP;
+	else if (!strcmp(fext, "lzma")) return COMPRESSION_LZMA;
+    }
+
     /* GZIP_MAGIC and OLD_GZIP_MAGIC */
     if (magic[0] == 037 && (magic[1] == 0213 || magic[1] == 0236)) {
 	return COMPRESSION_GZIP;
@@ -1373,6 +1382,7 @@
 	case COMPRESSION_BZIP2:  return "#ubz2";
 	case COMPRESSION_LZMA:  return "#ulzma";
 	case COMPRESSION_XZ:  return "#uxz";
+	case COMPRESSION_ZST:  return "#uzst";
 	}
 	/* Should never reach this place */
 	fprintf (stderr, "Fatal: decompress_extension called with an unknown argument\n");
openSUSE Build Service is sponsored by