  Bzip2 mini-HOWTO

  David Fetter, david@fetter.org <mailto:david@fetter.org>

  v2.00, 22 August 1999
   : ȣ <guru2k@kldp.org <mailto:guru2k@kldp.org>>

    ο  α׷ bzip2  ϴ ̾߱Ѵ.
  sgml īǴ  Ʈ <Bzip2-HOWTO.sgml>  ְ, "
  ִ" sgml <fetter.org/Bzip2-HOWTO <http://fetter.org/Bzip2-HOWTO/>>
   ִ.

  ______________________________________________________________________

  

  1. Ұ
     1.1  
        1.1.1 v2.00
        1.1.2 v1.92
        1.1.3 v1.91
        1.1.4 v1.9
        1.1.5 v1.8
        1.1.6 v1.7
        1.1.7 v1.6
        1.1.8 v1.5
        1.1.9 v1.4
        1.1.10 v1.3
        1.1.11 v1.2
        1.1.12 v1.1
        1.1.13 v1.0

  2. Bzip2 
     2.1   bzip2-HOWTO
     2.2 ϵ bzip2 ̳ʸ 
     2.3 Bzip2 ҽ 
     2.4  ǻͷ bzip2 ϱ

  3. Bzip2 ܵ 
  4. Bzip2 tar  
     4.1   ġ:
     4.2 root Ư   ġϰ ϱ:
     4.3 Ʈ  ʿ  ϱ.

  5. Bzip2 less  
  6. Bzip2 emacs  
     6.1 θ  emacs ٲٱ:
     6.2    emacs ٲٱ:

  7. Bzip2 wu-ftpd  
  8. Bzip2 grep  
  9. Bzip2 X ݽ  .

  ______________________________________________________________________

  1.  Ұ

  Bzip2 ڷḦ ϱ   ο ˰̴. Ϲ
  gzip    60-70% ũ .

     bzip2 Ͽ Ϲ ø̼ ̿ϰ 
  ̴.

    ̷  bzip2  Julian Seward
  <Julian_Seward@muraroa.demon.co.uk
  <mailto:Julian_Seward@muraroa.demon.co.uk>>  ģ  bzip2 C
  ̺귯 libbzip2  ̴. ̺귯   
  bzip2 ޴ <www.bzip2.org/bzip2/docs/manual_toc.html
  <http://www.bzip2.org/bzip2/docs/manual_toc.html>>  ִ.

    ̷  Ƹ  bzip2  Ŀο ϴ
  (׸ )  ؼ    ̴.

  1.1.   

  1.1.1.  v2.00

  ``Bzip2 less  ϱ'' κ Ǿ ׷ .tar.bzip2
     ִ.  Ϳ  Nicola Fabiano
  <mc864mclink.it <mailto:mc864mclink.it>>  Ѵ.  buzzit
  ƿƼ ŵǾ.  tar  ŵǾ.

  1.1.2.  v1.92

  ``Bzip2 ̳ʸ '' ι Ǿ, S.u.S.E. ߰  
  Ѵ.

  1.1.3.  v1.91

  Ÿ Ǿ ``Bzip2 tar   ι''  ǥ 
  θ ϰ ߴ.  ͵鿡  Alessandro Rubini Ѵ.

   bzip2 ͸  ʱ  buzzit  ߴ.

  Zgrep  bgrep ߰Ǿ.

  1.1.4.  v1.9

  Gcc 2.7.*  ϰ ߴ. ̰  Ulrik Dickow
  Ѵ.

  Leonard Jean-Marc Ǹ tar  ϴ  ߰Ǿ.

  Linux Akerlund   ߰Ǿ.  Arnaud Launay 
  wu-ftpd ι ƴ.

   ׵ ڽ ι Ű.

  1.1.5.  v1.8

  Buzzit װ͵ Ѱ sgml tar.diff ־.  
  ߴ.  Arnaud Launay  縦     
  Ѵ. :-)

     ο  xv Ʈ ߴ.

    ̷    ߰ߴ.

  1.1.6.  v1.7

  Buzzit ƿƼ ߰Ǿ. Gnu tar  ġ ƴ.

  1.1.7.  v1.6

  TenThumbs Netscape enabler ߰Ǿ.

     lesspipe.sh ߴ. ݺ Ǹϰ ۵
  ̴.

  1.1.8.  v1.5

  Arnaud Launay  , ׸  wu-ftpd  ߰Ǿ.

  1.1.9.  v1.4

  Tetsu Isaji Ϻ  ߰Ǿ.

  1.1.10.  v1.3

  Ulrik Dickow 19.30    .emacs ߰Ǿ.

  (   emacs jka-compr.elġ Ǿ.  ̷!
  Bzip2 ÷װ (?) .)

  1.1.11.  v1.2

  Emacs ġ Ǿ ڵ .bz2 ϵ νѴ.

  1.1.12.  v1.1

  Emacs ġ ߰Ǿ.

  1.1.13.  v1.0

   1.

  2.  Bzip2 

  Bzip2 Ȩ  Ȩ Ʈ <www.bzip2.org
  <http://www.bzip2.org/>> ְ.  ̱ ̷Ʈ
  <www.digistar.com/bzip2/index.html
  <http://www.digistar.com/bzip2/index.html>>  ִ.

  2.1.    bzip2-HOWTO

  ε Ƹ Arnaud Launay   ϱ⸦ ٶ
  ̴.    <www.freenix.fr/linux/HOWTO/mini/Bzip2.html
  <http://www.freenix.fr/linux/HOWTO/mini/Bzip2.html>>  ְ, ftp
  ftp.lip6.fr/pub/linux/french/docs/HOWTO/mini/Bzip2.gz
  <ftp://ftp.lip6.fr/pub/linux/french/docs/HOWTO/mini/Bzip2.gz> 
  ִ.  Arnaud ڸϷ   ִ.  ּҴ
  <zoro@mygale.org <mailto:zoro@mygale.org>> ̴.

  Ϻε Ƹ Tetsu Isaji Ϻ  ϱ⸦ ٶ ̴.
   <jf.gee.kyoto-u.ac.jp/JF/JF.html <http://jf.gee.kyoto-
  u.ac.jp/JF/JF.html>>  ִ. Isaji Ȩ
  <www2s.biglobe.ne.jp/~kaien/ <http://www2s.biglobe.ne.jp/~kaien/>>
  Ҽ ְ, Ȥ ڸϷ   ִ.  ּҴ
  <isaji@mxu.meshnet.or.jp <mailto:isaji@mxu.meshnet.or.jp>> ̴.

  ε Ƹ Linus Akerlund   ϱ⸦ ٶ
   .  <user.tninet.se/~uxm165t/linux_doc.html
  <http://user.tninet.se/~uxm165t/linux_doc.html>>  ִ.  Linus
  ڸϷ Ҽ ִ.  ּҴ <uxm165t@tninet.se
  <mailto:uxm165t@tninet.se>> ̴.

  2.2.  ϵ bzip2 ̳ʸ 

  Ȩ Ʈ .

  2.3.  Bzip2 ҽ 

   Ʈ ִ (``Bzip2 ''  .

  2.4.   ǻͷ bzip2 ϱ

    gcc 2.7.*  ,   ٲ

  CFLAGS = -O3 -fomit-frame-pointer -funroll-loops 

  CFLAGS = -O2 -fomit-frame-pointer -O3  -O2 ٲٰ -funroll-loops
  ִ´. Ŀ Ҷ     -m* ÷׸(,
  -m486) ߰ϱ  ̴.  -funroll-loops ϴ   ߿
  κ̰, gcc 2.7 ߸  带 ϴ   ǰ, gcc
  2.7 ڵ尡    Ŀ ̴.  ٸ Ϸ (lcc,
  egcs, gcc 2.8.x)  Ʈ CFLAGS  .   , README ٷ
  װ  ġض.

  3.  Bzip2 ܵ 

   ޴  о :)

  4.  Bzip2 tar  

  ٲپ ϸ bzip2 tar     ؿ Ʈ ȴ.

  4.1.    ġ:

     ġ ʿ ʴ.  丮 foo.tar.bz2ó
  tar bzip2   Ǯ

  /path/to/bzip2 -cd foo.tar.bz2 | tar xf - Ǵ

  tar --use-compress-prog=bzip2 xf foo.tar.bz2  ۾  PITA  
   ִ.

  4.2.  root Ư   ġϰ ϱ:

    Leonard Jean-Marc <leonard@sct1.is.belgacom.be
  <mailto:leonard@sct1.is.belgacom.be>> Ѵ. csh bash 
   Ϳ  Alessandro Rubini <rubini@morgana.systemy.it
  <mailto:rubini@morgana.systemy.it>>   Ѵ.

   .bashrc, ̰Ͱ   ־:

  alias btar='tar --use-compress-program /usr/local/bin/bzip2 ' 
  .tcshrc, Ǵ .cshrc, ̰Ͱ ϰ ̴ :

  alias btar 'tar --use-compress-program /usr/local/bin/bzip2'

  4.3.  Ʈ  ʿ  ϱ.

   tar GNU  ο  ض,  1.13.10̴.
  װ GNU ftp Ʈ  alpha.gnu.org/gnu/tar/
  <ftp://alpha.gnu.org/gnu/tar/> ã  ְ Ȥ  ̷.

  5.  Bzip2 less  

  bzip2   bunzip2  less ̿Ϸ lesspipr.sh
  (man less)    :

  ______________________________________________________________________
  #!/bin/sh
    # This is a preprocessor for 'less'.  It is used when this environment
    # variable is set:   LESSOPEN="|lesspipe.sh %s"
    case "$1" in
      *.tar) tar tvvf $1 2>/dev/null ;; # View contents of various tar'd files
      *.tgz) tar tzvvf $1 2>/dev/null ;;
    # This one work for the unmodified version of tar:
      *.tar.bz2) bzip2 -cd $1 $1 2>/dev/null | tar tvvf - ;;
    #This one works with the patched version of tar:
    # *.tar.bz2) tyvvf $1 2>/dev/null ;;
      *.tar.gz) tar tzvvf $1 2>/dev/null ;;
      *.tar.Z) tar tzvvf $1 2>/dev/null ;;
      *.tar.z) tar tzvvf $1 2>/dev/null ;;
      *.bz2) bzip2 -dc $1  2>/dev/null ;; # View compressed files correctly
      *.Z) gzip -dc $1  2>/dev/null ;;
      *.z) gzip -dc $1  2>/dev/null ;;
      *.gz) gzip -dc $1  2>/dev/null ;;
      *.zip) unzip -l $1 2>/dev/null ;;
      *.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.man) FILE=`file -L $1` ; # groff src
        FILE=`echo $FILE | cut -d ' ' -f 2`
        if [ "$FILE" = "troff" ]; then
          groff -s -p -t -e -Tascii -mandoc $1
        fi ;;
      *) cat $1 2>/dev/null ;;
    #  *) FILE=`file -L $1` ; # Check to see if binary, if so -- view with 'strings'
    #    FILE1=`echo $FILE | cut -d ' ' -f 2`
    #    FILE2=`echo $FILE | cut -d ' ' -f 3`
    #    if [ "$FILE1" = "Linux/i386" -o "$FILE2" = "Linux/i386" \
    #         -o "$FILE1" = "ELF" -o "$FILE2" = "ELF" ]; then
    #      strings $1
    #    fi ;;
      esac

  ______________________________________________________________________

  6.  Bzip2 emacs  

  6.1.  θ  emacs ٲٱ:

   ڵ带 ߰ jka-compr.el ġ  .  μ:
   emacs-20.0 ׽Ʈ غô, ׷ ٸ   ϰ
   Ѵٰ   .    ,

  1. emacs-20.2/lisp ҽ 丮  ( tar Ǭ )

  2. jka-compr.el.diff θ  Ʒ ġ ƶ  (  
       ܵ ־Ѵ ;).

  3. ض patch < jka-compr.el.diff

  4. Emacs ض, ׸ ض

     M-x byte-compile-file jka-compr.el

  5. Emacs ض.

  6.   jka-compr.elc  ̽  
     Űܶ.

  7. ο jka-compr.elc   ٲ.

  8. ܶ!

  ______________________________________________________________________
     --- jka-compr.el        Sat Jul 26 17:02:39 1997
       +++ jka-compr.el.new    Thu Feb  5 17:44:35 1998
       @@ -44,7 +44,7 @@
        ;; The variable, jka-compr-compression-info-list can be used to
        ;; customize jka-compr to work with other compression programs.
        ;; The default value of this variable allows jka-compr to work with
       -;; Unix compress and gzip.
       +;; Unix compress and gzip.  David Fetter added bzip2 support :)
        ;;
        ;; If you are concerned about the stderr output of gzip and other
        ;; compression/decompression programs showing up in your buffers, you
       @@ -121,7 +121,9 @@

      ;;; I have this defined so that .Z files are assumed to be in unix
       -;;; compress format; and .gz files, in gzip format.
       +;;; compress format; and .gz files, in gzip format, and .bz2 files,
       +;;; in the snappy new bzip2 format from <url url="http://www.muraroa.demon.co.uk" name="www.muraroa.demon.co.uk" >.
       +;;; Keep up the good work, people!
        (defcustom jka-compr-compression-info-list
          ;;[regexp
          ;; compr-message  compr-prog  compr-args
       @@ -131,6 +133,10 @@
             "compressing"    "compress"     ("-c")
             "uncompressing"  "uncompress"   ("-c")
             nil t]
       +    ["\\.bz2\\'"
       +     "bzip2ing"        "bzip2"         ("")
       +     "bunzip2ing"      "bzip2"         ("-d")
       +     nil t]
            ["\\.tgz\\'"
             "zipping"        "gzip"         ("-c" "-q")
             "unzipping"      "gzip"         ("-c" "-q" "-d")
  ______________________________________________________________________

  6.2.     emacs ٲٱ:

  Kampsax Technology ִ ý α׷ Ulrik Dickow,
  ukd@kampsax.dk <mailto:ukd@kampsax.dk> <mailto:ukdATkampsax.dk> 
  ̰Ϳ  Ѵ:  ý۰ڰ ƴҶ װ 
  bzip2 ڵ   ִ.   .emacs ϴ 
  ߰ض.

  ______________________________________________________________________
    ;; Automatic (un)compression on loading/saving files (gzip(1) and similar)
    ;; We start it in the off state, so that bzip2(1) support can be added.
    ;; Code thrown together by Ulrik Dickow for ~/.emacs with Emacs 19.34.
    ;; Should work with many older and newer Emacsen too.  No warranty though.
    ;;
    (if (fboundp 'auto-compression-mode) ; Emacs 19.30+
        (auto-compression-mode 0)
      (require 'jka-compr)
      (toggle-auto-compression 0))
    ;; Now add bzip2 support and turn auto compression back on.
    (add-to-list 'jka-compr-compression-info-list
                 ["\\.bz2\\(~\\|\\.~[0-9]+~\\)?\\'"
                  "zipping"        "bzip2"         ()
                  "unzipping"      "bzip2"         ("-d")
                  nil t])
    (toggle-auto-compression 1 t)
  ______________________________________________________________________

  7.  Bzip2 wu-ftpd  

  Arnaud Launay  bandwidth ̹  Ѵ. ̰ bzip2
    /etc/ftpconversions  Ѵ. θ Ȯ ؾ 
   ϶.

  ______________________________________________________________________
   :.Z:  :  :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
     :   : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
     :.gz: :  :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
     :   : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
     :.bz2: :  :/bin/bzip2 -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:BUNZIP2
     :   : :.bz2:/bin/bzip2 -9 -c %s:T_REG:O_COMPRESS:BZIP2
     :   : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
     :   : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
     :   : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP
     :   : :.tar.bz2:/bin/tar -c -y -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+BZIP2
  ______________________________________________________________________

  8.  Bzip2 grep  

   bgrep   linux    zgrep  
  .  bunzip2   ̵ ϴ grep  
   ̴.

  ______________________________________________________________________
  #!/bin/sh
  # bgrep -- a wrapper around a grep program that decompresses files as needed
    PATH="/usr/bin:$PATH"; export PATH
  prog=`echo $0 | sed 's|.*/||'`
    case "$prog" in
            *egrep) grep=${EGREP-egrep}     ;;
            *fgrep) grep=${FGREP-fgrep}     ;;
            *)      grep=${GREP-grep}       ;;
    esac
    pat=""
    while test $# -ne 0; do
      case "$1" in
      -e | -f) opt="$opt $1"; shift; pat="$1"
               if test "$grep" = grep; then  # grep is buggy with -e on SVR4
                 grep=egrep
               fi;;
      -*)      opt="$opt $1";;
       *)      if test -z "$pat"; then
                 pat="$1"
               else
                 break;
               fi;;
      esac
      shift
    done
  if test -z "$pat"; then
      echo "grep through bzip2 files"
      echo "usage: $prog [grep_options] pattern [files]"
      exit 1
    fi
  list=0
    silent=0
    op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
    case "$op" in
      *l*) list=1
    esac
    case "$op" in
      *h*) silent=1
    esac
  if test $# -eq 0; then
      bzip2 -cd | $grep $opt "$pat"
      exit $?
    fi
  res=0
    for i do
      if test $list -eq 1; then
        bzip2 -cdfq "$i" | $grep $opt "$pat" > /dev/null && echo $i
        r=$?
      elif test $# -eq 1 -o $silent -eq 1; then
        bzip2 -cd "$i" | $grep $opt "$pat"
        r=$?
      else
        bzip2 -cd "$i" | $grep $opt "$pat" | sed "s|^|${i}:|"
        r=$?
      fi
      test "$r" -ne 0 && res="$r"
    done
    exit $res
  ______________________________________________________________________

  9.  Bzip2 X ݽ  .

  <mailto:tenthumbs@cybernex.net >

