delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/21/19:13:01

From: "Juan Manuel Guerrero, Student, FB05" <ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De>
Organization: Darmstadt University of Technology
To: djgpp AT delorie DOT com
Date: Thu, 21 Oct 1999 22:22:34 +0200
Subject: Re: bzip2-0.9.5d port for DJGPP
X-mailer: Pegasus Mail for Windows (v2.54DE)
Message-ID: <9323A241D99@HRZ1.hrz.tu-darmstadt.de>
Reply-To: djgpp AT delorie DOT com

sorry for delay.

1) The file extension issue.
Eli Zaretskii wrote:
>> At compression time:
>>   filename     -> filename.b
>>   filename.e   -> filename.eb
>>   filename.ex  -> filename.exb
>>   filename.ext -> filename.exb
>>   filename.tar -> filename.tbz
>
>I think it would be better to be compatible to previous ports of
>bzip2.  They did this during compression on non-LFN platforms:
>
>    filename.ext -> filename_ext.bz2
>
>(if filename_ext was more than 8 characters, some of filename letters
>would be lost).  Some ports of packages that invoke bzip2 rely on this
>behavior to detect bzip2-compressed files, so I think changing it
>might break something.
>
>> At decompression time:
>>   filename.b   -> filename
>>   filename.eb  -> filename.e
>>   filename.exb -> filename.ex
>>   filename.tbz -> filename.tar
>>   filename     -> filename.out
>
>Doesn't bzip2 record the original name in the compressed one, like
>gzip does?  If it does, then the original name should be restored.

First: I didn't know that there was another MSDOS port of bzip.
Second: I don't want to break the work of other people
so i have adopted the proposed naming rules.
At compression time:
  filename.ext -> file_ext.bz2
  filename.tar -> filename.tbz

At decompression time:
  file_ext.bz2 -> file.ext
  filename.tbz -> filename.tar
  filename     -> filename.out

For clarification:
bzip'ed files contains no header with original file information.
A bzip file starts with:
  BZh9....
This means:
  BZh: magic bytes
  9  : compression factor.
       9=max, 1=min.
  ...: data. Block start-, block end-, CRC-information
       and the comprssed data.
There is no way to restore the original filename and time stamp
inspecting a bziped file.


2) The makefile issue.
The only reason why i wrote the makefile the way i did is
because i didn't know it better.
This time i followed the suggestions of Eli Zaretskii and
reduced the changes to a minimum.


3) Corrections of my modifications of the source file.
Eli Zaretskii wrote:
>> + int _stklen = 524288; /* DPMI stack */
>
>v2.02 and later uses 512K stack by default, so why did you need this?

I didn't read the docs of v2.02.
Corrected.

