--- xv-3.10a/xv.c.old Thu Oct 30 20:19:25 1997 +++ xv-3.10a/xv.c Fri Oct 31 16:56:52 1997 @@ -2082,6 +2082,10 @@ strcmp(basefname+strlen(basefname)-3,".gz")==0) basefname[strlen(basefname)-3]='\0'; #endif /* GUNZIP */ +#ifdef BUNZIP2 + if (strlen(basefname)>4 && strcmp(basefname+strlen(basefname)-4,".bz2")==0) + basefname[strlen(basefname)-4]='\0'; +#endif /* BUNZIP2 */ } @@ -2203,14 +2207,14 @@ } #endif /* HAVE_MGCSFX */ - if (filetype == RFT_COMPRESS) { /* a compressed file. uncompress it */ + if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) { /* a compressed file. uncompress it */ char tmpname[128]; if ( #ifndef VMS - UncompressFile(filename, tmpname) + UncompressFile(filename, tmpname, filetype) #else - UncompressFile(basefname, tmpname) + UncompressFile(basefname, tmpname, filetype) #endif ) { @@ -2865,6 +2869,9 @@ #ifdef GUNZIP else if (magicno[0]==0x1f && magicno[1]==0x8b) rv = RFT_COMPRESS; #endif +#ifdef BUNZIP2 + else if (magicno[0]==0x42 && magicno[1]==0x5a) rv = RFT_BZIP2; +#endif else if (magicno[0]==0x0a && magicno[1] <= 5) rv = RFT_PCX; @@ -3052,8 +3059,9 @@ /********************************/ -int UncompressFile(name, uncompname) +int UncompressFile(name, uncompname, filetype) char *name, *uncompname; + int filetype; { /* returns '1' on success, with name of uncompressed file in uncompname returns '0' on failure */ @@ -3092,7 +3100,12 @@ #ifndef VMS sprintf(uncompname, "%s/xvuXXXXXX", tmpdir); mktemp(uncompname); - sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname); + if (filetype == RFT_COMPRESS) + sprintf(buf,"%s -c %s >%s", UNCOMPRESS, fname, uncompname); +#ifdef BUNZIP2 + if (filetype == RFT_BZIP2) + sprintf(buf,"%s -c %s >%s", BUNZIP2, fname, uncompname); +#endif #else /* it IS VMS */ strcpy(uncompname, "[]xvuXXXXXX"); mktemp(uncompname); --- xv-3.10a/xv.h.old Thu Oct 30 20:19:25 1997 +++ xv-3.10a/xv.h Fri Oct 31 16:59:21 1997 @@ -592,6 +592,7 @@ #define RFT_PIC2 (JP_EXT_RFT + 5) #define RFT_PCD (JP_EXT_RFT + 6) #define RFT_MGCSFX (JP_EXT_RFT + 7) +#define RFT_BZIP2 (JP_EXT_RFT + 8) /* definitions for page up/down, arrow up/down list control */ #define LS_PAGEUP 0 @@ -1346,7 +1347,7 @@ /****************************** XV.C ****************************/ int ReadFileType PARM((char *)); int ReadPicFile PARM((char *, int, PICINFO *, int)); -int UncompressFile PARM((char *, char *)); +int UncompressFile PARM((char *, char *, int)); void KillPageFiles PARM((char *, int)); #ifdef MACBINARY int RemoveMacbinary PARM((char *, char *)); --- xv-3.10a/xvtext.c.old Thu Oct 30 20:19:30 1997 +++ xv-3.10a/xvtext.c Fri Oct 31 17:02:19 1997 @@ -385,7 +385,7 @@ { /* given a filename, attempts to read in the file and open a textview win */ - int i; + int i, filetype; long textlen; char *text, buf[512], title[128], rfname[MAXPATHLEN+1]; char *basefname[128]; /* just current fname, no path */ @@ -405,14 +405,15 @@ /* see if this file is compressed. if it is, uncompress it, and view the uncompressed version */ - if (ReadFileType(filename) == RFT_COMPRESS) { + filetype = ReadFileType(filename); + if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) { #ifndef VMS - if (!UncompressFile(filename, rfname)) return; /* failed to uncompress */ + if (!UncompressFile(filename, rfname, filetype)) return; /* failed to uncompress */ #else /* chop off trailing '.Z' from friendly displayed basefname, if any */ strcpy (basefname, filename); *rindex (basefname, '.') = '\0'; - if (!UncompressFile(basefname, rfname)) return;/* failed to uncompress */ + if (!UncompressFile(basefname, rfname, filetype)) return;/* failed to uncompress */ #endif } --- xv-3.10a/xvimage.c.old Sat Jan 14 09:11:36 1995 +++ xv-3.10a/xvimage.c Thu Oct 30 18:28:14 1997 @@ -2967,7 +2967,7 @@ ftype = ReadFileType(name); - if (ftype == RFT_COMPRESS) { /* handle compressed/gzipped files */ + if ((ftype == RFT_COMPRESS) || (ftype == RFT_BZIP2)) { /* handle compressed/gzipped files */ #ifdef VMS basefname[0] = '\0'; strcpy(basefname, name); /* remove trailing .Z */ @@ -2977,7 +2977,7 @@ uncName = name; #endif - if (UncompressFile(uncName, uncompname)) { + if (UncompressFile(uncName, uncompname, ftype)) { ftype = ReadFileType(uncompname); readname = uncompname; } --- xv-3.10a/xvbrowse.c.old Thu Oct 30 20:19:26 1997 +++ xv-3.10a/xvbrowse.c Thu Oct 30 18:36:43 1997 @@ -36,6 +36,7 @@ #include "bits/br_error" #include "bits/br_unknown" #include "bits/br_cmpres" +#include "bits/br_bzip2" #include "bits/br_gif" #include "bits/br_pm" @@ -103,7 +104,8 @@ #define BF_XWD 26 #define BF_FITS 27 #define BF_PNG 28 -#define JP_EXT_BF (BF_PNG) +#define BF_BZIP2 29 +#define JP_EXT_BF (BF_BZIP2) #define BF_MAG (JP_EXT_BF + 1) #define BF_MAKI (JP_EXT_BF + 2) #define BF_PIC (JP_EXT_BF + 3) @@ -545,6 +547,8 @@ bfIcons[BF_COMPRESS]= MakePix1(br->win, br_cmpres_bits, br_cmpres_width, br_cmpres_height); + bfIcons[BF_BZIP2]= MakePix1(br->win, br_bzip2_bits, + br_bzip2_width, br_bzip2_height); bfIcons[BF_PS] =MakePix1(br->win,br_ps_bits, br_ps_width, br_ps_height); bfIcons[BF_IFF] =MakePix1(br->win,br_iff_bits, br_iff_width, br_iff_height); @@ -3205,6 +3209,7 @@ case RFT_TIFF: bf->ftype = BF_TIFF; break; case RFT_PDSVICAR: bf->ftype = BF_PDS; break; case RFT_COMPRESS: bf->ftype = BF_COMPRESS; break; + case RFT_BZIP2: bf->ftype = BF_BZIP2; break; case RFT_PS: bf->ftype = BF_PS; break; case RFT_IFF: bf->ftype = BF_IFF; break; case RFT_TARGA: bf->ftype = BF_TARGA; break; @@ -3625,7 +3625,7 @@ filetype = ReadFileType(bf->name); - if (filetype == RFT_COMPRESS) { + if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) { #if (defined(VMS) && !defined(GUNZIP)) /* VMS decompress doesn't like the file to have a trailing .Z in fname however, GUnZip is OK with it, which we are calling UnCompress */ @@ -3636,7 +3636,7 @@ uncName = bf->name; #endif - if (UncompressFile(uncName, uncompname)) { + if (UncompressFile(uncName, uncompname, filetype)) { filetype = ReadFileType(uncompname); strcpy(readname, uncompname); } --- xv-3.10a/config.h.old Thu Oct 30 20:19:24 1997 +++ xv-3.10a/config.h Fri Oct 31 17:08:50 1997 @@ -80,6 +80,11 @@ # define UNCOMPRESS GUNZIP #endif +#define USE_BUNZIP2 + +#ifdef USE_BUNZIP2 +# define BUNZIP2 "/usr/local/bin/bunzip2" +#endif /*************************************************************************** * PostScript file input support: --- xv-3.10a/xvvd.c.orig Sun Apr 12 16:25:03 1998 +++ xv-3.10a/xvvd.c Sun Apr 12 17:15:14 1998 @@ -22,7 +22,7 @@ static void vd_optimize_path PARM((char *)); static int vd_ftype PARM((char *)); static int vd_compp PARM((char *, char *)); -static int vd_UncompressFile PARM((char *, char *)); +static int vd_UncompressFile PARM((char *, char *, int)); static int vd_tarc PARM((char *)); static u_int vd_tar_sumchk PARM((char *)); @@ -47,7 +47,6 @@ #define VD_ZOO 6 "zoo xOS %s", }; - int vdcount = 0; static char vdroot[MAXPATHLEN+1]; @@ -273,6 +272,13 @@ } strcpy(dir1, tmp); } + if (ftype == RFT_BZIP2) { + if (!(ftype = vd_compp(dir1, tmp))) { + SetCursors(-1); + return ftype; + } + strcpy(dir1, tmp); + } if (!stat(dir1, &st)) { for(i = 0; i < vdcount; i++) @@ -593,6 +599,10 @@ if (!(ftype = vd_compp(path, NULL))) return 0; + if (ftype == RFT_BZIP2) + if (!(ftype = vd_compp(path, NULL))) + return 0; + return ftype; } @@ -761,6 +771,10 @@ else if (magicno[0]==0x1f && magicno[1]==0x9e) rv = RFT_COMPRESS;/* old */ else if (magicno[0]==0x1f && magicno[1]==0x1e) rv = RFT_COMPRESS;/* pack */ #endif +#ifdef BUNZIP2 + else if (magicno[0]==0x42 && magicno[1]==0x5a) rv = RFT_BZIP2; +#endif + return rv; } @@ -791,10 +805,14 @@ #ifdef VMS if (UncompressFile(basename, uncompname)) { #else - if (newpath == NULL) - r = vd_UncompressFile(basename, uncompname); - else - r = UncompressFile(basename, uncompname); + if (newpath == NULL) { + file_type = ReadFileType(path); + r = vd_UncompressFile(basename, uncompname, file_type); + } + else { + file_type = ReadFileType(path); + r = UncompressFile(basename, uncompname, file_type); + } if (r) { #endif if ((file_type = vd_ftype(uncompname)) < 0) { @@ -816,8 +834,9 @@ static int stderr_off PARM((void)); static FILE *popen_nul PARM((char *, char *)); -static int vd_UncompressFile(name, uncompname) +static int vd_UncompressFile(name, uncompname, file_type) char *name, *uncompname; +int file_type; { /* Yap, I`m nearly same as original `UncompnameFile' function, but, 1) I extract `name' file ONLY first 512 byte. @@ -858,7 +877,12 @@ sprintf(uncompname, "%s/xvuXXXXXX", tmpdir); mktemp(uncompname); - sprintf(buf,"%s -c %s", UNCOMPRESS, fname); + if (file_type == RFT_COMPRESS) + sprintf(buf,"%s -c %s", UNCOMPRESS, fname); +#ifdef BUNZIP2 + if (file_type == RFT_BZIP2) + sprintf(buf,"%s -c %s", BUNZIP2, fname); +#endif SetISTR(ISTR_INFO, "Uncompressing Header '%s'...", BaseName(fname)); if ((pfp = popen_nul(buf, "r")) == NULL) { --- xv-3.10a/Makefile.orig Sun Apr 12 19:37:13 1998 +++ xv-3.10a/Makefile Sun Apr 12 19:37:39 1998 @@ -304,7 +304,7 @@ xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm -xvbrowse.o: bits/br_xwd bits/br_png +xvbrowse.o: bits/br_xwd bits/br_png bits/br_bzip2 xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body --- xv-3.10a/Makefile.std.orig Sun Apr 12 19:37:13 1998 +++ xv-3.10a/Makefile.std Sun Apr 12 19:37:39 1998 @@ -304,7 +304,7 @@ xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm -xvbrowse.o: bits/br_xwd bits/br_png +xvbrowse.o: bits/br_xwd bits/br_png bits/br_bzip2 xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body --- /dev/null Sun Apr 12 17:38:49 1998 +++ xv-3.10a/bits/br_bzip2 Sun Apr 12 19:23:39 1998 @@ -0,0 +1,27 @@ +#define br_bzip2_width 48 +#define br_bzip2_height 48 +static unsigned char br_bzip2_bits[] = { + 0xe0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x09, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x41, 0x00, 0x20, 0x00, 0x00, 0x00, 0x81, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x01, 0x01, 0x20, 0x00, 0x00, 0x00, 0xff, 0x03, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x7c, 0xbe, 0x3d, 0x0e, 0x02, 0x20, 0xfc, 0xbe, 0x7d, 0x1f, 0x02, + 0x20, 0xcc, 0xb0, 0x6d, 0x1b, 0x02, 0x20, 0xcc, 0x98, 0x6d, 0x1b, 0x02, + 0x20, 0xfc, 0x98, 0x6d, 0x18, 0x02, 0x20, 0x7c, 0x8c, 0x7d, 0x0c, 0x02, + 0x20, 0xcc, 0x8c, 0x3d, 0x0e, 0x02, 0x20, 0xcc, 0x84, 0x0d, 0x06, 0x02, + 0x20, 0xcc, 0x86, 0x0d, 0x03, 0x02, 0x20, 0xfc, 0xbe, 0x0d, 0x1f, 0x02, + 0x20, 0x7c, 0xbe, 0x0d, 0x1f, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x7f, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03};