home *** CD-ROM | disk | FTP | other *** search
/ Software Recommendations - 1998 Season 1 / DNBCD4.iso / share / compress / carcom11 / CAR.DOC < prev    next >
Encoding:
Text File  |  1994-11-11  |  42.3 KB  |  870 lines

  1. WARRANTY
  2. -------
  3.  
  4. This is a free evaluation copy of the programs subsequently described.
  5. As such no warranty is offered against the programs and/or associates
  6. contained within this package.  You are free to copy and share/distribute 
  7. copies of this package provided you do not modify any of the files.  No 
  8. liability will be accepted for any damage or losses arising out of the 
  9. direct, or indirect usage or inability to use all or any parts of this 
  10. package.  The programs included should be considered as beta evaluate/test 
  11. only.  Being intended purely as introductory and widely distributed, this
  12. package will not be maintained/updated against any bugs/defects etc. that
  13. may exists.  For the latest copies of the programs and documentation 
  14. you should contact the package author (see Register.doc).
  15.  
  16. If you intend to use any of the programs within this package beyond a 
  17. reasonable evaluation trial period, you MUST register your intent with the 
  18. package author.  Such registering will ensure you receive the full source 
  19. code in order that you might ensure the program(s) are fit for your own 
  20. particular purpose or can be suitably modified for such, thereby in effect
  21. creating your own warranty/maintenance agreement.  Registering will 
  22. additionally ensure that you are kept aware of any upgrades, bugs or
  23. improvements that may occur.  A reasonable period for evaluating the 
  24. programs within this package is considered to be around one calendar month.
  25.  
  26.  
  27. All trademarks mentioned within this package are recognised to their
  28. respective holders.
  29.  
  30.  
  31. CONTACT
  32. -------
  33.  
  34.         Compuserve (CIS)  100014,3141
  35.         Fido              2:254/151.3 or 2:254/152.3
  36.         Postal            CarComp
  37.                           c/o 111 Deer Park Gardens, Mitcham
  38.                           Surrey. CR4 4DX.  England
  39.                                                    
  40.  
  41. INTRODUCTION
  42. ------------
  43.  
  44. Cross system integration within computing is increasingly becoming an
  45. important part within the home, small and corporate business operational
  46. environments.
  47.  
  48. This package contains evaluation copies of the executables for the CAR, 
  49. GZIP, ATOB, BTOA, UNIX2DOS, DOS2UNIX, SPLT and JN tools for use under DOS 
  50. and SUN OS 5.0 systems that may be of some benefit for such cross systems
  51. working.  
  52.  
  53. In order to limit the size of the evaluation package to an acceptable 
  54. level such that transmission times/costs via modem link distributions is
  55. kept at a minimum, no source code has been included within this package.  
  56. Having tried out the executable versions however, if you believe that the
  57. utilities may be of benefit to you, then you can register your interest
  58. via our service desk which will result in your receiving the full source
  59. code (portable C) so that you might tailor the tools to your own particular 
  60. requirements.
  61.  
  62. Using the tools within this package, it is possible to compress files to 
  63. levels that are often better than that of other commonly available 
  64. archivers/compressors whilst being able to share such files independently 
  65. of system architecture.
  66.  
  67.  
  68. In brief, there are several tools included within this package:
  69.  
  70.         CAR      - Compressed file archiver (enables storing of multiple
  71.                    compressed, standard or mixed files into a single hold 
  72.                    file).
  73.         GZIP     - Compressor/Decompressor distributed under the GNU
  74.                    General Public licensing terms and conditions. Provided
  75.                    by Jean-loup Gailly and Mark Adler.
  76.                    Caters for compressed files in Compress, pack or gzip
  77.                    formats and is currently the defacto for the Linux
  78.                    operating system.
  79.         BTOA     - Converts binary files to ASCII format files so that 
  80.                    binaries might be transmitted via textual services.
  81.         ATOB     - Restores BTOA files (ASCII) back to the original binary
  82.                    format.
  83.         UNIX2DOS - Converts UNIX text file formats to DOS 
  84.         DOS2UNIX - Converts DOS text file formats to UNIX.
  85.         SPLT     - Splits a data stream into one or more files of a 
  86.                    specified size.
  87.         JN       - Recreates a stream from SPLIT files.
  88.  
  89.  
  90. Combined, these tools enable you to perform compressed file exchange
  91. across multiple system architecture.  For example a file or group of
  92. files may be compressed and archived into a single hold file (archive) on 
  93. one system (e.g. UNIX) and then transported (e.g. via modem link, floppy 
  94. copies etc.) to another system (such as a DOS based PC) where the original 
  95. file(s) can be restored.  Although only DOS and Sun example executables
  96. have been included within this package, this does not mean that the tools 
  97. are restricted purely to these platforms; In practice, the tools may be used 
  98. on practically any system that has access to a suitable C compiler.  All of 
  99. the source code for the tools (portable C code) is available via the package 
  100. author.
  101.  
  102. Throughout this document it is assumed that you are already familiar with 
  103. one or more of the compression/archive programs that are currently around 
  104. (typical programs being Compress, Pack, PKZIP, LHA, ARJ etc.).
  105.  
  106.  
  107. CAR/GZIP
  108. --------                           
  109.  
  110. The gzip compressor provided within this package can automatically handle the 
  111. decompression of several formats of previously compressed files, namely :-
  112.  
  113.                         compress, pack, gzip
  114.  
  115. So as an example, you might collect a number of files into a common 
  116. archive (hold) file on a Unix platform using the car tool, and compress
  117. this archive using either the Unix compress, pack or the supplied gzip
  118. tool in readiness for sending the compressed file to another system
  119. such as a DOS based system.  On the DOS system, it is then possible to  
  120. simply uncompress the archive hold file using gzip and extract the
  121. individual files using the car x function. gzip is capable of automatically
  122. detecting the compression method used (compress, pack or gzip) in order to 
  123. correctly decompress the file.  Naturally though, binary files under Unix
  124. cannot be expected to work under DOS and visa-versa.
  125.  
  126. For compression, a derivative of the LZ77 and Huffmans coding methods
  127. are utilised, thereby being free of current patent restrictions (of which
  128. other programs such as the standard UNIX compress may currently infringe).
  129.  
  130. gzip will only compress to its own gzip format, so if you intend to say
  131. receive and send files to and from a UNIX/DOS environment then ideally
  132. you should have a copy of gzip on both systems.  If you are however only
  133. sending files from say Unix to DOS, then you'd only need to have a copy
  134. of gzip on the DOS system which could be used in order to uncompress files
  135. that were compressed on the Unix machine using 'compress'.
  136.  
  137. It should be noted that the gzip program is NOT the package authors own
  138. work but is provided within the CarComp package purely to relieve the need 
  139. of having to acquire the executable from alternative sources.  Further 
  140. details with regard to gzip can be obtained from the package author if 
  141. required.
  142.  
  143. The Compressed file Archiver tool (CAR) caters for storage and retrieval of 
  144. files into a single hold file in a system independent manner.  This is aided 
  145. by the packages ability to convert such files as text from UNIX format to 
  146. DOS and visa-versa. CAR is not reliant purely on using gzip as its associated 
  147. compressor. In practice, almost any compressor of your choosing should also 
  148. work with CAR.  gzip was selected purely as a result of the availability
  149. of its source code, together with its abilities to handle multiple
  150. compression techniques that, in my opinion, will make it a very strong 
  151. contender as a future 'most popular' compressor choice.
  152.  
  153. Unlike many other archive programs where the archiver and compressor
  154. are contained within a single unit, this package provides two separate
  155. files for such functions.  CAR (compressed archiver) deals purely with
  156. storing of file(s) into a single hold file, whilst gzip deals purely with
  157. compression.  Several advantages in using such separate files are
  158. apparent; Firstly, tighter overall compression can be achieved when a number 
  159. of files are to be compressed into a single archive.  Secondly, by keeping 
  160. the compressor separate, such functionality as manipulating files in a 
  161. compressed format becomes much easier.  For example, assuming we have a file 
  162. containing a list of names and telephone numbers that have been compressed to 
  163. a gzip file, then such commands as
  164.  
  165.         gzip -dc <telnos.gz | sort | gzip >t_sorted.gz 
  166.  
  167. can be used.  (Effectively sorts the compressed telnos.gz file into 
  168. a new file called t_sorted.gz).
  169.  
  170. Such capabilities are even more apparent under UNIX systems where highly 
  171. complex manipulation tasks can be achieved using gzip in combination with 
  172. the likes of Bourne/C Shell, awk etc. statements.  In total, the package 
  173. enables a much higher degree of general flexibility of storing, 
  174. manipulating and sharing compressed files.
  175.  
  176. This package is by no means intended to be a replacement to your current
  177. most favoured archiver program, but more as a complement.  It is ideally
  178. suited for use with the likes of BBS sysops who may prefer the flexibility
  179. and higher compression levels capable during such data exchanges as 
  180. Echo/NetMail etc. where, in some cases of a BBS with a large nightly data
  181. exchange, hours can be knocked off the transfer time/user lock out over the 
  182. course of a year, whilst also opening up the board to cater for other 
  183. platforms to connect and exchange mail automatically using the common 
  184. compression and archive/storage technique.  Typically you could expect to 
  185. see around a 5-10% smaller file than that of using say PKZIP in collecting
  186. and batching mail packets using the standard file archive add option.  
  187. For larger BBS's with many echo areas, the potential savings even over a 
  188. week can therefore be quite substantial.
  189.  
  190.  
  191. This package is ideal for developers who wish to include data compression
  192. functions into their package(s) or anyone who may wish to generally 
  193. share files in a compressed format with others.  Or for anyone who may be 
  194. interested in compression and archive program coding in general.
  195.  
  196.  
  197.                         Compression Levels
  198.                         ------------------
  199.  
  200. Generally, usage of the files within this package will show at least 
  201. comparable compression levels to that of many of the other currently 
  202. available compressors/archivers around at the current date.
  203.  
  204. A suggested test is to select all of the files in any directory of your
  205. choosing and try archiving all of those files within that directory into a 
  206. single archive hold file using your currently preferred compressor.  Then 
  207. repeat this using the tools provided in this package.  
  208.  
  209. As a guideline, we performed such a test on a randomly selected directory.
  210. We logged into a local BBS and acquired copies of the following programs
  211. and applied a compress/archive time/size trial.  Our randomly selected
  212. directory turned out to be that of the UC compression program.  The 
  213. following is the results of that test:-
  214.  
  215. PROGRAM         FLAGS   START TIME      END TIME        SIZE    
  216. -------         -----   ----------      --------        ----
  217.  
  218. CAR/GZIP        -9      11:39:27.91     11:40:49.96     269,810
  219. HAP3                    11:41:49.67     11:47:57.28     292,498
  220. UC2                     11:48:57.04     11:51:34.13     262,698
  221. PKZIP (2.04g)   -ex     11:52:35.43     11:53:10.30     295,620
  222. SQZ                     11:54:20.72     11:55:18.45     292,530
  223. ZOO                     11:56:12.11     11:57:55.92     331,543
  224. ARJ                     12:02:20.33     12:03:17.45     294,341
  225. LHA                     12:07:15.50     12:08:09.98     294,255
  226. HPACK                   12:03:56:17     12:06:40.24     297,298
  227.  
  228. (Original directory contained 52 mixed files totalling 439,247 bytes.)
  229.  
  230. Applying weights to the results yields:
  231.  
  232.                                    OVERALL 
  233. PROGRAM         TIME    SIZE       WEIGHT
  234. -------         ----    ----       ------
  235. CAR/GZIP         5th     2nd          7
  236. HAP3             9th     3rd         12
  237. UC               7th     1st          8
  238. PKZIP            1st     7th          8
  239. SQZ              4th     4th          8
  240. ZOO              6th     9th         15
  241. ARJ              3rd     6th          9
  242. LHA              2nd     5th          7
  243. HPACK            8th     8th         16
  244.  
  245.  
  246. Combining the weights, it can be seen that overall CAR/GZIP and LHA share 
  247. joint 1st for compression rates/times
  248.  
  249. UC2, ZIP and SQZ share joint 2nd
  250.  
  251. ARJ 3rd etc.
  252.  
  253. The test was performed on an old 12MHz 286 with each run being performed 
  254. under similar disk space/machine resources.
  255.  
  256. You might notice that the UC program was the only one to better the gzip/car 
  257. combination on compression.  However in contrast UC's compression rate turned 
  258. out to be around 5 times slower than that of the likes of PKZIP.  
  259. Additionally we're comparing an unoptimized version of CAR/GZIP here with the 
  260. likes of highly optimised versions of PKZIP etc.  In general then it seems 
  261. reasonable to assume that an optimised version of car/gzip would therefore
  262. come out as the overall winner for general compression.
  263.  
  264. Naturally these figures are by no means intended to be definitive, and 
  265. are provided purely as a general example of car/gzip's performance.  
  266. Every compressor/archiver package around has its own unique benefits/costs.
  267. However for general use, we hope we have indicated how car/gzip may be
  268. of benefit to you.  Especially in its ability to compress down by around
  269. 10% more than that of some of the other more commonly used compressors.
  270. Combined with gzips ability to handle piping and redirection etc in order
  271. to manipulate data streams using compression, overall we believe that the
  272. tools included within this package are valuable additions to most set-ups.
  273.  
  274.                                 
  275. BTOA/ATOB
  276. ---------
  277.  
  278. BTOA and ATOB are provided in order that binary format files, such as a
  279. compressed file, may be converted to a format that is suitable for 
  280. transmission via textual services (such as via mail), and restored again
  281. at the receiving end.  Warning! Both of these tools will OVERWRITE the
  282. output file without pre-warning!
  283.  
  284.  
  285. UNIX2DOS/DOS2UNIX
  286. -----------------
  287.  
  288. These utilities enable you to convert text files from one format to another.
  289. Simply, they strip the Carriage returns off DOS text files that are bound
  290. for a Unix system or insert such in the opposite direction.  As per the
  291. above, both unix2dos and dos2unix will overwrite redirected outputs 
  292. without any pre-warnings.
  293.  
  294.  
  295. SPLT/JN
  296. -------
  297.  
  298. Split and Join are useful for where you may have a largish distribution
  299. that may require say two or more floppies/CDROMS etc.
  300.  
  301. Splt requires at least two command line parameters, a size in (multilples
  302. of 100KB's) and a filename prefix (no extension).  It then reads from 
  303. standard input or from the named file (3rd command line variable) and writes 
  304. to a file named <prefix>.1 until the size parameter bytes is met.  It then 
  305. starts to write subsequent data to the file <prefix.2> etc.  Thus a large 
  306. continuous file of say 6MB that is in either binary or text form, can be 
  307. easily split over several files of a size that is useful for say floppy disk 
  308. transfer.
  309.  
  310. Join (JN) takes either a single or dual command line parameter(s), that of 
  311. the prefix used for the split and/or a second paramenter for an output 
  312. filename (standard out is used when not specified) and rejoins the data as 
  313. prior to the 'split'.
  314.  
  315. For an example of using split and join, see the USING section below.
  316.  
  317.  
  318. PACKAGE FILE CONTENT
  319. --------------------
  320.  
  321.         file_id.diz     File Description
  322.         register.doc    Registration form
  323.         car.doc         Main documentation
  324.         gnu.doc         GNU General Public License covering gzip/gzip.exe
  325.         gzip.exe        DOS executable compressor/decompressor
  326.         car.exe         DOS executable archiver
  327.         btoa.exe        DOS executable 'convert binary to ascii'
  328.         atob.exe        DOS executable 'restore ascc to binary'
  329.         unix2dos.exe    DOS executable for text file conversion (Unix to Dos)
  330.         dos2unix.exe    DOS executable for text file conversion (Dos to Unix)
  331.         splt.exe        DOS executable for split
  332.         jn.exe          DOS executable for join
  333.         gzip            SUN OS 5.0 executable compressor/decompressor
  334.         car             SUN OS 5.0 executable archiver.
  335.         btoa            SUN OS 5.0 executable binary to ascii 
  336.         atob            SUN OS 5.0 executable ascii to binary
  337.         unix2dos        SUN OS 5.0 executable unix2dos
  338.         dos2unix        SUN OS 5.0 executable dos2unix
  339.         splt            SUN OS 5.0 executable for split
  340.         jn              SUN OS 5.0 executable for join
  341.                                    
  342.  
  343. INSTALLING
  344. ----------
  345.  
  346. It is recommended that you install the files provided with the package into 
  347. a common directory that is pointed to within your PATH statement.  
  348.  
  349. *** WARNING *** 
  350.  
  351. Under Unix systems, you should be careful not to overwrite any other 
  352. programs of the same name (e.g. atob, btoa, unix2dos, dos2unix, jn 
  353. etc.)  If necessary, rename the functions as desired.
  354.  
  355.  
  356. USING
  357. -----
  358.  
  359. *** CAR (Compressed file archiver), works along similar lines to the Unix
  360. Tape Archiver (tar).  Use the command 'car' alone to see the available 
  361. options.  Note that CAR can be set to store files either with or without CRC 
  362. checking (much faster without). When such CRC checking is enabled, both the 
  363. header and data content will have a CRC maintained.  In general, subsequent 
  364. usage of the gzip program (which in itself maintains a CRC check) should mean 
  365. that the use of CAR's CRC checking should only be required when very tight 
  366. data integrity/checking is required.  I would therefore recommend usage of 
  367. the 'car a ....' option more than that of the 'car s.....' option.
  368.  
  369. CAR enables you to store multiple files into a single hold file.  It is
  370. anticipated that you will CAR the relevant files into a single hold file
  371. prior to using gzip against that car file.  This is the method that ensures
  372. greater compression over that of other archive programs.  It is commonly
  373. known that LZSS compressors start off compression poorly due to the lack
  374. of pre-loaded information to compare against.  By storing all of the 
  375. uncompressed files within a single hold file (such as a .car file), then
  376. effectively the number of occurrences of 'poor' starts is reduced to only
  377. one compared to that of other archive programs that compress/add each 
  378. individual file to the archive (e.g. 100 of such archived files would have 
  379. 100 poor starts).  
  380.  
  381. The downside of using the CAR files, compress CAR file method, is that
  382. individual files within the archive cannot be easily maintained as is 
  383. possible with some other archivers.  However for such cases as where
  384. an group of archived files is intended to be manipulated as a whole, then
  385. the method can pay dividends.   Additionally, there is nothing to stop 
  386. you from employing a gzip file, car, gzip, car approach in order to
  387. enable files to be maintained more individually.  Alternatively given the
  388. source code, you might code a new version along the lines of that as 
  389. outlined in the 'Improvements' section of this document (see later). 
  390. If you do maintain individually compressed files within a car file, then
  391. remember you could use a command such as
  392.  
  393.                 car p myarc compfile | gzip -d 
  394.  
  395. in order to view the compressed file compfile contained within mycar.car.
  396. Or even
  397.                 car p mycar compfile | gzip -d >restored.fil
  398.  
  399.  
  400. One other additional limitation in the car program is that it only stores 
  401. filenames, not pathnames. The benefit from such however is that files car'd 
  402. on say a Unix system can equally be extracted on say a DOS system without 
  403. concern of pathname limitations (provided you store such files using a 
  404. maximum filename of the 8.3 format as used under DOS).  Again, given the 
  405. source code, you might prefer to adapt the car code in order to cater for 
  406. pathnames etc. if so required by your own particular circumstances.
  407.  
  408. The car all files, gzip single car file approach will produce tighter
  409. compression levels when files of a similar type are stored sequentially
  410. together.  Thus if you intend to archive a complete directory, it is 
  411. more preferable to say  car a arcfile *.doc,   car a arcfile *.exe etc
  412. rather than adopting a   car a arcfile *.*   approach where the sequence
  413. of storage may result in something like File 1. a.doc, 2. b.exe, 3. c.exe,  
  414. 4. d.doc,.. etc  (e.g. 1. a.doc, 2. d.doc, 3. b.exe, 4. c.exe is more 
  415. preferable).
  416.                                   
  417. One area you should be aware of is that under UNIX, car is set to only store 
  418. files of Regular, block or character type files.  Directory, FIFO/Pipe, Link 
  419. etc. type files are skipped.
  420.  
  421. An interesting side use of CAR is as a disk defragmentor tool.  Simply
  422. by archiving all files within a directory to a CAR file using the move
  423. option (car m c:\workdir) followed by a car x to restore those files
  424. will result in the possible reduction of fragmented files within that
  425. directory. 
  426.  
  427. CAR currently caters for the following options
  428.  
  429. R - Replaces attempts to replace all of the files in the archive with a 
  430.     version within the current directory.  If a given file in not available,
  431.     then that files replacement is skipped.
  432.  
  433. M - Move moves a files from disk into the archive.  A data content CRC and 
  434.     header check CRC are attached.
  435.  
  436. S - Similar to the move option but leaves the original file intact on disk. 
  437.  
  438. A - Add is similar to the S option with the exception that no data CRC 
  439.     is stored.  Not having to calculate CRC data significantly improves
  440.     overall storage run times.
  441.  
  442. D - Deletes a file from the archive.
  443.  
  444. L - List archives contents
  445.  
  446. V - As per the list option (compatibility)
  447.  
  448. T - Tests the files in the archive where a CRC is included (files stored
  449.     with the Move or Store methods).
  450.  
  451. X - Extracts file(s) from the archive
  452.  
  453. P - Print the content of a file within the archive.
  454.  
  455.  
  456. Note: Wildcards are permissible with the options e.g.
  457.  
  458.                 car a myarc \dos\mydir\*.*
  459.  
  460. will stores all of the files in the \dos\mydir directory to the archive
  461. files myarc.car.
  462.  
  463. Individual files may be named for selected options e.g. car x myarc myfile
  464. will extract the single file (if exists) called myfile from the archive
  465. file myarc.car
  466.               
  467. When creating an archive, a default extension of .CAR is used unless another
  468. value is specified.
  469.  
  470. CAR performs no filename validation, so if you intend to transfer files from
  471. say a Unix system that can cater for long filenames, then you should
  472. endevour to rename the files to a naming format that is suitable for the 
  473. lowest common denominator filename maximum size for which system(s) you wish 
  474. to share such files with.  Typically this will be the DOS 8.3 format e.g.
  475. If you have a file called this.is.my.text.file on a Unix system and you want 
  476. to  use CAR to transfer this file to a DOS system, then you should rename the
  477. file to something like myfile.txt prior before adding the file to the CAR 
  478. archive.
  479.  
  480. If disk space is at a low level, you may also find that you may have to
  481. 'move' a few files at a time into an archive as during the archive process,
  482. the system may have to be handling up to three copies of the actual files
  483. being added to the archive (original, temporary and archive versions).
  484.  
  485.  
  486.                         *********************
  487.                         
  488.  
  489. *** GZIP the compressor/decompressor, caters for INDIVIDUAL file compression
  490. only.  As previously mentioned it can automatically decompress files
  491. that have been compressed using compress, pack and (of course) gzip.  
  492. It is a commonly used version within the Linux world and is free of any 
  493. current patent restrictions.  To gain an insight into gzip's functions use 
  494. the command gzip -h.  gzip can cater for stream redirection or pipe 
  495. filtering.  
  496.  
  497.  
  498. For tightest compression (slowest), use 
  499.  
  500.                 gzip -9 <filename>
  501.  
  502. For quickest compression (fastest) use 
  503.                 
  504.                 gzip -1 <filename>
  505.  
  506. To decompress files use gzip -d <compressed_file>
  507. where compressed files may be any of a previously compressed, packed or
  508. gzip'd file.
  509.             
  510. As previously mentioned, when a group of files are to be compressed to
  511. a single archive file, the benefits of first storing all of the files
  512. into a single hold file and then compressing this hold file can often
  513. produce much tighter compression levels than that of compressing each
  514. file individually to a common hold file.  In practice you'll probably   
  515. find that the compression levels when using this approach nears or exceeds 
  516. that of the best of the commonly available compressors currently around. 
  517. Often in much quicker compression times too!
  518.                         
  519.  
  520.                         *********************
  521.                         
  522.  
  523. *** BTOA/ATOB - Convert Binary to ASCII, Convert ASCII to Binary are similar
  524. to the atob and btoa programs that you may be familiar with.
  525.                                                              
  526. They simply enable you to convert a binary file such as a compressed file
  527. into a pure ASCII file (but larger in size) using the BTOA tool so that the 
  528. resulting ASCII file may be effectively transmitted via a text only service 
  529. and suitable restored at the recipient end using the ATOB tool.
  530.  
  531. Both work on standard input and output redirection.  A typical usage might
  532. be if you wish to send an executable (binary) file to a colleague via 
  533. Netmail.  Say the exe file was called myexec.exe, then a typical preparation
  534. would be
  535.                 gzip myexec.exe | btoa >myexec.bta
  536.                               OR
  537.                 gzip myexec.exe
  538.                 btoa <myexec.exz >myexec.bta
  539.                 (myexec.exz being the output filename from the gzip).
  540.  
  541.                 The pure text file 'myexec.bta' could then be Netmailed
  542.                 as required and all the recipient would have to do is
  543.  
  544.                 atob <myexec.bta >myexec.exz
  545.                 gzip -d myexec.exz
  546.                                 OR
  547.                 atob <myexec.bta | gzip -d >myexec.exe
  548.  
  549.  
  550.                         *********************
  551.                         
  552.  
  553. *** DOS2UNIX/UNIX2DOS
  554.  
  555. Both of these utilities take the form of a redirected or piped input 
  556. and output e.g. unix2dos <unixfile >dosfile.
  557. Both expect the input file to be of a textual format.  The only conversion 
  558. performed in to strip or insert carriage returns as required.  Thus if you 
  559. create a file containing textual information such as a Comma Separated Values 
  560. file of say names and addresses called adds.txt under a Unix system, and you 
  561. know that this file is bound for a DOS based system then a command something
  562. like
  563.  
  564.                 unix2dos <adds.txt >addsdos.txt  (under DOS)
  565.  
  566.  
  567. will ensure that the file is in the correct format for reading by the
  568. recipient.
  569.  
  570.  
  571. Note under Unix (SUN), the command syntax is 
  572.  
  573.                 unix2dos infile outfile  OR
  574.                 unix2dos infile >outfile
  575.  
  576. Similarily dos2unix syntax is
  577.  
  578.         DOS             dos2unix <infile >outfile
  579.         SUN/UNIX        dos2unix infile outfile 
  580.                     or  dos2unix infile >outfile
  581.                                                       
  582.  
  583.                         *********************
  584.  
  585.  
  586. *** SPLT/JN
  587.  
  588. Lets say we have a directory that contains 100 files, each of 100 KB (10 MB
  589. in total).  Lets also say that these represent a distribution that you wish
  590. to share with a colleague via a floppy disk posting.
  591.  
  592. We can car the files using a command like car a forbob c:\thedir\*.* which
  593. will archive the contents of c:\thedir into a newly created forbob.car
  594. file.  We can then compress this file using a command such as 
  595. gzip forbob.car, thereby creating a file called forbob.caz.  Lets assume
  596. the gzip compressed the files down to around 50% of its original size, thus
  597. we have a single file of around 5MB that is almost ready for transfer.
  598. In order to put this file on floppies we can use a command such as
  599.                                                                
  600.                           splt 13 bob forbob.caz
  601.                      OR   splt 13 bob <forbob.caz
  602.                      OR   type forbob.caz | splt 13 bob 
  603.  
  604. What this does is to split the data stream (a redirection from 'forbob.caz')
  605. into several sequential files named bob.1, bob.2, bob.3 etc, where the 
  606. split occurs at 1300 (KB) (being a suitable size in this case for copying
  607. onto 1.4 MB floppies).
  608.  
  609. In our example we will now have files bob.1 to bob.5 that can be copied onto
  610. 5 different floppy disks and posted off to Bob.
  611.  
  612. When Bob receives these floppies, all he has to do is to copy the floppies
  613. onto his hard disk and use a join command such as
  614.  
  615.                         jn bob >forbob.caz
  616.                      OR jn bob forbob.caz
  617.  
  618. Note no filename suffix is include as jn automatically assumes suffices
  619. of .1, .2 etc.  
  620.  
  621. This will take each of the bob.1 to .5 files and recreate a single file of
  622. around 5MB.  He can then gzip -d the file in order to extract the car
  623. file, and then unarchive the 100 individual files to the required directory
  624. using car x forbob.
  625.  
  626. Note how the usage of splt and jn maximised usage of the floppy disks to
  627. their full capacity.  There was no need to concern ourselves with what 
  628. files should be copied onto which floppy in order to be able to send the
  629. files on the fewest number of floppy disks as possible.  
  630.  
  631. This potential makes split and join ideal utilities for developers or 
  632. anyone who may wish to share data/files with others via floppy, CDROM, 
  633. tape etc. medium.
  634.  
  635. As an example, I archived a directory containing over 34MB of comma
  636. seperated file format data on a Sun system into a single car file.  This was 
  637. then  compressed using the standard Unix compress down to a level of 
  638. around 2.6MB.  I then the used splt tool in order to split this compressed 
  639. archive file down onto two floppy disks using something like 
  640. splt 1380 myfiles <arcfile.caZ.  The whole process took literally only 
  641. a few minutes to perform.  Not bad considering the original 34 MB could  
  642. then subsequently be transferred to another platform such as a DOS based
  643. system and equally restored using the gzip/car combination (also possibly 
  644. having to use unix2dos).  
  645.  
  646. One thing to bear in mind when using splt and jn with floppy disks is that
  647. ideally you should try not to specify exactly 1.4 MB split file sizes as
  648. some floppies may have bad sectors which in practice would reduce the 
  649. amount of available space on that floppy.  If your split files were exactly
  650. 1.4MB in size, then obviously you wouldn't be able to copy such split
  651. files onto a floppy with minor disk defects.  Hence the usage of 1.3MB
  652. as in the above example.
  653.                         
  654.  
  655. BUILDING PACKAGES
  656. -----------------
  657.  
  658. With the additional flexibility offered in using the CarComp programs, you
  659. also have the addition of extra responsibilities to whom ever you might
  660. share such compressed archived files with.  Typically if you are building
  661. a package of several programs and documents into a single distribution
  662. file, then you might like to consider using batch/script files in order
  663. to prepare such a release.  Such an approach ultimately simplifies matters
  664. should you ever wish to add or modify any of the files and then rebuild the
  665. distribution copy.  Similarly, you might like to consider including a batch
  666. or script file within your distribution that aids in extracting the files
  667. to the relevant intended destination areas.
  668.  
  669. As an example, lets say we have an executable program that runs on both
  670. Unix and DOS systems (one executable for each system) and a single common
  671. manual document.  To this you might add a file description and a short
  672. introductory readme file.  One method to create a suitable archive would
  673. be to initially add both of the executables and the document file.
  674. You might then create a script file for the Unix executable installation
  675. and a .bat file for the DOS installation.  These batch/script files would
  676. include commands in order to extract and uncompress the relevant files
  677. from the overall hold file as well as any other general installation tasks
  678. as required by your program.  Finally you could then car all of the files
  679. into a single car archive file and compress this in readiness for 
  680. distribution. 
  681.  
  682. Any recipients would then simply identify the car/archive by its common
  683. .caz extension (as per .taz, .zip etc) and could then decompress this
  684. and apply the car l option, probably followed by a 'car p readme' command,  
  685. in order to view the conents of the pacakge.  The readme file would   
  686. provide the recipient with an overview of the package and advise of how
  687. to install such for their system (e.g. via the .bat of script file).
  688.  
  689. Quite a similar approach to how existing packages are created really!  But
  690. with the additional bonus of using up to 10% less disk space or modem
  691. transmission times.  
  692.  
  693. For larger package distributions, the additional benefits of using the
  694. split function against such a distribution comes into its own.  You can 
  695. simply create a highly compressed copy of all of the files within a single
  696. archive, and split this into sizes that would be best accomodated on say
  697. floppy disks.  Each part can then be labelled as such for general 
  698. distribution.  All without needing to concern youself with which files to
  699. place into which archive in order to mimimise the number of floppy disks
  700. required in order to distribute the package.
  701.  
  702. An alternative to the above however, is to design your own custom archived
  703. distribution using the source code provided with CarComp.  Making the 
  704. potential to provide highly professional in appearance installation
  705. programs without the concern of someone elses copyright/advertisment
  706. poping up during the installation process.
  707.                                             
  708.  
  709. REGISTERING
  710. -----------
  711.                                                       
  712. If you like any or all of the programs within this package then if you 
  713. register the package, you will be sent the full source code of the latest 
  714. available copies of the programs.  Details of registration are provided in 
  715. register.doc.  Additionally you will be advised of any bugs, improvements,
  716. additional functions etc. as and when they become available.
  717.  
  718.  
  719. SOURCE CODE
  720. -----------
  721.  
  722. All source has been written in portable C and can be compiled under many
  723. platforms/compilers.  The code is in almost all cases in pure C only to
  724. alleviate the necessity of having a low level, machine specific, assembler 
  725. compiler for compilation purposes.  As such, the performance of the example 
  726. programs can be significantly enhanced for more specific local requirements 
  727. under specific platforms, if so required, by adapting the source code to 
  728. your own particular needs such as replacing selected functions with assembler
  729. functions.  Some assembler routines are included within the source listing 
  730. for the more critical functions in order that you might link these in if 
  731. desired.
  732.  
  733.  
  734. IMPROVEMENTS
  735. ------------
  736.  
  737. This section is aimed at those who may already be familiar with compression
  738. algorithm coding and those of you who might be considering modifying the
  739. source code of car/gzip in order to adapt/improve such code for your
  740. own particular requirements.  It principally outlines how the source might 
  741. be used/modified in order to provide a functionally comparable program to 
  742. that of the more generally used compressors/archivers, whilst maintaining
  743. the 'bit extra' compression levels.
  744.  
  745. As previously mentioned, the car all uncompressed files to a single file
  746. and gzip'ing the resulting file generally leads to tighter compression 
  747. levels than that of other techniques. 
  748.  
  749. LZSS compression basically maintains a window of previously seen values
  750. (bytes) and a look ahead window.  The algorithm effectively compares 
  751. byte sequences within the look ahead window with that of the previously
  752. seen window and, when a match is found, encodes those bytes in the look
  753. ahead with a pointer to the occurrence within the previously seen window
  754. together with a 'length' count.  e.g. if a 16 bit pointer and 8 bit length 
  755. values are assigned, then the previously seen window would be 16384 bytes 
  756. and the maximum length range would be 256 bytes.  Thus if say a sequence of 
  757. 20 bytes in the look ahead match that of the bytes within the previously
  758. seen window at location 4567, then that byte sequence would be stored
  759. as something like 4567 020 (3 bytes in effect coding 20 bytes).  The break 
  760. even for these match position/length group (24 bits) is 3 bytes.  If 
  761. therefore no matches of 3 bytes or more are found for a particular instance, 
  762. then the bytes are output as is.  (I've omitted the description of overhead 
  763. bits and the usual adoption of Huffmans post process encoding, block 
  764. compression levels checks etc.).
  765.  
  766. The problem with this method is that at first, the previously seen window
  767. is effectively initialised as all nulls.  Thus the method tends to start
  768. off encoding poorly.  If however, the previously seen window was to be  
  769. initially pre-loaded in a set manner with some fixed data, then obviously
  770. this would improve upon the prospects of being able to encode byte groups
  771. at an early stage.  The problem here though is what data values to use
  772. for such fixed pre-loading.  
  773.  
  774. The simple method as suggested with the car/gzip approach is to effectively
  775. use the data from the tail end of the previous file.  And this works 
  776. relatively well as you will see if you make a few tests of the compression
  777. provided by car/gzip (especially if you order the storing of the files into
  778. the car file by file type e.g. docs, exe's etc.).  However the downside is 
  779. that this does restrict the extraction of individual files.
  780.  
  781. A suggested alternative would be to change the code to something like the
  782. following approach:-
  783.  
  784. gzip and add to the car file the first file.
  785. gzip the next file using the x number of decompressed bytes from the tail 
  786. end of the first file as the pre-load 'previously seen window' data for this 
  787. second file (where x corresponds to the size assigned to the previously
  788. seen window (65536 in my example).
  789. Add the second file to the car file.
  790. Repeat for subsequent files.
  791.  
  792. Such an approach would result in a car file which could now have individual
  793. files extracted using a reverse approach.  The compression levels should
  794. be comparable to that of the existing suggested car all/gzip car file
  795. approach, whilst catering for the individual file extraction function.
  796. Obviously though, the overheads and management would need to be carefully
  797. maintained as, such as if one intermediate file was requested to be 
  798. deleted, then the deletion would require that the two files either side
  799. of that file would also partially need to be processed as well.
  800. In general however, the additional processing required to maintain these
  801. file start/end adjacent areas, might justify the additional compression
  802. that should be obtained overall.
  803.                                              
  804. Alternatively, you might prefer to simple predefine a set of window pre-load
  805. values, where the choice of pre-load used corresponds to particular file
  806. types.  Providing both the decompressor and compressor used the same
  807. pre-loads, then such an approach could be maintained with a very small
  808. (if any) overhead being added to the compressed file.  
  809.  
  810. Other areas of possible improvements include the archivers header/data
  811. file structures.  Significant improvements towards faster updating could
  812. be made if required.
  813.  
  814. I do intend to make the above and additional improvements to the current
  815. CarComp code for subsequent releases of the package.  So if your interested 
  816. you should register in order to ensure you are kept up to date with the 
  817. latest versions.
  818.  
  819.  
  820. GENERAL
  821. -------
  822.  
  823. You'll find that the programs in this package are open to a number of
  824. other possible improvements.  For example currently they perform limited
  825. validations and version checking (only gzip has any magic number checks
  826. etc. at the moment).  You should therefore be careful in using the programs
  827. as if you do something like atob <infile >outfile, then that's what will
  828. occur, EVEN if 'outfile' already exists!  Similarly CAR will add or 
  829. extract any files that are requested, again even if such files already 
  830. exist within the archive/disk directory.
  831.  
  832. Additionally the user interface is purely provided for usabillity, not
  833. for appearance.  Future versions are expected to improve upon this.
  834.  
  835. Once you have the source code, you can modify the code to suit your own
  836. particular requirements/expectations.  Alternatively we can provide 
  837. assistance if required for specific tailoring.  
  838.  
  839. For those who might be considering creating their own packages based around
  840. the source code provided from this package, there are very few restrictive
  841. rights that have to be adhered to.  Simply put, gzip can be modified and
  842. shared at will (as under the GNU product licence) on the principle that you 
  843. pass on the rights you received to anyone else whom you might share that 
  844. source code or executables with.  For the other units, I only impose a 
  845. restriction that the source code is shareable only with other registered 
  846. users unless you have specific written permission from the package author 
  847. to the contrary.  If you do therefore opt to register for the source code,  
  848. be aware that you will be under the obligation NOT to post the likes of 
  849. car.c etc. to public areas without suitable consent.   This restriction
  850. arises out of our funding of the package improvement/enhancement/distribution 
  851. via moneys received as a result of source code registrations.
  852.  
  853. Finally if you have any suggestions or recommendations for additions to this
  854. package we are always delighted to hear from you.  We would also welcome
  855. any submissions of compiled versions of the CarComp files under other
  856. platforms/operating systems.
  857.  
  858.  
  859. OTHER
  860. -----
  861.  
  862. If you are a Shareware programmer and would like assistance with the 
  863. distribution of your program(s), then CarComp may be able to help.  For a
  864. small fee, we can often help you to globally distribute software packages 
  865. such that you might best benefit from any potential registrations from a 
  866. very wide audience.  Methods include international backbone file 
  867. distribution, general commonly avaiable shareware CD-ROM file inclusion, 
  868. major Internet and BBS file areas etc.  Further details are available upon 
  869. request.
  870.