Sophie

Sophie

distrib > Mandriva > 9.1 > i586 > by-pkgid > f1098342ec4a2b28475e34123ce17201 > files > 1379

howto-html-it-9.1-0.5mdk.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Bzip2 Howto</TITLE>


</HEAD>
<BODY>
<H1>Bzip2 Howto</H1>

<H2>David Fetter, 
<A HREF="mailto:dfetter@best.com">dfetter@best.com</A></H2>v1.6, 10 marzo 1998
<P><HR>
<EM>Questo documento descrive come usare il nuovo programma di
compressione bzip2.  L'originale in sgml si trova presso 
<A HREF="http://www.best.com/~dfetter/Bzip2-HOWTO/Bzip2-HOWTO.sgml">http://www.best.com/~dfetter/Bzip2-HOWTO/Bzip2-HOWTO.sgml</A>.</EM>
<HR>
<H2><A NAME="s1">1. Introduzione</A></H2>

<P> Bzip2 &egrave; un nuovo algoritmo per la compressione dei dati.
Generalmente crea file che sono il 60-70% della dimensione dei
corrispondenti ottenuti usando gzip. 
<P>
<P> Per mezzo di questo documento potrai utilizzare alcune
applicazioni comuni con bzip2. 
<P>
<P>Per traduzione in francese puoi far riferimeno a documento di
Arnaud Launay. Una versione web si trova 
<A HREF="http://www.freenix.fr/linux/HOWTO/mini/Bzip2.html">qui</A>, oppure puoi usare ftp  
<A HREF="ftp://ftp.lip6.fr/pub/linux/french/docs/HOWTO/mini/Bzip2.gz">qui</A> 
Arnaud pu&ograve; essere contattato via posta elettronica a 
<A HREF="mailto:zoro@mygale.org">questo indirizzo</A><P>
<P>
<P>Per traduzione in giapponese puoi far riferimento 
<A HREF="http://jf.gee.kyoto-u.ac.jp/JF/JF.html">qui</A> ai documenti
di Tetsu Isaji.  Isaji pu&ograve; essere contattato tramite 
<A HREF="http://www2s.biglobe.ne.jp/~kaien/">la sua home page</A>,
oppure via posta elettronica 
<A HREF="mailto:isaji@mxu.meshnet.or.jp">a questo indirizzo.</A><P>
<H2>1.1 Storia delle revisioni</H2>

<H3>v1.6 Aggiunto il Netscape enabler di TenThumbs.</H3>

<P> Modificato anche lesspipe.sh secondo i sui suggerimenti.  Adesso
dovrebbe funzionare meglio. 
<P>
<H3>v1.5 Aggiunta la traduzione francese di Arnaud Launay, e il suo wu-ftpd file. </H3>

<P>
<H3>v1.4 Aggiunta la traduzione giapponese di Tetsu Isaji.</H3>

<P>
<H3>v1.3 Aggiunto .emacs di Ulrik Dickow per 19.30 e superiori.</H3>

<P>(Su suo consiglio, corretta anche la patch jka-compr.el per
emacs. Oops! Bzip2 non ha ancora(?) un'opzione "append".)
<P>
<H3>v1.2 Modificata la patch per emacs cos&igrave; riconosce automaticamente i file .bz2. </H3>

<P>
<P>
<H3>v1.1 Aggiunta patch per emacs.</H3>

<P>
<P>
<H3>v1.0  Prima Versione.</H3>

<P>
<P>
<P>
<H2><A NAME="get-bzip2"></A> <A NAME="s2">2. Come ottenere bzip2</A></H2>

<P>L'home page di Bzip2 si trova presso l'
<A HREF="http://www.muraroa.demon.co.uk/">home site UK</A>.  Il sito
mirror negli STATI UNITI &egrave; 
<A HREF="http://www.digistar.com/bzip2/index.html">qui</A>.  Puoi
anche trovarlo sul sito della Red Hat 
<A HREF="ftp://ftp.redhat.com/pub/contrib">qui</A>. 
<P>
<H2>2.1 Ottenere bzip2 precompilato</H2>

<P>Vedi gli home site. I binari per Intel della Red Hat si trovano  
<A HREF="ftp://ftp.redhat.com/pub/contrib/i386/bzip2-0.1pl2-1.i386.rpm">qui</A>.  Per la Debian sono 
<A HREF="ftp://ftp.debian.org/debian/hamm/hamm/binary-i386/utils/bzip2_0.1pl2-4.deb">qui</A>, e 
<A HREF="http://www.cdrom.com/pub/linux/slackware-3.4/slakware/a9/bzip2.tgz">qui</A> per la Slackware.
Puoi prenderlo negli analogi posti presso i vari siti mirror.
<P>
<H2>2.2 Ottenere i sorgenti di bzip2</H2>

<P>Sono reperibili dal sito ufficiale (vedi 
<A HREF="#get-bzip2">Ottenere Bzip2</A>), oppure 
<A HREF="ftp://ftp.redhat.com/pub/contrib/SRPMS/bzip2-0.1pl2-1.src.rpm">qui</A> presso Red Hat.
<P>
<H2>2.3 Compilare bzip2 per la tua macchina</H2>

<P><B>Se hai gcc 2.7.2.3</B>, cambia la linea 
<BLOCKQUOTE><CODE>
<PRE>
CFLAGS = -O3 -fomit-frame-pointer -funroll-loops
</PRE>
</CODE></BLOCKQUOTE>
<P>in
<BLOCKQUOTE><CODE>
<PRE>
CFLAGS = -fomit-frame-pointer -funroll-loops
</PRE>
</CODE></BLOCKQUOTE>
<P>ovvero, togli la parte -O3. Dopo di che semplicemente lancia
<CODE>make</CODE> e installalo come spiegato nel README.
<P>
<H2><A NAME="s3">3. Usare bzip2 da solo</A></H2>

<P>Leggi la raffinata pagina del manuale :)
<P>
<H2><A NAME="s4">4. Usare  bzip2 con tar</A></H2>

