This is ebzip.info, produced by makeinfo version 4.0 from ebzip.texi.

INFO-DIR-SECTION CD-ROM Book Utilities
START-INFO-DIR-ENTRY
* ebzip: (ebzip).               Compress and uncompress a CD-ROM book.
END-INFO-DIR-ENTRY

   ebzip: Utility for compressing and uncompressing CD-ROM books, by
Motoyuki Kasahara.

   Copyright (C) 1998, 1999  Motoyuki Kasahara

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by Free Software Foundation, Inc.


File: ebzip.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)

   This is edition 2.3.8, for EB Library version 2.3.8.

* Menu:

* Introduction::                Introduction.
* Action and Command Name::     Action and Command Name.
* Invoking ebzip::              Invoking `ebzip'.
* Compression::                 About the Compression Action.
* Uncompression::               About the Uncompression Action.
* Information::                 About the Information Action.
* Delete a Book::               Delete a Book.
* Summary of Options::          Summary of Options to `ebzip'.
* Comparision Result::          Comparision of Compression Results.
* Compressed File Format::      Compressed File Format.

 --- The Detailed Node Listing ---

Compression

* Compression Example 1::       Example of Compression (1).
* Compression Example 2::       Example of Compression (2).
* Compression Level::           Compression Level.
* Adjust Filenames::            Adjust Filenames.
* Test::                        Test.
* Partial Compression::         Partial Compression.
* Overwrite Old Files::         Overwrite Old Files.
* Compress Compressed EPWING::  Compress Compressed EPWING.

Uncompression

* Uncompression Example::       Example of Uncompression.
* Options for Uncompression::   Options for Uncompression.
* Uncompress Compressed EPWING::  Uncompress Compressed EPWING.

Information

* Information Example::         Example of Information.
* Options for Information::     Options for Information.

Compressed File Format

* Format Overview::             Overview about Compression File Format
* Data Part::                   Data Part
* Index Part::                  Index Part
* Header Part::                 Header Part


File: ebzip.info,  Node: Introduction,  Next: Action and Command Name,  Prev: Top,  Up: Top

Introduction
************

   `ebzip' is a command to compress/uncompress CD-ROM books for EB
Library applications.  EB Library applications can access compressed
CD-ROM books without any functional restriction.  (But, their access
speed to compressed books may be slower than that to original books.)
Since the compression data format is independent of CPU type, operating
system, and file system, files compressed by `ebzip' can be
interchanged.  The `ebzip' command is distributed with EB Library.

   `ebzip' is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

   `ebzip' is distributed in the hope that it will be useful, but
_without any warranty_; without even the implied warranty of
merchantability or fitness for a particular purpose.  See the GNU
General Public License for more details.

   In addition, you must follow the licenses of your CD-ROM books.
Though `ebzip' is free software, your books may not be free.  If the
publishers of your CD-ROM don't permit to copy the book onto a hard
disk (nor other strage devices), please give up compress the book.

   This is edition 2.3.8, for EB Library version 2.3.8.


File: ebzip.info,  Node: Action and Command Name,  Next: Invoking ebzip,  Prev: Introduction,  Up: Top

Action and Command Name
***********************

   `ebzip' has three "action" modes; compression, uncompression and
information.

   * compression
     Compress a CD-ROM book.

   * uncompression
     Uncompress a CD-ROM book compressed by `ebzip'.

   * information
     Output information about compression status of a CD-ROM book
     compressed by `ebzip'.


When `ebzip' is invoked, the action is determined by invoked name of
the `ebzip' command and command line options to `ebzip'.  The action is
never changed during an execution of `ebzip'.

   `ebzip' has installed with three different command names; `ebzip',