>> !            if (HAS_EXTENSION (outName))
>> !            {
>> !              register IntNative extStart = (IntNative)(strchr (outName, '.') - outName);
>
>Unless I'm missing something, outName may include the leading
>directories, like in d:/foo/bar/filename.ext.  If so, then calling
>`strchr' might find a dot in one of the leading directories.  What
>happens with a file d:/foo.bar/baz/filename, for example?

This is a seriuos bug. It has been corrected.
I have used basename to get the file name. I know that it is not ANSI, not POSIX
but I hope this isn't a problem.

>> + #ifdef __DJGPP__
>> + #define HAVE_LFN_SUPPORT           (_USE_LFN)
>> + #define NO_LFN_SUPPORT             (!HAVE_LFN_SUPPORT)
>
>There's a more portable way of testing for LFN support: use the
>library function `pathconf', like this:
>
> #include <unistd.h>
>
> #define HAVE_LFN_SUPPORT(filename) (pathconf (filename, _PC_NAME_MAX) > 12)
>
>`pathconf' is a POSIX function, so this would get rid of all those
>ugly "#ifdef __DJGPP__" hacks.

Corrected.


4) bzip and tar.
>On Tue, 19 Oct 1999, Andris Pavenis wrote:
>
>> One more note. Perhaps it would be usefull to release patched version
>> of tar-1.12 (or 1.13) for DJGPP to support tar command line option
>> to support bzip2 compression in tar. However it seems not clear which
>> option to use. Latest tar snappshot I downloaded from alpha.gnu.org
>> (tar-1.13.13) uses option -I (equal to --use=bzip2). This option is
>> not in original sources of tar-1.12 and tar-1.13.
>
>GNU Tar has changed the maintainer, lately.  Unfortunately, the new
>maintainer started working on Tar 1.13 from v1.12 sources, where there's
>no DJGPP support.  The DJGPP support was incorporated into a couple of
>pretest versions by its previous maintainer, but he didn't release any 
>official version, and it will take a while before the new maintainer will 
>get to merging the DJGPP support into Tar.
>
>Unfortunately, this means that Tar 1.13 will not support DJGPP, and I 
>cannot afford to do all that hard work of re-porting Tar 1.13, which I 
>did for 1.12 (the sources are *very* different).
>
>When the current Tar maintainer gets to work on incorporating the DJGPP 
>support, I will help him do it.
>
>I might release the last pretest version I have on my disk that did 
>support DJGPP, if I have time.  But there's no bzip2 support there.


I have taken the sources of bzip2 from:

  <http://sourceware.cygnus.com/bzip2/>

or from a mirror.
At the above mentioned URL you will find patches for TAR 1.12 and TAR 1.13
for bzip support.


5) Patch.
I send the new patch once again for inspection.
If o.k., i will make bin- and source-packages and send them to
SimTel.NET.

Regards,
Guerrero, Juan Manuel


diff -aprNC5 bzip2-0.9.5d.orig/Makefile bzip2-0.9.5d.djgpp/Makefile
*** bzip2-0.9.5d.orig/Makefile	Sat Sep  4 22:09:06 1999
--- bzip2-0.9.5d.djgpp/Makefile	Thu Oct 21 21:21:22 1999
***************
*** 1,29 ****
  
  SHELL=/bin/sh
  CC=gcc
  CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce
  
  OBJS= blocksort.o  \
        huffman.o    \
        crctable.o   \
        randtable.o  \
        compress.o   \
        decompress.o \
        bzlib.o
  
! all: libbz2.a bzip2 bzip2recover test
  
  bzip2: libbz2.a bzip2.o
  	$(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2
  
  bzip2recover: bzip2recover.o
  	$(CC) $(CFLAGS) -o bzip2recover bzip2recover.o
  
  libbz2.a: $(OBJS)
  	rm -f libbz2.a
! 	ar cq libbz2.a $(OBJS)
  	@if ( test -f /usr/bin/ranlib -o -f /bin/ranlib -o \
  		-f /usr/ccs/bin/ranlib ) ; then \
  		echo ranlib libbz2.a ; \
  		ranlib libbz2.a ; \
  	fi
--- 1,35 ----
  
  SHELL=/bin/sh
  CC=gcc
  CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce
  
+ MAKEINFO=makeinfo
+ MAKEINFOFLAGS=--no-split
+ 
  OBJS= blocksort.o  \
        huffman.o    \
        crctable.o   \
        randtable.o  \
        compress.o   \
        decompress.o \
        bzlib.o
  
! all: bzip2.info libbz2.a bzip2 bzip2recover test
! 
! bzip2.info: manual.texi
! 	$(MAKEINFO) $(MAKEINFOFLAGS) $< -o $@
  
  bzip2: libbz2.a bzip2.o
  	$(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2
  
  bzip2recover: bzip2recover.o
  	$(CC) $(CFLAGS) -o bzip2recover bzip2recover.o
  
  libbz2.a: $(OBJS)
  	rm -f libbz2.a
! 	ar cqs libbz2.a $(OBJS)
  	@if ( test -f /usr/bin/ranlib -o -f /bin/ranlib -o \
  		-f /usr/ccs/bin/ranlib ) ; then \
  		echo ranlib libbz2.a ; \
  		ranlib libbz2.a ; \
  	fi
*************** test: bzip2
*** 42,56 ****
  	cmp sample1.tst sample1.ref
  	cmp sample2.tst sample2.ref
  	cmp sample3.tst sample3.ref
  	@cat words3
  
! PREFIX=/usr
  
  install: bzip2 bzip2recover
  	if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi
  	if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi
  	if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi
  	if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir $(PREFIX)/man/man1 ; fi
  	if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include ; fi
  	cp -f bzip2 $(PREFIX)/bin/bzip2
  	cp -f bzip2 $(PREFIX)/bin/bunzip2
--- 48,63 ----
  	cmp sample1.tst sample1.ref
  	cmp sample2.tst sample2.ref
  	cmp sample3.tst sample3.ref
  	@cat words3
  
! PREFIX=${DJDIR}
  
  install: bzip2 bzip2recover
  	if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi
  	if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi
+ 	if ( test ! -d $(PREFIX)/info ) ; then mkdir $(PREFIX)/info ; fi
  	if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi
  	if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir $(PREFIX)/man/man1 ; fi
  	if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include ; fi
  	cp -f bzip2 $(PREFIX)/bin/bzip2
  	cp -f bzip2 $(PREFIX)/bin/bunzip2
diff -aprNC5 bzip2-0.9.5d.orig/bzip2.c bzip2-0.9.5d.djgpp/bzip2.c
*** bzip2-0.9.5d.orig/bzip2.c	Sat Sep  4 21:53:34 1999
--- bzip2-0.9.5d.djgpp/bzip2.c	Thu Oct 21 21:21:22 1999
***************
*** 128,137 ****
--- 128,148 ----
  #define BZ_LCCWIN32 1
  #undef BZ_UNIX
  #define BZ_UNIX 0
  #endif
  
+ /*--
+   MS-DOS with DJGPP.
+ --*/
+ #define BZ_MSDOS     0
+ 
+ #ifdef __DJGPP__
+ #undef  BZ_MSDOS
+ #define BZ_MSDOS     1
+ #undef  BZ_UNIX
+ #define BZ_UNIX      1
+ #endif
  
  /*---------------------------------------------*/
  /*--
    Some stuff for all platforms.
  --*/
***************
*** 171,200 ****
        root=snocString((root), (name))
  
  #   define APPEND_FLAG(root, name) \
        root=snocString((root), (name))
  
  #   define SET_BINARY_MODE(fd) /**/
  
  #   ifdef __GNUC__
  #      define NORETURN __attribute__ ((noreturn))
  #   else
  #      define NORETURN /**/
  #   endif
- #   ifdef __DJGPP__
- #     include <io.h>
- #     include <fcntl.h>
- #     undef MY_LSTAT
- #     define MY_LSTAT stat
- #     undef SET_BINARY_MODE
- #     define SET_BINARY_MODE(fd)                        \
-         do {                                            \
-            int retVal = setmode ( fileno ( fd ),        \
-                                  O_BINARY );            \
-            ERROR_IF_MINUS_ONE ( retVal );               \
-         } while ( 0 )
- #   endif
  #endif
  
  
  
  #if BZ_LCCWIN32
--- 182,199 ----
        root=snocString((root), (name))
  
  #   define APPEND_FLAG(root, name) \
        root=snocString((root), (name))
  
+ #   define SET_TEXT_MODE(fd)   /**/
  #   define SET_BINARY_MODE(fd) /**/
  
  #   ifdef __GNUC__
  #      define NORETURN __attribute__ ((noreturn))
  #   else
  #      define NORETURN /**/
  #   endif
  #endif
  
  
  
  #if BZ_LCCWIN32
***************
*** 236,254 ****
--- 235,289 ----
  #   else
  #   define APPEND_FILESPEC(root, name)                \
        root = snocString ((root), (name))
  #   endif
  
+ #   define SET_TEXT_MODE(fd)   /**/
  #   define SET_BINARY_MODE(fd)                        \
        do {                                            \
           int retVal = setmode ( fileno ( fd ),        \
                                 O_BINARY );            \
           ERROR_IF_MINUS_ONE ( retVal );               \
        } while ( 0 )
  
  #endif
  
+ /*--
+   MSDOS and compiler specific functionality.
+ --*/
+ #if BZ_MSDOS
+ #  ifdef __DJGPP__
+ #    include <io.h>
+ #    include <fcntl.h>
+ #    define NO_LFN_SUPPORT(filename)    (pathconf (filename, _PC_NAME_MAX) <= 12)
+ #    define HAS_EXTENSION(filename)     (strchr ((filename), '.') != NULL)
+ #    define HAS_TAR_EXTENSION(filename) (strcmp (&(filename)[extStart], ".tar") == NULL)
+ #  endif
+ 
+ #  ifndef S_ISLNK
+ #    undef  MY_LSTAT
+ #    define MY_LSTAT    stat
+ #  endif
+ 
+ #  if (defined(O_TEXT) != 0)
+ #    undef  SET_TEXT_MODE
+ #    define SET_TEXT_MODE(fd)                         \
+      {                                                \
+        int retVal = setmode (fileno (fd), O_TEXT );   \
+        ERROR_IF_MINUS_ONE (retVal)                    \
+      }
+ #  endif
+ 
+ #  if (defined(O_BINARY) != 0)
+ #    undef  SET_BINARY_MODE
+ #    define SET_BINARY_MODE(fd)                       \
+      {                                                \
+        int retVal = setmode (fileno (fd), O_BINARY ); \
+        ERROR_IF_MINUS_ONE (retVal)                    \
+      }
+ #  endif
+ #endif
  
  /*---------------------------------------------*/
  /*--
    Some more stuff for all platforms :-)
  --*/
*************** void compress ( Char *name )
*** 911,921 ****
           copyFileName ( outName, "(stdout)" ); 
           break;
        case SM_F2F: 
           copyFileName ( inName, name );
           copyFileName ( outName, name );
!          strcat ( outName, ".bz2" ); 
           break;
        case SM_F2O: 
           copyFileName ( inName, name );
           copyFileName ( outName, "(stdout)" ); 
           break;
--- 946,980 ----
           copyFileName ( outName, "(stdout)" ); 
           break;
        case SM_F2F: 
           copyFileName ( inName, name );
           copyFileName ( outName, name );
! 
!          if (NO_LFN_SUPPORT(outName))  /* MS-DOS 8.3 filename restriction. */
!          {
!            Char *fileName = basename (outName);
!            if (HAS_EXTENSION (fileName))
!            {
!              register IntNative extStart = (IntNative)(strchr (fileName, '.') - fileName);
!              if (HAS_TAR_EXTENSION (fileName))
!              {
!                fileName[extStart] = '\0';
!                strcat (fileName, ".tbz");
!              }
!              else
!              {
!                IntNative extLen = strlen (&fileName[extStart]);
!                IntNative fileNameLen = extStart;
!                fileName[extStart] = '_';
!                if (fileNameLen + extLen > 8)
!                  strcpy (&fileName[8 - extLen], &fileName[extStart]);
!                strcat ( outName, ".bz2" );
!              }
!            }
!          }
!          else                          /* no filename restriction. */
!            strcat ( outName, ".bz2" );
           break;
        case SM_F2O: 
           copyFileName ( inName, name );
           copyFileName ( outName, "(stdout)" ); 
           break;
*************** void uncompress ( Char *name )
*** 1058,1069 ****
           break;
        case SM_F2F: 
           copyFileName ( inName, name );
           copyFileName ( outName, name );
           for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
              if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
!                goto zzz; 
           cantGuess = True;
           strcat ( outName, ".out" );
           break;
        case SM_F2O: 
           copyFileName ( inName, name );
--- 1117,1138 ----
           break;
        case SM_F2F: 
           copyFileName ( inName, name );
           copyFileName ( outName, name );
           for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
+          {
              if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
!             {
!               if (NO_LFN_SUPPORT(outName))  /* MSDOS 8.3 filename restriction */
!               {
!                 Char *dot = strchr (basename (outName), '_');
!                 if (dot)
!                  *dot = '.';
!               }
!               goto zzz;
!             }
!          }
           cantGuess = True;
           strcat ( outName, ".out" );
           break;
        case SM_F2O: 
           copyFileName ( inName, name );
*************** IntNative main ( IntNative argc, Char *a
*** 1471,1481 ****
     i = j = 0; /* avoid bogus warning from egcs-1.1.X */
  
     /*-- Set up signal handlers for mem access errors --*/
     signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
  #if BZ_UNIX
! #ifndef __DJGPP__
     signal (SIGBUS,  mySIGSEGVorSIGBUScatcher);
  #endif
  #endif
  
     copyFileName ( inName,  "(none)" );
--- 1540,1550 ----
     i = j = 0; /* avoid bogus warning from egcs-1.1.X */
  
     /*-- Set up signal handlers for mem access errors --*/
     signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
  #if BZ_UNIX
! #ifdef SIGBUS
     signal (SIGBUS,  mySIGSEGVorSIGBUScatcher);
  #endif
  #endif
  
     copyFileName ( inName,  "(none)" );
diff -aprNC5 bzip2-0.9.5d.orig/bzip2recover.c bzip2-0.9.5d.djgpp/bzip2recover.c
*** bzip2-0.9.5d.orig/bzip2recover.c	Sat Sep  4 22:24:34 1999
--- bzip2-0.9.5d.djgpp/bzip2recover.c	Thu Oct 21 21:21:22 1999
***************
*** 54,63 ****
--- 54,66 ----
  
  #include <stdio.h>
  #include <errno.h>
  #include <stdlib.h>
  #include <string.h>
+ #ifdef __DJGPP__
+ #include <unistd.h>
+ #endif
  
  typedef  unsigned int   UInt32;
  typedef  int            Int32;
  typedef  unsigned char  UChar;
  typedef  char           Char;
*************** Char outFileName[2000];
*** 71,80 ****
--- 74,88 ----
  Char progName[2000];
  
  UInt32 bytesOut = 0;
  UInt32 bytesIn  = 0;
  
+ #ifdef __DJGPP__
+ #define NO_LFN_SUPPORT(filename)   (pathconf (filename, _PC_NAME_MAX) <= 12)
+ #define HAS_NO_EXTENSION(filename) (strchr ((filename), '.') == NULL)
+ #endif
+ 
  
  /*---------------------------------------------------*/
  /*--- I/O errors                                  ---*/
  /*---------------------------------------------------*/
  
*************** Int32 bsGetBit ( BitStream* bs )
*** 180,190 ****
  {
     if (bs->buffLive > 0) {
        bs->buffLive --;
        return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
     } else {
!       Int32 retVal = getc ( bs->handle );
        if ( retVal == EOF ) {
           if (errno != 0) readError();
           return 2;
        }
        bs->buffLive = 7;
--- 188,201 ----
  {
     if (bs->buffLive > 0) {
        bs->buffLive --;
        return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
     } else {
!       Int32 retVal;
!       errno = 0; /* to avoid program abort with (ENOENT).
!                     errno=22 is generated in main by fopen. */
!       retVal = getc ( bs->handle );
        if ( retVal == EOF ) {
           if (errno != 0) readError();
           return 2;
        }
        bs->buffLive = 7;
*************** Int32 main ( Int32 argc, Char** argv )
*** 399,412 ****
           if (wrBlock >= rbCtr) break;
           wrBlock++;
        } else
        if (bitsRead == rbStart[wrBlock]) {
           outFileName[0] = 0;
!          sprintf ( outFileName, "rec%4d", wrBlock+1 );
           for (p = outFileName; *p != 0; p++) if (*p == ' ') *p = '0';
           strcat ( outFileName, inFileName );
!          if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" );
  
           fprintf ( stderr, "   writing block %d to `%s' ...\n",
                             wrBlock+1, outFileName );
  
           outFile = fopen ( outFileName, "wb" );