<P>Di base, ci sono due modi di usarlo, chiamiamoli
<H2>4.1 Facile impostazione:</H2>

<P>questo metodo non richiede un setup generale. Per un-tarare un
archivo tar bzip2, foo.tar.bz2, nella corrente directory, fai 
<BLOCKQUOTE><CODE>
<PRE>
/percorso/per/bzip2 -cd foo.tar.bz2 | tar xf -
</PRE>
</CODE></BLOCKQUOTE>
<P>Questo metodo funziona, ma pu&ograve; essere un po' noioso da scrivere
spesso.
<P>
<H2>4.2 Facile da usare:</H2>

<P>Applica la seguente patch a gnu tar 1.12, compilalo, ed installalo,
e sei pronto per partire. Assicurati che tar and bzip2 si trovino nel
tuo $PATH con "which tar" e "which bzip2". Per usarlo, semplicemente
usa
<BLOCKQUOTE><CODE>
<PRE>
 tar xyf foo.tar.bz2
</PRE>
</CODE></BLOCKQUOTE>

per decomprimere un file.
<P>
<P>Per creare un nuovo archivio, analogamnte:
<BLOCKQUOTE><CODE>
<PRE>
 tar cyf foo.tar.bz2 file1 file2 file3...directory1 directory2...
</PRE>
</CODE></BLOCKQUOTE>
<P>E questa &egrave; la patch :)
<PRE>
*** tar.c.orig  Sat Apr 26 05:09:49 1997
--- tar.c       Feb  2 00:50:47 1998
***************
*** 16,21 ****
--- 16,24 ----
     with this program; if not, write to the Free Software Foundation, Inc.,
     59 Place - Suite 330, Boston, MA 02111-1307, USA.  */

+ /* Feb 2 98: patched by David Fetter to use bzip2 as a
+              filter (option -y) */
+
  #include "system.h"

  #include &lt;getopt.h>
***************
*** 196,201 ****
--- 199,206 ----
    {"block-number", no_argument, NULL, 'R'},
    {"block-size", required_argument, NULL, OBSOLETE_BLOCKING_FACTOR},
    {"blocking-factor", required_argument, NULL, 'b'},
+   {"bzip2", required_argument, NULL, 'y'},
+   {"bunzip2", required_argument, NULL, 'y'},
    {"catenate", no_argument, NULL, 'A'},
    {"checkpoint", no_argument, &amp;checkpoint_option, 1},
    {"compare", no_argument, NULL, 'd'},
***************
*** 372,377 ****
--- 377,383 ----
                PATTERN                at list/extract time, a globbing PATTERN\n\
    -o, --old-archive, --portability   write a V7 format archive\n\
        --posix                        write a POSIX conformant archive\n\
+   -y, --bzip2, --bunzip2             filter the archive through bzip2\n\
    -z, --gzip, --ungzip               filter the archive through gzip\n\
    -Z, --compress, --uncompress       filter the archive through compress\n\
        --use-compress-program=PROG    filter through PROG (must accept -d)\n"),
***************
*** 448,454 ****
     Y  per-block gzip compression */

  #define OPTION_STRING \
!   "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxz"

  static void
  set_subcommand_option (enum subcommand subcommand)
--- 454,460 ----
     Y  per-block gzip compression */

  #define OPTION_STRING \