`ebunzip' and `ebzipinfo'.  (On DOS and Windows systems, `ebzipinfo' is
renamed to `ebzipinf').  Usually, they are hard-linked like as follows:

     % ls -li ebzip ebunzip ebzipinfo
     38787 -rwxr-xr-x  3 bin   bin     73728 Jun 27 22:48 ebunzip
     38787 -rwxr-xr-x  3 bin   bin     73728 Jun 27 22:48 ebzip
     38787 -rwxr-xr-x  3 bin   bin     73728 Jun 27 22:48 ebzipinfo

When it is invoked as `ebunzip', the default action is uncompression.
When it is invoked as `ebzipinfo', information is the default action.
Otherwise, the default action is compression.

   In addition, you can specify the action by the command line options;
`--compress' (`-z'), `--uncompress' (`-u') and `--information' (`-i').
They are prior to invoked names.  In the following example, "compress"
is the action of all the lines:

     ebunzip
     ebzip --uncompress
     ebzipinfo --uncompress


File: ebzip.info,  Node: Invoking ebzip,  Next: Compression,  Prev: Action and Command Name,  Up: Top

Invoking `ebzip'
****************

   Its usual way to invoke `ebzip', `ebunzip' and `ebzipinfo' are as
follows:

     % ebzip BOOK-PATH
     % ebunzip BOOK-PATH
     % ebzipinfo BOOK-PATH

BOOK-PATH points to the top directory of a CD-ROM book where the file
`CATALOG' or `CATALOGS' resides.  `ebzip' compresses a book at
BOOK-PATH, `ebunzip' uncompresses a book at BOOK-PATH, and `ebzipinfo'
outputs information about a book at BOOK-PATH.

   Though you cannot specify two or more book-paths, you can omit
book-path like as follows:

     % ebzip
     % ebunzip
     % ebzipinfo

In this case, it is assumed that the current working directory (`.') is
specified.


File: ebzip.info,  Node: Compression,  Next: Uncompression,  Prev: Invoking ebzip,  Up: Top

Compression
***********

   `ebzip' (equivalent to `ebunzip --compress' and `ebzipinfo
--compress') compresses a CD-ROM book.

* Menu:

* Compression Example 1::       Example of Compression (1).
* Compression Example 2::       Example of Compression (2).
* Compression Level::           Compression Level.
* Adjust Filenames::            Adjust Filenames.
* Test::                        Test.
* Partial Compression::         Partial Compression.
* Overwrite Old Files::         Overwrite Old Files.
* Compress Compressed EPWING::  Compress Compressed EPWING.


File: ebzip.info,  Node: Compression Example 1,  Next: Compression Example 2,  Prev: Compression,  Up: Compression

Example of Compression (1)
==========================

   This section explains how to compress your CD-ROM book which has
already copied on a hard disk.  Supporse that you have already copied a
CD-ROM book to `/dict' on a hard disk, but it is not compressed.  The
book has the following files under `/dict'.

     /dict/catalog
     /dict/language
     /dict/kanji/start
     /dict/english/start

You can compress the book by the following way:

     % cd /dict
     % ebzip

This is equivalent to:

     % ebzip --output-directory /dict /dict

Compression may take a while.  `ebzip' outputs status messages during
the compression like as follows:

     ==> compress /dict/kanji/start <==
     output to ./dict/kanji/start.ebz
      1.0% done (2097152 / 220069888 bytes)
      1.9% done (4194304 / 220069888 bytes)
      2.9% done (6291456 / 220069888 bytes)
             : (snip)
     completed (220069888 / 220069888 bytes)
     220069888 -> 78163751 bytes (35.5%)

When the compression has done, the directory structure under `/dict' is
slightly changed.

     /dict/catalog
     /dict/language.ebz
     /dict/kanji/start.ebz
     /dict/english/start.ebz

The suffix `.ebz' is added to the some files (`/dict/language.ebz',
`/dict/kanji/start.ebz' and `/dict/english/start.ebz').  They are
compressed files.  Other files are unchanged.

   `ebzip' compresses the following files; `START', `HONMON',
`LANGUAGE', and font files under the `GAIJI' directories.


File: ebzip.info,  Node: Compression Example 2,  Next: Compression Level,  Prev: Compression Example 1,  Up: Compression

Example of Compression (2)
==========================

   This section shows another example.  This section explains how to
compress files in a CD-ROM disc and put them onto a hard disk.  Suppose
that and original CD-ROM book is mounted on `/cdrom' and that the book
has the following files under `/cdrom'.

     /cdrom/catalog
     /cdrom/language
     /cdrom/german/start
     /cdrom/french/start
     /cdrom/italian/start

   Execute the following commands to compress the book an put it on
`/dict':

     % cd /dict
     % ebzip --keep /cdrom

This is equivalent to:

     % ebzip --keep --output-directory /dict /cdrom

Please note that the output directory `/dict' may be empty, but it must
have been created before compression.  In this example, the `--keep'
option is used.  By default, `ebzip' deletes original files after
compression, but the `--keep' option disables this behavior.

   The directory strcture under `/dict' and `/cdrom' are almost same,
but the suffix `.ebz' is added to the compressed files under `/dict'.

     /dict/catalog
     /dict/language.ebz
     /dict/german/start.ebz
     /dict/french/start.ebz
     /dict/italian/start.ebz

The intermediate directories, `/dict/german', `/dict/french' and
`/dict/italian', are created by `ebzip' if missing.  `CATALOG' and
`CATALOGS' are simply copied to the output directory.  `ebzip' ignores
files and directories not supported by EB Library.


File: ebzip.info,  Node: Compression Level,  Next: Adjust Filenames,  Prev: Compression Example 2,  Up: Compression

Compression Level
=================

   `ebzip' supports four compression levels, from 0 to 3.  The
compression level 0 is the fastest compression/uncompression method,
but it is the worst compression method.  The compression level 3 is the
best compression method but it is the slowest compression/uncompression
method.  The compression level is set by the `--level' (`-l') option.

     % ebzip --level 2 --output-directory /dict /dict

The default level is 0 (fastest but worst).


File: ebzip.info,  Node: Adjust Filenames,  Next: Test,  Prev: Compression Level,  Up: Compression

Adjust Filenames
================

   Let's go back to the previous example.  Again, supporsed that you
have already copied a CD-ROM book to `/dict' on a hard disk, but it is
not compressed.  The book has the following files under `/dict'.
However, unlike the previous example, file and directory names under
`/dict' consist of upper case letters, and filenames have the version
number `;1' in their tails.

     /dict/CATALOG;1
     /dict/LANGUAGE;1
     /dict/GERMAN/START;1
     /dict/FRENCH/START;1
     /dict/ITALIAN/START;1

   After the compression by `ebzip', they will be as the following:

     /dict/CATALOG;1
     /dict/LANGUAGE.EBZ;1
     /dict/GERMAN/START.EBZ;1
     /dict/FRENCH/START.EBZ;1
     /dict/ITALIAN/START.EBZ;1

`ebzip' keeps "case" (upper or lower) and "suffix" of filenames as
original form.  The following table displayes how a filename of `start'
file changes.

case/suffix                   before compression     after compresssion
lower/none                    start                  start.ebz
lower/dot                     start.                 start.ebz
lower/version                 start;1                start.ebz;1
lower/dot+version             start.;1               start.ebz;1
upper/none                    START                  START.EBZ
upper/dot                     START.                 START.EBZ
upper/version                 START;1                START.EBZ;1
upper/dot+version             START.;1               START.EBZ;1

   The `--case' and `--suffix' options allows you to modify these case
and suffix styles of output filenames.  The `--case' option takes an
argument, and it must be `upper' or `lower'.  The option sets the case
of output filenames to upper or lower.  Also the `--suffix' option
takes an argument, and it must be `none', `dot', `version' or `both'.
The option sets the suffix style of output filenames to none, dot,
version or both (dot+version).


File: ebzip.info,  Node: Test,  Next: Partial Compression,  Prev: Adjust Filenames,  Up: Compression

Test
====

   Invoking `ebzip' with the `--test' (`-t') option, `ebzip' doesn't
write compressed data to actual files.  This is usuful when you want to
know the sizes of compressed files before compression.

     % ebzip --test /dict /dict


File: ebzip.info,  Node: Partial Compression,  Next: Overwrite Old Files,  Prev: Test,  Up: Compression

Partial Compression
===================

   `ebzip' compresses an entire book by default, but the `--subbook'