--- 410,435 ----
           if (wrBlock >= rbCtr) break;
           wrBlock++;
        } else
        if (bitsRead == rbStart[wrBlock]) {
           outFileName[0] = 0;
! 
!          if (NO_LFN_SUPPORT(inFileName)) /* There are only 8 characters available. */
!            sprintf ( outFileName, "r%4d", wrBlock+1 );
!          else
!            sprintf ( outFileName, "rec%4d", wrBlock+1 );
! 
           for (p = outFileName; *p != 0; p++) if (*p == ' ') *p = '0';
           strcat ( outFileName, inFileName );
! 
!          if (NO_LFN_SUPPORT(outFileName)) /* MSDOS 8.3 file name restriction. */
!          {
!            if (HAS_NO_EXTENSION(outFileName))
!              strcat (outFileName, ".bz2");
!          }
!          else  /* Only if LFN support is available, append an extra extension. */
!            if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" );
  
           fprintf ( stderr, "   writing block %d to `%s' ...\n",
                             wrBlock+1, outFileName );
  
           outFile = fopen ( outFileName, "wb" );
diff -aprNC5 bzip2-0.9.5d.orig/manual.texi bzip2-0.9.5d.djgpp/manual.texi
*** bzip2-0.9.5d.orig/manual.texi	Sat Sep  4 22:14:38 1999
--- bzip2-0.9.5d.djgpp/manual.texi	Thu Oct 21 21:21:22 1999
*************** above statement.
*** 95,105 ****
  
  
  
  
  
! @node Overview, Implementation, Top, Top
  @chapter Introduction
  
  @code{bzip2}  compresses  files  using the Burrows-Wheeler 
  block-sorting text compression algorithm,  and  Huffman  coding.
  Compression  is  generally  considerably  better than that
--- 95,105 ----
  
  
  
  
  
! @node Overview, , Top, (dir)
  @chapter Introduction
  
  @code{bzip2}  compresses  files  using the Burrows-Wheeler 
  block-sorting text compression algorithm,  and  Huffman  coding.
  Compression  is  generally  considerably  better than that
*************** This chapter contains a copy of the @cod
*** 126,146 ****
  and nothing else.
  
  @quotation
  
  @unnumberedsubsubsec NAME
! @itemize
  @item @code{bzip2}, @code{bunzip2}
! - a block-sorting file compressor, v0.9.5
  @item @code{bzcat} 
! - decompresses files to stdout
  @item @code{bzip2recover}
! - recovers data from damaged bzip2 files
  @end itemize
  
  @unnumberedsubsubsec SYNOPSIS
! @itemize
  @item @code{bzip2} [ -cdfkqstvzVL123456789 ] [ filenames ...  ]
  @item @code{bunzip2} [ -fkvsVL ] [ filenames ...  ]
  @item @code{bzcat} [ -s ] [ filenames ...  ]
  @item @code{bzip2recover} filename
  @end itemize
--- 126,146 ----
  and nothing else.
  
  @quotation
  
  @unnumberedsubsubsec NAME
! @itemize @minus
  @item @code{bzip2}, @code{bunzip2}
! a block-sorting file compressor, v0.9.5
  @item @code{bzcat} 
! decompresses files to stdout
  @item @code{bzip2recover}
! recovers data from damaged bzip2 files
  @end itemize
  
  @unnumberedsubsubsec SYNOPSIS
! @itemize @minus
  @item @code{bzip2} [ -cdfkqstvzVL123456789 ] [ filenames ...  ]
  @item @code{bunzip2} [ -fkvsVL ] [ filenames ...  ]
  @item @code{bzcat} [ -s ] [ filenames ...  ]
  @item @code{bzip2recover} filename
  @end itemize
*************** incomprehensible and therefore pointless
*** 177,199 ****
  @code{bunzip2} (or @code{bzip2 -d}) decompresses all
  specified files.  Files which were not created by @code{bzip2}
  will be detected and ignored, and a warning issued.  
  @code{bzip2} attempts to guess the filename for the decompressed file 
  from that of the compressed file as follows:
! @itemize
  @item @code{filename.bz2 } becomes @code{filename}
  @item @code{filename.bz  } becomes @code{filename}
  @item @code{filename.tbz2} becomes @code{filename.tar}
  @item @code{filename.tbz } becomes @code{filename.tar}
  @item @code{anyothername } becomes @code{anyothername.out}
  @end itemize
  If the file does not end in one of the recognised endings, 
  @code{.bz2}, @code{.bz}, 
  @code{.tbz2} or @code{.tbz}, @code{bzip2} complains that it cannot
  guess the name of the original file, and uses the original name
  with @code{.out} appended.
  
  As with compression, supplying no
  filenames causes decompression from standard input to standard output.
  
  @code{bunzip2} will correctly decompress a file which is the
  concatenation of two or more compressed files.  The result is the
--- 177,222 ----
  @code{bunzip2} (or @code{bzip2 -d}) decompresses all
  specified files.  Files which were not created by @code{bzip2}
  will be detected and ignored, and a warning issued.  
  @code{bzip2} attempts to guess the filename for the decompressed file 
  from that of the compressed file as follows:
! @itemize @bullet
  @item @code{filename.bz2 } becomes @code{filename}
  @item @code{filename.bz  } becomes @code{filename}
  @item @code{filename.tbz2} becomes @code{filename.tar}
  @item @code{filename.tbz } becomes @code{filename.tar}
  @item @code{anyothername } becomes @code{anyothername.out}
  @end itemize
+ 
  If the file does not end in one of the recognised endings, 
  @code{.bz2}, @code{.bz}, 
  @code{.tbz2} or @code{.tbz}, @code{bzip2} complains that it cannot
  guess the name of the original file, and uses the original name
  with @code{.out} appended.
  
+ The above applies also to the MSDOS port of @code{bzip2} when LFN support is avaliable.
+ If LFN support is not available then the following naming convention applies:
+ 
+ At compression time:
+ @itemize @bullet
+ @item @code{filename    } becomes @code{filename.bz2}
+ @item @code{filename.e  } becomes @code{filena_e.bz2}
+ @item @code{filename.ex } becomes @code{filen_ex.bz2}
+ @item @code{filename.ext} becomes @code{file_ext.bz2}
+ @item @code{filename.tar} becomes @code{filename.tbz}
+ @end itemize
+ 
+ And at decompression time:
+ @itemize @bullet
+ @item @code{filename.bz2} becomes @code{filename}
+ @item @code{filena_e.bz2} becomes @code{filena.e}
+ @item @code{filen_ex.bz2} becomes @code{filen.ex}
+ @item @code{file_ext.bz2} becomes @code{file.ext}
+ @item @code{filename.tbz} becomes @code{filename.tar}
+ @item @code{anyothername} becomes @code{anyothername.out}
+ @end itemize
+ 
  As with compression, supplying no
  filenames causes decompression from standard input to standard output.
  
  @code{bunzip2} will correctly decompress a file which is the
  concatenation of two or more compressed files.  The result is the
*************** and writes a number of files @code{rec00
*** 399,408 ****
--- 422,439 ----
         damaged  block  cannot  be recovered.  If you wish to minimise 
  any potential data loss through media  or  transmission errors, 
  you might consider compressing with a smaller
         block size.
  
+ For the MSDOS port of @code{bzip2recover} the following naming convention applies:
+ 
+ If LFN support is available the output file names will be of the
+ same form as above described. If LFN support is not available then @code{rec0001file}
+ becomes @code{r0001file}, etc. If the file has no extension then an @code{.b} extension
+ is added, else the original extension is preserved.
+ 
+ 
  
  @unnumberedsubsubsec PERFORMANCE NOTES
  
  The sorting phase of compression gathers together similar strings in the
  file.  Because of this, files containing very long runs of repeated
*************** This interface provides functions for re
*** 1133,1143 ****
  @subsection @code{bzReadOpen}
  @example
     typedef void BZFILE;
  
     BZFILE *bzReadOpen ( int *bzerror, FILE *f, 
!                         int small, int verbosity,
                          void *unused, int nUnused );
  @end example
  Prepare to read compressed data from file handle @code{f}.  @code{f}
  should refer to a file which has been opened for reading, and for which
  the error indicator (@code{ferror(f)})is not set.  If @code{small} is 1,
--- 1164,1174 ----
  @subsection @code{bzReadOpen}
  @example
     typedef void BZFILE;
  
     BZFILE *bzReadOpen ( int *bzerror, FILE *f, 
!                         int verbosity, int small,
                          void *unused, int nUnused );
  @end example
  Prepare to read compressed data from file handle @code{f}.  @code{f}
  should refer to a file which has been opened for reading, and for which
  the error indicator (@code{ferror(f)})is not set.  If @code{small} is 1,
*************** int     nWritten;
*** 1513,1523 ****
  
  f = fopen ( "myfile.bz2", "r" );
  if (!f) @{
     /* handle error */
  @}
! b = bzReadOpen ( &bzerror, f, 0, NULL, 0 );
  if (bzerror != BZ_OK) @{
     bzReadClose ( &bzerror, b );
     /* handle error */
  @}
  
--- 1544,1554 ----
  
  f = fopen ( "myfile.bz2", "r" );
  if (!f) @{
     /* handle error */
  @}
! b = bzReadOpen ( &bzerror, f, 0, 0, NULL, 0 );
  if (bzerror != BZ_OK) @{
     bzReadClose ( &bzerror, b );
     /* handle error */
  @}
  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019