On Thu, Dec 01, 2016 at 11:54:09AM +0200, Alberto Garcia wrote:

> Fortunately it seems very easy to do, so I'm attaching the patch.

I pressed the 'send' button too fast. The previous patch was wrong,
here's the correct one.

Berto
From: Alberto Garcia <be...@igalia.com>
Subject: Add support for XZ-compressed files
Index: most-5.0.0a/src/file.c
===================================================================
--- most-5.0.0a.orig/src/file.c
+++ most-5.0.0a/src/file.c
@@ -120,6 +120,13 @@ static int open_compressed_file(char *fi
 	  {
 	     cmd = MOST_LZMA_POPEN_FORMAT;
 	  }
+	else if ((buf[0] == (char) 0xfd)
+	    && (buf[1] == '7') && (buf[2] == 'z')
+	    && (buf[3] == 'X') && (buf[4] == 'Z')
+	    && (buf[5] == (char) 0x00))
+	  {
+	     cmd = MOST_XZ_POPEN_FORMAT;
+	  }
 	
 	if (cmd != NULL)
 	  {
Index: most-5.0.0a/src/file.h
===================================================================
--- most-5.0.0a.orig/src/file.h
+++ most-5.0.0a/src/file.h
@@ -23,6 +23,7 @@
 #define MOST_GUNZIP_POPEN_FORMAT "gzip -dc \"%s\""
 #define MOST_BZIP2_POPEN_FORMAT "bzip2 -dc \"%s\""
 #define MOST_LZMA_POPEN_FORMAT "lzma -dc '%s'"
+#define MOST_XZ_POPEN_FORMAT "xz -dc \"%s\""
 
 extern void most_reread_file (void);
 extern void most_read_to_line (int);

Reply via email to