(`-S') option allows you to compress specified subbooks only.

   The `--subbook' option takes an argument which is a list of
directory names of subbooks to be compressed, separeted by a comma
(`,').  The `ebinfo' command tells you what subbooks your book contains
and what their directory names are.

     % ebinfo /mnt/cdrom
     disc type: EB/EBG/EBXA/EBXA-C/S-EBXA
     character code: JIS X 0208
     the number of subbooks: 3
     
     subbook 1:
       title: New English Japanese Dictionary (4th edition)
       directory: ENGLISH
       search methods: word endword keyword menu
       font sizes: 16 24 30 48
       narrow font characters: 0xa121 -- 0xa24e
       wide font characters: 0xa321 -- 0xa27e
     subbook 2:
       title: CD-ROM French Japanese Dictionary (3rd edition)
       directory: FRENCH
       search methods: word endword keyword menu
       font sizes: 16 24 30 48
       narrow font characters:
       wide font characters: 0xa321 -- 0xa27e
     subbook 3:
       title: Pocket German Japanese Dictionary (3rd edition)
       directory: GERMAN
       search methods: menu
       font sizes: 16 24 30 48
       narrow font characters:
       wide font characters: 0xa321 -- 0xa27e

(*Note Invoking `ebinfo': (ebinfo)Invoking ebinfo, for more details
about the `ebinfo' command).
In this example, there are three subbooks in the book, and their
directory names are `ENGLISH', `FRENCH' and `GERMAN'.

   You can compress only `ENGLISH' and `FRENCH' by the following way:

     % ebzip --subbook english,french /dict

Case of the directory names are not sensitve.  An argument to
`--subbook' can be splitted like as follows:

     % ebzip --subbook english --subbook french /dict

Files in the rest subbooks (`GERMAN' in this example) are not
compressed nor copied, so that the compression procedure for the book
is incompleted at this point.  In order to use the book, you must
compress the rest subbooks in a further operation, or deletes the rest
subbooks from a subbook list in the `CATALOG(S)' file by using the
`ebrefile' command (*Note Combination with `ebzip':
(ebrefile)Combination with ebzip, for more details).  You can compress
subbooks with different compression levels (e.g. compress `ENGLISH' and
`FRENCH' with level 0, and compress `GERMAN' with level 2).

   Regardless of the `--subbook' option, the `LANGUAGE' file is always
compressed.


File: ebzip.info,  Node: Overwrite Old Files,  Next: Compress Compressed EPWING,  Prev: Partial Compression,  Up: Compression

Overwrite Old Files
===================

   `ebzip' asks you whether a file may be overwritten or not when the
file already exists.

     ==> compress /dict/science/data/honmon <==
     output to /dict/science/data/honmon.ebz
     
     the file already exists: /dict/science/data/honmon.ebz
     do you wish to overwrite (y or n)?

Please answer `y' or `n'.  If you answer as `n', `ebzip' skips the file.

   When the `--force-overwrite' option is specified, `ebzip' overwrites
existed files without confirmation.  Similary, when the
`--no-overwrite' option is specified, `ebzip' skips the file without
confirmation.


File: ebzip.info,  Node: Compress Compressed EPWING,  Prev: Overwrite Old Files,  Up: Compression

Compress Compressed EPWING CD-ROM Book
======================================

   `ebzip' can compress a CD-ROM book compressed with the EPWING
compression format.  It uncompress the book, and then recompresses the
book with the ebzip compression format.  Since the ebzip compression is
generally better than the EPWING compression format, the book
compressed by `ebzip' is smaller than original.


File: ebzip.info,  Node: Uncompression,  Next: Information,  Prev: Compression,  Up: Top

Uncompression
*************

   `ebunzip' (equivalent to `ebzip --uncompress' and `ebzipinfo
--uncompress') uncompresses a CD-ROM book compressed by `ebzip'.

* Menu:

* Uncompression Example::       Example of Uncompression.
* Options for Uncompression::   Options for Uncompression.
* Uncompress Compressed EPWING::  Uncompress Compressed EPWING.


File: ebzip.info,  Node: Uncompression Example,  Next: Options for Uncompression,  Prev: Uncompression,  Up: Uncompression

Example of Uncompression
========================

   Uncompression procedure is closely similar to compression.  Suppose
that a compressed subbook resides under `/dict'.  The book has the
following files under `/dict'.

     /dict/catalog
     /dict/language.ebz
     /dict/kanji/start.ebz
     /dict/english/start.ebz

Execute the following command to uncompress the book:

     % cd /dict
     % ebunzip

This is equivalent to:

     % ebunzip --output-directory /dict /dict

Uncompression may take a while.  `ebunzip' outputs status messages
during the uncompression like as follows:

     ==> uncompress /dict/kanji/start.ebz <==
     output to ./kanji/start.ebz
      5.1% done (4194304 / 82460672 bytes)
     10.2% done (8388608 / 82460672 bytes)
     15.3% done (12582912 / 82460672 bytes)
             : (snip)
     completed (82460672 / 82460672 bytes)
     25681439 -> 82460672 bytes

During the uncompression, `ebunzip' asks you whether an existed file
may be overwritten or not:

     ==> uncompress /dict/kanji/start.ebz <==
     output to /dict/kanji/start
     
     the file already exists: /dict/kanji/start
     do you wish to overwrite (y or n)?

When the uncompression has done, the directory structure under `dict'
is slightly changed.

     /dict/catalog
     /dict/language
     /dict/kanji/start
     /dict/english/start

Uncompressed files change their filenames; the suffix `.ebz' is removed
from them.


File: ebzip.info,  Node: Options for Uncompression,  Next: Uncompress Compressed EPWING,  Prev: Uncompression Example,  Up: Uncompression

Options for Uncompression
=========================

   Most options have the same meanings at compression and uncompression.

   When the `--keep' option is specified, `ebunzip' doesn't delete
compressed files after uncompression.

   Invoking `ebunzip' with the `--test' option, `ebunzip' doesn't write
uncompressed data to acutual files.  This option is usuful for checking
validity of compressed files.  *Note Test::, for more details about the
`--test' option.

   When the `--subbook' is specified, `ebunzip' only uncompresses
specified subbooks, in addition with `LANGUAGE'.  *Note Partial
Compression::, for more details about the `--subbook' option.

   When the `--force-overwrite' or `--no-overwrite' option is
specified, `ebunzip' overwrites or skips files without confirmation for
overwriting.  *Note Overwrite Old Files::, for more details about the
`--force-overwrite' and `--no-overwrite' options.

   By default, case (upper or lower) and suffix styles of filenames of
uncompressed files are the same as those of compressed files.  The
`--case' and `--suffix' options allows you to modify the case and
suffix styles of filenames of uncompressed files.  *Note Adjust
Filenames::, for more details about the `--case' and `--suffix' options.

   `ebunzip' ignores the `--level' option.  You don't have to specify
the `--level' option at uncompression.


File: ebzip.info,  Node: Uncompress Compressed EPWING,  Prev: Options for Uncompression,  Up: Uncompression

Uncompress Compressed EPWING CD-ROM Book
========================================

   `ebzip' can uncompress a CD-ROM book compressed with the EPWING
compression format.  However, `ebzip' cannot restore the original
compressed book by compressing the uncompressed book again.  In other
words, `ebzip' support uncompression of the EPWING compression format,
but doesn't support compression.


File: ebzip.info,  Node: Information,  Next: Delete a Book,  Prev: Uncompression,  Up: Top

Information
***********

   `ebzipinfo' (equivalent to `ebzip --information' and `ebunzip
--information') outputs information about compression status of a
CD-ROM book.

* Menu:

* Information Example::         Example of Information.
* Options for Information::     Options for Information.


File: ebzip.info,  Node: Information Example,  Next: Options for Information,  Prev: Information,  Up: Information

Example of Information
======================

   Please type the following commands to output information of the
compressed CD-ROM book at `/dict'.

     % ebzipifo /dict

`ebzipinfo' outputs information to standard out like as following:

     ==> /dict/spanish/spanish/start.ebz <==
     compressed: 154290176 -> 54881862 bytes (35.6%)
     compresssion level: 0
     ==> /dict/spanish/language.ebz <==
     compressed: 12288 -> 4121 bytes (33.5%)
     compresssion level: 0
     ==> /dict/spanish/catalog <==
     not compressed


File: ebzip.info,  Node: Options for Information,  Prev: Information Example,  Up: Information

Options for Information
=======================

   When you invoke `ebzipinfo' with the `--subbook' option, `ebzipinfo'
outputs information about files of the specified subbooks only, in
addition with `LANGUAGE', `CATALOG' and `CATALOGS'.  *Note Partial
Compression::, for details about the `--subbook' option.

   `ebzipinfo' ignores the following options; `--force-overwrite',
`--keep', `--level', `--no-overwrite', `--output-directory', `--quiet',
`--silence', `--suffix' and `--test'.


File: ebzip.info,  Node: Delete a Book,  Next: Summary of Options,  Prev: Information,  Up: Top

Delete a Book
*************

   `ebzip' doesn't support deletion of a compressed book on a hard disk.
Please use the `rm' command, instead.

     % rm -r /dict

Please be careful in this operation.


File: ebzip.info,  Node: Summary of Options,  Next: Comparision Result,  Prev: Delete a Book,  Up: Top

Summary of `ebzip' Options
**************************

   The `ebzip' command supports both traditional single-letter options
and mnemonic long option names.  Long option names are indicated with
`--' instead of `-'.  Abbreviations for option names are allowed as
long as they are unique.

`-c CASE'
`--case CASE'
     Output files which have filenames with upper or lower CASE letters.
     CASE must be `upper' or `lower'.  When this option is not
     specified, the case of filenames of the output files comes to be
     the same as filenames of files in the input book.  This option is
     ignored when the action is information, or when you specify the
     `--test' (`-t') option.

     (*Note Adjust Filenames::, for more details).

`-f'
`--force-overwrite'
     Overwrite existed files without confirmation.  This option is
     ignored when the action is information, or when you specify the
     `--test' (`-t') option.

     (*Note Overwrite Old Files::, for more details).

`-h'
`--help'
     Output help message to standard out, then exit.

`-i'
`--information'
     Output compression status of the specified CD-ROM book.

     (*Note Information::, for more details).

`-k'
`--keep'
     Don't delete an input file when the corresponding output file has
     been written.  This option is ignored when the action is
     information, or when you specify the `--test' (`-t') option.

     (*Note Compression Example 2::, for more details).

`-l INTEGER'
`--level INTEGER'
     Specify compression level.  INTEGER must be `0', `1', `2' or `3'.
     The level 0 is fastest but least compression method.  The level 3
     is slowest but best compression method.  The defalt level is 0.
     This option is ignored when the action is uncompression or
     information.

     (*Note Compression Level::, for more details).

`-n'
`--no-overwrite'
     Skip existed files without confirmation for overwriting.  This
     option is ignored when the action is information, or when you
     specify the `--test' (`-t') option.

     (*Note Overwrite Old Files::, for more details).

`-o DIRECTORY'
`--output-directory DIRECTORY'
     Specify a directory of output files.  The default is the current
     directory (`.').  This option is ignored when the action is
     information, or when you specify the `--test' (`-t') option.

`-q'
`--quiet'
`--silence'
     Supress all information and warning messages.  However, when an
     output file has already exists, during compression/uncompresion,
     `ebzip' still asks you whether the output file may be overwritten
     or not.  To supress this question, specify the `--force-overwrite'
     (`-f') or `--no-overwrite' (`-n') option.  This option is ignored
     when the action is uncompression or information.

`-s SUFFIX'
`--suffix SUFFIX'
     Specify the suffix of filenames of output files.  SUFFIX must be
     `none', `dot', `version' or `both'.  When SUFFIX is `none', no
     suffix is appended.  When SUFFIX is `dot', a dot (`.') is appended.
     When SUFFIX is `version', a version number 1 (`;1') is appended.
     When SUFFIX is `both', dot and version number 1 (`.;1') is
     appended.  If this option is not specified, suffixes of filenames
     of the output files comes to be the same as filenames of files in
     the input book.  This option is ignored when the action is
     information, or when you specify the `--test' (`-t') option.

     (*Note Adjust Filenames::, for more details).

`-S SUBBOOKS'
`--subbook SUBBOOKS'
     Specify target subbooks to compress, uncompress or output
     information.  SUBBOOKS must be a list of directory names of
     subbooks separeted by a comma (`,').  By default, all subbooks are
     specified as target.

     (*Note Partial Compression::, for more details).

`-t'
`--test'
     Don't write compression/uncompression data to the actual files.
     This option is ignored when the action is information.

     (*Note Test::, for more details).

`-u'
`--uncompress'
     Uncompress a CD-ROM book.

     (*note Uncompression::, for more details).

`-v'
`--version'
     Output version number to standard out, then exit.

`-z'
`--compress'
     Compress a CD-ROM book.

     (*Note Compression::, for more details).


File: ebzip.info,  Node: Comparision Result,  Next: Compressed File Format,  Prev: Summary of Options,  Up: Top

Comparision of Compression Results
**********************************

   Compression result of the `START' file in a certain English-Japanese
and Japanese-English dictionary (EBXA):

compression level             file size              ratio
(original)                    154476544 bytes        100.0%
level 0                       54922039 bytes         35.6%
level 1                       49615791 bytes         32.1%
level 2                       45983464 bytes         29.8%
level 3                       43431397 bytes         28.1%
(reference: gzip -6)          38712247 bytes         25.0%

   Compression result of the `START' file in a certain English
dictionary (EBG):

compression level             file size              ratio
(original)                    55511040 bytes         100.0%
level 0                       25866491 bytes         46.6%
level 1                       24419066 bytes         44.0%
level 2                       23453212 bytes         42.2%
level 3                       22748840 bytes         41.0%
(reference: gzip -6)          20930009 bytes         37.7%

   Compression result of the `HONMON' file in a certain Japanese
dictionary (EPWING V1):

compression level             file size              ratio
(original)                    23642112 bytes         100.0%
level 0                       9927048 bytes          42.0%
level 1                       9213184 bytes          39.0%
level 2                       8767603 bytes          37.1%
level 3                       8495563 bytes          35.9%
(reference: gzip -6)          8114658 bytes          34.3%

   Compression result of the `HONMON2' file in a certain Japanese
dictionary (EPWING V5):

compression level             file size              ratio
(uncompressed)                220069888 bytes        100.0%
(original)                    149139690 bytes        67.8%
level 0                       82973263 bytes         37.7%
level 1                       78163751 bytes         35.5%


File: ebzip.info,  Node: Compressed File Format,  Prev: Comparision Result,  Up: Top

Compressed File Format
**********************

   This chapter explains details about compressed file format used by
`ebzip'.

* Menu:

* Format Overview::             Overview about Compression File Format
* Data Part::                   Data Part
* Index Part::                  Index Part
* Header Part::                 Header Part


File: ebzip.info,  Node: Format Overview,  Next: Data Part,  Prev: Compressed File Format,  Up: Compressed File Format

Overview about Compression File Format
======================================

   The compressed file format has the following features.

   * independent of CPU type, operating system, and file system.

   * loss-less compression.
     You can recover an original file by uncompressing the compressed
     file.

   * four compression levels.
     You can choose faster or better compression.

   A compressed file consists of header, index and data parts.  They
are placed in that order.

     +--------+-------------+-----------------------------+
     | header |    index    |            data             |
     +--------+-------------+-----------------------------+
                                                          EOF


File: ebzip.info,  Node: Data Part,  Next: Index Part,  Prev: Format Overview,  Up: Compressed File Format

Data Part
=========

   An orignal file is compressed by the following processes.

   At first, `ebzip' slices an original file.  Each "slice" except for
the last slice (slice N in the following picture) has the same size.

     +---------------+---------------+--   --+----------+
     |    slice 1    |    slice 2    |  ...  | slice N  |
     +---------------+---------------+--   --+----------+
                                                        EOF

Slice size is determined by the compression level (*note Compression
Level::, about compression level):

compression level                    slice size
0                                    2048 bytes
1                                    4096 bytes
2                                    8192 bytes
3                                    16384 bytes

Second, if the last slice is shorter than the slice size, `ebzip'
extends the last slice to the slice size by padding bytes of 0x00.

                                                         pad
     +---------------+---------------+--   --+---------+-----+
     |    slice 1    |    slice 2    |  ...  |    slice N    |
     +---------------+---------------+--   --+---------+-----+
                                                             EOF

Finally, `ebzip' compresses each slice into the DEFLATE compressed data
format, described in RFC 1951.  A slice is compressed independently of
another slice.  Usually, each compressed slice occupies different size.
If the number of bits of the compressed slice is not a multiple of 8, 1
to 7 bits are padded to the number of bits come to a multiple of 8 at
the tail of the compressed slice.  Thus, each compressed slice starts
at byte boundary.  The contents of the padded bits are undefined, but
the padded bits are never used.

     +------------+----------+--   --+--------------+
     | compressed |compressed|  ...  |  compressed  |
     |   slice 1  | slice 2  |  ...  |   slice N    |
     +------------+----------+--   --+--------------+

This is a "data part" of the compressed file format, which consists of
compressed slices.

   The padding in the last slice is compressed as a part of the slice.
When `ebunzip' recovers the last slice, it uncompresses the slice and
then remove the padding.

   When a compressed slice is larger than or equal to slice size,
`ebzip' discards the compressed data of the slice.  In this case,
`ebzip' records original data as the compressed data for that slice
instead.

   If an original file is empty, the data part is not appered in a
compressed file.


File: ebzip.info,  Node: Index Part,  Next: Header Part,  Prev: Data Part,  Up: Compressed File Format

Index Part
==========

   At compression, `ebzip' records an "index" for each compressed slice.
An index represents a distance betweeen the beginning of the compressed
file to the beginning of a compressed slice.  The unit of the distance
is byte.

     +---------+---------+--           --+---------+---------+
     | index 1 | index 2 |  ...........  | index N |index END|
     +---------+---------+--           --+---------+---------+
          |         |                        |         |
      +---+         +----+                   +------+  +-----------+
      V                  V                          V              V
     +------------------+------------------+--   --+--------------+
     |    compressed    |    compressed    |  ...  |  compressed  |
     |      slice 1     |     slice 2      |  ...  |   slice N    |
     +------------------+------------------+--   --+--------------+

Each index takes from 2 to 4 bytes, according with size of an original
file:

original file size                                 index size
0 ...      65535 bytes                             2 bytes
65535 ...   16777215 bytes                         3 bytes
16777216 ... 4294967295 bytes                      4 bytes

   All multi-byte numbers in the indexes stored with the most
significant byte first.  For example, 0x1234 is stored as follows.
First byte holds 0x12, and second byte holds 0x34.

     +---------+---------+
     |0001 0010|0011 1000|
     +---------+---------+
       (0x12)    (0x34)

   The index part begins with the index for the compressed slice 1, and
the index for the compressed slice 2 follows it.  The index for
compressed slice N is followed by the index for END; index for the next
byte of the end of the compressed slice N.  This index also represents
the size of the compressed file.

     +---------+---------+--       --+---------+---------+
     | index 1 | index 2 |  .......  | index N |index END|
     +---------+---------+--       --+---------+---------+

   If its size is equal to the slice size, the data of the slice is not
compressed accutually.

   If an original file is empty, the index part has only one index.
The index represents the size of the compressed file.


File: ebzip.info,  Node: Header Part,  Prev: Index Part,  Up: Compressed File Format

Header Part
===========

   A header part occupies 22 bytes.  It consists of the following
fields.

     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
     |   magic ID   |*1| *2  |    file size    | Adler-32  |   mtime   |
     +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
      0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21
     
     *1: zip mode and compression level
     *2: reserved area

`magic ID (5 bytes)'
     It has the fixed value; 0x45, 0x42, 0x5a, 0x69, 0x70 (`EBZip' in
     ASCII string).

`zip mode (4 bits of the most significant bit side)'
     This identifies the compression mode.  In EB Library version
     2.3.8, only 1 (0001 in binary digits) can be prescribed as this
     version.

`compression level (4 bits of the least-significant-bit side)'
     This identifies the compression level.

`reserved area (2 bytes)'
     Reserved but not used.  It is filled with 0x0000.

`file size (6 bytes)'
     This contains the size of the original (uncompressed) file.

`Adler-32 (4 bytes)'
     This is a checksum value of the uncompressed data computed
     according to Adler-32 algorithm described in RFC 1950.

`mtime (4 bytes)'
     This gives the most recent modification time of the original file.
     This value is the time in seconds since 00:00:00 GMT, Jan. 1, 1970.

   Both `zip mode' and `compression level' are packed into the 5th byte
in the header.  `zip mode' includes a most siginificant bit, and
`compression level' includes least-significant-bit.  If `zip mode' is 1
and `compression level' is 2, then 5th byte of the header is 0x12.

      MSB                         LSB
     +---+---+---+---+---+---+---+---+
     | 0   0   0   1   0   0   1   0 | = 0x12
     +---+---+---+---+---+---+---+---+
        (zip mode)   | (compression level)

   All multi-byte numbers in the header are stored with the most
significant byte first.



Tag Table:
Node: Top1034
Node: Introduction2779
Node: Action and Command Name4164
Node: Invoking ebzip5774
Node: Compression6545
Node: Compression Example 17202
Node: Compression Example 28782
Node: Compression Level10325
Node: Adjust Filenames10928
Node: Test12955
Node: Partial Compression13300
Node: Overwrite Old Files15903
Node: Compress Compressed EPWING16651
Node: Uncompression17150
Node: Uncompression Example17592
Node: Options for Uncompression19149
Node: Uncompress Compressed EPWING20657
Node: Information21159
Node: Information Example21546
Node: Options for Information22198
Node: Delete a Book22787
Node: Summary of Options23085
Node: Comparision Result27433
Node: Compressed File Format29537
Node: Format Overview29962
Node: Data Part30818
Node: Index Part33484
Node: Header Part35811

End Tag Table