!   "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxyz"

  static void
  set_subcommand_option (enum subcommand subcommand)
***************
*** 805,810 ****
--- 811,820 ----
        case 'X':
        exclude_option = 1;
        add_exclude_file (optarg);
+       break;
+
+       case 'y':
+       set_use_compress_program_option ("bzip2");
        break;

        case 'z':
</PRE>
<P>
<P>
<H2><A NAME="s5">5. Usare bzip2 con less</A></H2>

<P>Per decomprimere i file bzip2 al volo, ad esempio usare "less" senza
prima bunziparli, tu puoi fare un lesspipe.sh (man less) simile a
questo: 
<PRE>
#!/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 tzvvf - ;;
#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
</PRE>
<P>
<H2><A NAME="s6">6. Usare bzip2 con emacs</A></H2>

<H2>6.1 Cambiare emacs per tutti:</H2>

<P>Ho scritto la seguente patch per jka-compr.el la quale aggiunge bzip2 ad
auto-compression-mode.
<P><B>Disclaimer:</B> Io l'ho solo testato con emacs-20.2, ma non c'&egrave;
nessuna ragione per credere che un simile approccio non funzioni con
altre versioni. 
<P>Come usarlo
<OL>
<LI>Vai nella directory dei sorgenti emacs-20.2/lisp (oppure dove li
hai un-tarati) </LI>
<LI>Metti la seguente patch in un file chiamato jka-compr.el.diff
(deve essere l'unico file ;). </LI>
<LI>Fai
<BLOCKQUOTE><CODE>
<PRE>
 patch &lt; jka-compr.el.diff
</PRE>
</CODE></BLOCKQUOTE>
</LI>
<LI>Avvia emacs, e fai 
<BLOCKQUOTE><CODE>
<PRE>
 M-x byte-compile-file jka-compr.el
</PRE>
</CODE></BLOCKQUOTE>
</LI>
<LI>Esci da emacs.</LI>
<LI>Metti il tuo jka-compr.elc originale in un posto sicuro in caso
di bachi. </LI>
<LI>Sostituisci il nuovo jka-compr.elc.</LI>
<LI>Hai fatto!</LI>
</OL>

<PRE>
--- 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 http://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")
</PRE>
<P>
<H2>6.2 Modificare emacs per un solo utente:</H2>

<P>Un ringraziamento per questa cosa va a Ulrik Dickow, 
<A HREF="mailto:ukd@kampsax.dk">ukd@kampsax.dk</A>, Programmatore di
Sistema presso Kampsax Technology:
<P> 
Per fare in modo di usare bzip2 autmaticamente, senza essere un
sysadmin, aggiungi ci&ograve; che segue nel tuo file .emacs.
<P>
<PRE>
;; 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)
</PRE>
<P>
<H2><A NAME="s7">7. Usare bzip2 con wu-ftpd</A></H2>

<P>Ringrazio Arnaud Launay per questo salva banda.  Ci&ograve; che segue va in 
/etc/ftpconversions per comprimere e decomprimere con bzip2 al volo. 
Assicurati che i percorsi (simile a /bin/compress) siano giusti.
<P>
<PRE>
 :.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 -I -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+BZIP2
</PRE>
<P>
<H2><A NAME="s8">8. Usare bzip2 con Netscape sotto XWindows</A></H2>

<P>tenthumbs@cybernex.net dice:
<P>
<BLOCKQUOTE><CODE>
Ho trovato un modo di far usare bzip2 al Netscape per Linux per
Content-Encoding nello stesso modo con cui usa gzip. Aggiungi quanto
segue a $HOME/.Xdefaults oppure $HOME/.Xresources
<P>Io uso l opzione -s poich&eacute; preferisco sacrificare un po' di velocit&agrave;
di decompressione piuttosto che l'utilizzo di memoria RAM. Puoi
togliere questa opzione se non ne hai bisogno. 
</CODE></BLOCKQUOTE>
<P>
<PRE>
Netscape*encodingFilters:      \
        x-compress :  : .Z     : uncompress -c  \n\
        compress   :  : .Z     : uncompress -c  \n\
        x-gzip     :  : .z,.gz : gzip -cdq      \n\
        gzip       :  : .z,.gz : gzip -cdq      \n\
        x-bzip2    :  : .bz2   : bzip2 -ds \n
</PRE>
<P>
<H2><A NAME="s9">9. Usare bzip2 con xv</A></H2>

<P>Sto lavorando ad una patch, in modo tale che xv autodecomprima i
file bzip2 nello stesso modo con cui pu&ograve; decomprimere quelli di
gzip. Nessuno vuole aiutarmi?
</BODY>
</HTML>