home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sources / reviewed / 119 < prev    next >
Encoding:
Text File  |  1992-08-29  |  54.1 KB  |  1,950 lines

  1. Newsgroups: comp.sources.reviewed
  2. Path: sparky!uunet!cs.utexas.edu!torn!cunews!nrcnet0!dgbt!rick.dgbt.doc.ca!calvin.dgbt.doc.ca!csr
  3. From: Peter Jannesen <peter@ncs.nl>
  4. Subject: v02i025: ncompress - (Ver. 4.2.3) an improved file compressor, Part01/02
  5. Message-ID: <1992Aug28.223633.1581@rick.dgbt.doc.ca>
  6. Originator: csr@calvin.dgbt.doc.ca
  7. Sender: news@rick.dgbt.doc.ca
  8. Nntp-Posting-Host: calvin.dgbt.doc.ca
  9. Organization: Communications Research Centre, Ottawa
  10. Date: Fri, 28 Aug 1992 22:36:33 GMT
  11. Approved: csr@calvin.dgbt.doc.ca
  12. Lines: 1936
  13.  
  14. Submitted-by: Peter Jannesen <peter@ncs.nl>
  15. Posting-number: Volume 2, Issue 25
  16. Archive-name: ncompress/part01
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 1 (of 2)."
  25. # Contents:  Acknowleds Changes LZW.INFO MANIFEST Makefile.def README
  26. #   build compress.1 patchlevel.h zcmp zcmp.1 zdiff zmore zmore.1
  27. # Wrapped by csr@calvin.dgbt.doc.ca on Wed Aug  5 18:27:11 1992
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'Acknowleds' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'Acknowleds'\"
  31. else
  32. echo shar: Extracting \"'Acknowleds'\" \(685 characters\)
  33. sed "s/^X//" >'Acknowleds' <<'END_OF_FILE'
  34. XAcknowledgments:
  35. X
  36. X(N)compress, Version 4.2
  37. X
  38. XThanks to the previous authors whom I didn't contact, for making
  39. Xthe program available originally.
  40. X   Spencer W. Thomas   (decvax!harpo!utah-cs!utah-gr!thomas)
  41. X   Jim McKie           (decvax!mcvax!jim)
  42. X   Steve Davies        (decvax!vax135!petsd!peora!srd)
  43. X   Ken Turkowski       (decvax!decwrl!turtlevax!ken)
  44. X   James A. Woods      (decvax!ihnp4!ames!jaw)
  45. X   Joe Orost           (decvax!vax135!petsd!joe)
  46. X   Dave Mack           (csu@alembic.acs.com)
  47. X
  48. XAlso thanks to Frans Meulenbroeks, Jan Christiaan van Winkel,
  49. XPeter van Hooft and the testers of comp.sources.reveiwed for testing
  50. Xthis version on different platforms.
  51. X-- 
  52. XPeter Jannesen
  53. END_OF_FILE
  54. if test 685 -ne `wc -c <'Acknowleds'`; then
  55.     echo shar: \"'Acknowleds'\" unpacked with wrong size!
  56. fi
  57. # end of 'Acknowleds'
  58. fi
  59. if test -f 'Changes' -a "${1}" != "-c" ; then 
  60.   echo shar: Will not clobber existing file \"'Changes'\"
  61. else
  62. echo shar: Extracting \"'Changes'\" \(3214 characters\)
  63. sed "s/^X//" >'Changes' <<'END_OF_FILE'
  64. X(N)compress cersion 4.2.2
  65. X    Minor changes after the reviewes from comp.sources.reviewed
  66. X    o Change the name to ncompress because of version problems.
  67. X    o Start all scripts with ':'
  68. X    o Added libary options to buidl script.
  69. X    o Install zmore zcmp zdiff and manuals.
  70. X    o Added patchlevel.h
  71. X    o Updated README file. Created LZW.INFO
  72. X    o a complete grammatical go-round
  73. X    o Use utime.h if availble
  74. X    o Change de default input/output buffer size to BUFSIZ. Because
  75. X      of performance problems with read a head on systems.
  76. X    o Build generates a makefile.
  77. X
  78. Xcompress version 4.2.1 improvements
  79. X    o Change the name to ncompress because of version problems.
  80. X    o Completly rewrite of the compress and decompress functions.
  81. X      compress speedup 25-50% (user cpu time).
  82. X      decompress speedup 20-30% (user cpu time).
  83. X    o Add special fast compress hash algorithm.
  84. X    o Fix some minor things.
  85. X    o use #include <utime.h> if availble.
  86. X    o Cleanup the source code (I think so).
  87. X    o Test if filename is not to long. This is done on runtime no fix length
  88. X      size any more.
  89. X    o Powerfull build script (test almost every thing).
  90. X
  91. XModifications for version 4.1: 
  92. X    o Added -r command line flag to allow recursive compression/
  93. X      decompression of directory trees. As a side-effect, compress
  94. X      no longer tries to compress/decompress anything that isn't
  95. X      a regular file. In particular, it ignores symbolic links.
  96. X    o zcat no longer cares whether a filename ends in .Z or
  97. X      not - it relies on the magic number in the file. If zcat
  98. X      is given a filename that doesn't end with .Z and the file
  99. X      referenced doesn't exist, zcat will append a .Z and try
  100. X      to open that instead.
  101. X    o compress -f will now compress multiply hardlinked files.
  102. X      Uncompress does not recreate the hard link, it creates
  103. X      a new file.
  104. X    o Removed compressdir/uncompressdir - no longer needed.
  105. X    o Removed atob/btoa/tarmail/untarmail - my versions are
  106. X      based on btoa 5.2 which is not compatible with the atob
  107. X      included with compress4.0.
  108. X
  109. XCompress version 4.0 improvements:
  110. X    o compress() speedup (10-50%) by changing division hash to xor
  111. X    o decompress() speedup (5-10%)
  112. X    o Memory requirements reduced (3-30%)
  113. X    o Stack requirements reduced to less than 4kb
  114. X    o Removed 'Big+Fast' compress code (FBITS) because of compress speedup
  115. X    o Portability mods for Z8000 and PC/XT (but not zeus 3.2)
  116. X    o Default to 'quiet' mode
  117. X    o Unification of 'force' flags
  118. X    o Manual page overhaul
  119. X    o Portability enhancement for M_XENIX
  120. X    o Removed text on #else and #endif
  121. X    o Added "-V" switch to print version and options
  122. X    o Added #defines for SIGNED_COMPARE_SLOW
  123. X    o Added Makefile and "usermem" program
  124. X    o Removed all floating point computations
  125. X    o New programs:
  126. X        compressdir - compress all files on a directory
  127. X        uncompressdir - uncompress all files on a directory
  128. X        zcmp - cmp compressed files
  129. X        zdiff - diff compressed files
  130. X      The following are with thanks to philabs!per:
  131. X        btoa - convert binary to ascii for mailing
  132. X        atob - convert ascii to binary with checksum
  133. X        tarmail - tar, compress, btoa, and mail files
  134. X        untarmail - restore "tarmail" files
  135. X
  136. X        WARNING: These last few programs are not compatible 
  137. X        with the original ones from the net.  The encoding
  138. X        has changed.  See btoa.c for more info.
  139. X
  140. END_OF_FILE
  141. if test 3214 -ne `wc -c <'Changes'`; then
  142.     echo shar: \"'Changes'\" unpacked with wrong size!
  143. fi
  144. # end of 'Changes'
  145. fi
  146. if test -f 'LZW.INFO' -a "${1}" != "-c" ; then 
  147.   echo shar: Will not clobber existing file \"'LZW.INFO'\"
  148. else
  149. echo shar: Extracting \"'LZW.INFO'\" \(4347 characters\)
  150. sed "s/^X//" >'LZW.INFO' <<'END_OF_FILE'
  151. XThe following article from James A. Woods, one of the earlier
  152. Xauthors of compress, explains its relationship to the Unisys
  153. Xpatent on the LZW compression method:
  154. X
  155. XFrom uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!usc!ucsd!ucbvax!agate!riacs!jaw Wed Aug  1 15:06:59 EDT 1990
  156. XArticle: 1282 of gnu.misc.discuss
  157. XPath: alembic!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!usc!ucsd!ucbvax!agate!riacs!jaw
  158. XFrom: jaw@riacs.edu (James A. Woods)
  159. XNewsgroups: gnu.misc.discuss
  160. XSubject: Sperry patent #4,558,302 does *not* affect 'compress'
  161. XKeywords: data compression, algorithm, patent
  162. XMessage-ID: <1990Jul31.220935.1424@riacs.edu>
  163. XDate: 31 Jul 90 22:09:35 GMT
  164. XOrganization: RIACS, NASA Ames Research Center
  165. XLines: 69
  166. X
  167. X#  "The chief defect of Henry King
  168. X    Was chewing little bits of string."
  169. X
  170. X        -- Hilaire Belloc, Cautionary Tales [1907]
  171. X
  172. X     As a co-author of 'compress' who has had contact with an attorney for
  173. XUnisys (nee Sperry), I would like to relay a very basic admission from Unisys
  174. Xthat noncommercial use of 'compress' is perfectly legal.  'Compress' is also
  175. Xcommercially distributed by AT&T as part of Unix System 5 release 4,
  176. Xwith no further restrictions placed upon the use of the binary, as far
  177. Xas I am aware.
  178. X
  179. X     From conversations with Professor Abraham Lempel and others, it 
  180. Xappears that neither AT&T, Sun Microsystems, Hewlett Packard, nor IBM
  181. Xare paying any sort of license fees to Unisys in conjunction with patent
  182. X#4,558,302.  It may be true that some organizations are paying fees for
  183. Xdata compression technology licensed from one or more of the many holders
  184. Xof compression patents, but this is all independent from 'compress'.
  185. X
  186. X     In particular, I received a letter at NASA dated October 1, 1987 from
  187. XJohn B. Sowell of the Unisys law department, informing me for the first
  188. Xtime that some form of LZW was patented.  I naturally expressed
  189. Xskepticism that an algorithm could be patented (a murky legal area
  190. Xwhich remains so), stated that 'compress' is not identical to LZW,
  191. Xand in fact was designed, developed, and distributed before the ink
  192. Xon the patent was dry.  Several telephone conversations later, Mr. Sowell
  193. Xintimated that they would *not* seek any fees from users of 'compress'
  194. Xbut instead were signing licensees for hardware implementations of LZW.
  195. X
  196. X     So, regardless of what you believe about a shady legal area, if anyone
  197. Xfrom Unisys contacts you to extract tribute for the use of 'compress', please
  198. Xtell them that, first, it is not theirs to begin with, and, second, there is
  199. Xsomeone who will testify in court about the conversation above.
  200. XIt is not even clear if anyone can "own" 'compress', since original developer
  201. XSpencer Thomas, myself, and others placed the code in the public domain
  202. Xlong before the adoption of the Berne copyright convention.
  203. X
  204. X     In light of the events above, it seems that the Free Software
  205. XFoundation is being unduly paranoid about the use of 'compress'.
  206. XNow I can well believe that FSF is more likely to be a legal target
  207. Xthan a behemoth like AT&T, but if they are simply redistributing
  208. Xuntouched free software developed years ago in the public sector,
  209. XI see no problem.
  210. X
  211. X     Aside:  I am investigating, possibly for a case history to be
  212. Xrecycled to USENET, the particulars of data compression patents.
  213. XI am aware of the following patents: IBM's Miller-Wegman LZ variant,
  214. Xthose of Telcor and ACT [losing candidates for the British Telecom modem
  215. Xstandard], James A. Storer's work on limited lookahead as explicated in his
  216. Xtext "Data Compression (methods and theory)", Computer Science Press, 1988,
  217. Xand the various patents pending associated with the Fiala and Greene
  218. XCACM article of April, 1989 on textual substitution methods.
  219. XIf you have any lore, send it this way.
  220. X
  221. X
  222. X
  223. X                    Sincerely,
  224. X
  225. X                    James A. Woods
  226. X                    NASA Ames Research Center (RIACS)
  227. X                    jaw@riacs.edu (or ames!jaw)
  228. X
  229. X
  230. XP.S.  The algorithm patent issue certainly is a "topic A" at the moment.
  231. XOne useful reference is the review article by Anthony and Colwell --
  232. X"Litigating the Validity and Infringement of Software Patents" in
  233. XWashington and Lee Law Review, volume 41, fall 1984.  I know Robert Colwell
  234. Xpersonally.  As a practicing patent attorney, he tells me that, at a minimum,
  235. Xuse of an invention "for research purposes" is legitimate.
  236. END_OF_FILE
  237. if test 4347 -ne `wc -c <'LZW.INFO'`; then
  238.     echo shar: \"'LZW.INFO'\" unpacked with wrong size!
  239. fi
  240. # end of 'LZW.INFO'
  241. fi
  242. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  243.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  244. else
  245. echo shar: Extracting \"'MANIFEST'\" \(542 characters\)
  246. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  247. X   File Name        Archive #    Description
  248. X-----------------------------------------------------------
  249. X Acknowleds                 1    
  250. X Changes                    1    
  251. X Makefile.def                1
  252. X MANIFEST                   1    This shipping list
  253. X LZW.INFO                    1
  254. X README                     1    
  255. X build                      1    
  256. X compress.1                 1    
  257. X compress42.c               1/2    
  258. X patchlevel.h                2
  259. X zcmp                       1    
  260. X zcmp.1                     1    
  261. X zdiff                      1    
  262. X zmore                      1    
  263. X zmore.1                    1    
  264. END_OF_FILE
  265. if test 542 -ne `wc -c <'MANIFEST'`; then
  266.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  267. fi
  268. # end of 'MANIFEST'
  269. fi
  270. if test -f 'Makefile.def' -a "${1}" != "-c" ; then 
  271.   echo shar: Will not clobber existing file \"'Makefile.def'\"
  272. else
  273. echo shar: Extracting \"'Makefile.def'\" \(1830 characters\)
  274. sed "s/^X//" >'Makefile.def' <<'END_OF_FILE'
  275. X# Makefile
  276. X
  277. X# C complier
  278. XCC=cc
  279. X
  280. X# Install directory for binarys
  281. XBINDIR=/usr/local/bin
  282. X
  283. X# Install directory for manual
  284. XMANDIR=/usr/local/man/man1
  285. X
  286. X# compiler options:
  287. X# options is a collection of:
  288. X#
  289. X#    -DDIRENT=1                    Use dirent.h
  290. X#    -DSYSDIR=1                    Use sys/dir.h
  291. X#    -DLSTAT=1                    Use lstat for finding symlinks.
  292. X#    -DUTIME_H=1                    Use utime.h
  293. X#    -DUSERMEM=<size>            Availble memory for compress (default 800k).
  294. X#    -DREGISTERS=<nbr>            Number of registers (default 2).
  295. X#    -DIBUFSIZ=<size>            Input buffer size (default BUFSIZ).
  296. X#    -DOBUFSIZ=<size>            Output buffer size (default BUFSIZ)
  297. X#    -DBYTEORDER=<order>            Byte order (default: unknown).
  298. X#    -DNOALLIGN=1                Data word allignment (default: yes).
  299. X#    -DDEF_ERRNO=1                Define error (not defined in errno.h).
  300. X#    -DMAXSEG_64K=1 -BITS=16        Support segment processsor like 80286.
  301. X#
  302. Xoptions= -DIRENT=1 -DUSERMEM=800000 -DREGISTERS=3  
  303. X
  304. X# libary options
  305. XLBOPT=
  306. X
  307. Xcompress:    Makefile compress42.c patchlevel.h
  308. X    $(CC) -o compress $(options) "-DCOMPILE_DATE=\"`date`\"" compress42.c $(LBOPT)
  309. X
  310. Xinstall:    compress
  311. X        [ -f /usr/local/bin/compress ] &&             { rm -f /usr/local/bin/compress.old ;               mv /usr/local/bin/compress /usr/local/bin/compress.old ; }
  312. X        rm -f /usr/local/bin/uncompress /usr/local/bin/zcat
  313. X        cp compress /usr/local/bin/compress
  314. X        strip /usr/local/bin/compress
  315. X        rm -f /usr/local/bin/uncompress
  316. X        ln /usr/local/bin/compress /usr/local/bin/uncompress
  317. X        rm -f  /usr/local/bin/zcat
  318. X        ln -f /usr/local/bin/compress /usr/local/bin/zcat
  319. X        cp zcmp zdiff zmore /usr/local/bin/.
  320. X        chmod 0755 /usr/local/bin/compress /usr/local/bin/zcmp /usr/local/bin/zdiff                    /usr/local/bin/zmore
  321. X        cp compress.1 zcmp.1 zmore.1 /usr/local/man/man1/.
  322. X        chmod 0644 /usr/local/man/man1/compress.1 /usr/local/man/man1/zcmp.1                    /usr/local/man/man1/zmore.1
  323. X
  324. Xcleanup:
  325. X        rm -f compress compress.def comp.log
  326. END_OF_FILE
  327. if test 1830 -ne `wc -c <'Makefile.def'`; then
  328.     echo shar: \"'Makefile.def'\" unpacked with wrong size!
  329. fi
  330. # end of 'Makefile.def'
  331. fi
  332. if test -f 'README' -a "${1}" != "-c" ; then 
  333.   echo shar: Will not clobber existing file \"'README'\"
  334. else
  335. echo shar: Extracting \"'README'\" \(3709 characters\)
  336. sed "s/^X//" >'README' <<'END_OF_FILE'
  337. XThis is version 4.2 of (N)compress (an improved version of compress 4.1).
  338. X
  339. XCompress is a fast, simple LZW file compressor.  Compress does not have
  340. Xthe highest compression rate, but it is one of the fastest programs to
  341. Xcompress data.  Compress is the defacto standard in the UNIX community
  342. Xfor compressing files.
  343. X
  344. X'build' is a menu driven shell script for compiling, testing and
  345. Xinstalling (N)compress. So to build and install (N)compress all you have to
  346. Xdo is run build.  Build will first test your system for default
  347. Xsettings. The current compile settings are stored in a special file
  348. Xcalled compress.def.
  349. X
  350. XFor user with problems with build there is a default makefile included
  351. Xcalled 'Makefile.def'. Also build is capable te generate a Makefile with
  352. Xall options (option genmake).
  353. X
  354. X(N)compress 4.2 has a special, fast compression hash algorithm.  This
  355. Xalgorithm uses more memory than the old hash table. If you don't want
  356. Xthe faster hash table algorithm set 'Memory free for compress' below
  357. X800000.
  358. X
  359. Xzcmp, zdiff, zmore were copied from version 4.1 without any changes.
  360. X
  361. XThe output of (N)compress 4.2 is fully compatible with that of compress 3.0.
  362. XIn other words, the output of (N)compress 4.2 may be fed into uncompress 3.0 or
  363. Xthe output of compress 3.0 may be fed into uncompress 4.2.
  364. X
  365. XThe output of (N)compress 4.2 is not compatible with that of
  366. Xcompress 2.0.  However, compress 4.2 still accepts the output of
  367. Xcompress 2.0.  To generate output that is compatible with compress
  368. X2.0, use the undocumented "-C" flag.
  369. X
  370. XSend comments, complaints and especially patches relating to
  371. X    peter@ncs.nl
  372. X
  373. X
  374. XREMARKS
  375. X
  376. X- Build is a bourne shell script. On some system it is nessesary to type
  377. X  'sh build'.
  378. X
  379. X- The build script usages tput for nice screen handling of the script.
  380. X  If your system has no tput no problems.
  381. X
  382. X- For configuration testing build uses a lot of small C programs. During
  383. X  those test stderr is redirected to /dev/null.
  384. X  During the compilation of compress output is NOT redirected.
  385. X
  386. X- The /bin/sh under Ultrix can't handle ${var:-str} so use ksh for the
  387. X  build script.
  388. X
  389. X- If there are any problems with the libary functions definitions in
  390. X  compress42.c define NOFUNCDEF (-DNOFUNCDEF=1) to disable the definitions.
  391. X  IBM AIX (RS/6000) uses a different definitions of open(), define -D_IBMRT=1
  392. X  to disable the open() definition.
  393. X
  394. X- The output if (N)compress 4.2 is not exactly the same as compress 4.0
  395. X  because of differente table reset point. The output of (N)compress 4.2
  396. X  is 100% compatible with compress 4.0
  397. X
  398. X- Some systems has performance problems with reads bigger than BUFSIZ
  399. X  (The read a head function is not working as expected). For those
  400. X  system use the default BSIZE input buffer size.
  401. X
  402. X- (N)compress can by slower on small files (<10Kb) because of a greate 
  403. X  table reset overhead. Use cpio or tar to make 1 bigger file if
  404. X  posible, it is faster and also gives a beter compression ratio most
  405. X  of the time.
  406. X
  407. X- (N)compress is slower in vax systems because of removing some
  408. X  undocumented inline asembler.
  409. X
  410. X- files compressed on a large machine with more bits than allowed by 
  411. X  a version of compress on a smaller machine cannot be decompressed!  Use the
  412. X  "-b12" flag to generate a file on a large machine that can be uncompressed 
  413. X  on a 16-bit machine.
  414. X
  415. X- compatibility with compress 3.0 has not been tested in the 4.2 release of
  416. X  (N)compress.
  417. X
  418. X===============================================================================
  419. XPeter Jannesen
  420. XNetwork Communication Systems (N.C.S), The Netherlands
  421. XPhone:  +31104130093                             Fax:    +31104146452
  422. XAddress: Westbaak 96a                            Email:  peter@ncs.nl
  423. X         3012 KM Rotterdam, The Netherlands
  424. END_OF_FILE
  425. if test 3709 -ne `wc -c <'README'`; then
  426.     echo shar: \"'README'\" unpacked with wrong size!
  427. fi
  428. # end of 'README'
  429. fi
  430. if test -f 'build' -a "${1}" != "-c" ; then 
  431.   echo shar: Will not clobber existing file \"'build'\"
  432. else
  433. echo shar: Extracting \"'build'\" \(19727 characters\)
  434. sed "s/^X//" >'build' <<'END_OF_FILE'
  435. X:
  436. X#!/bin/sh
  437. X#
  438. Xversion="4.2.3"
  439. X
  440. Xecho "Build (N)compress ${version}"
  441. XCLS=`sh -c 'tput clear' 2>/dev/null`
  442. X
  443. Xif expr `echo "foo\c"` : '.*c' >/dev/null
  444. Xthen
  445. X    n='-n'
  446. X    c=''
  447. Xelse
  448. X    n=''
  449. X    c='\c'
  450. Xfi
  451. X
  452. Xtrap 'rm -f /tmp/sh$$.tm* /tmp/sh$$.f* /tmp/sh$$.log /tmp/sh*.c' 0
  453. Xtrap 'set +x ; exit 1' 1 2 15
  454. X
  455. X[ -f compress.def ] && . ./compress.def
  456. X
  457. Xwhile true
  458. Xdo
  459. X    if [ "${DEFINED}" = yes ]
  460. X    then
  461. X        echo "${CLS}    Build (N)compress ${version}
  462. X
  463. X 1.  Directory to install compress in: ${BINDIR}
  464. X                          manual in  : ${MANDIR}
  465. X 2.  Memory free for compress        : ${USERMEM}
  466. X 3.  Input/Output buffer size        : ${IBUFSIZ} ${OBUFSIZ}
  467. X 4.  C Compiler                      : ${CC}
  468. X 5.  Compiler options                : ${CCOPT:---none--}
  469. X 6.  Libary options                  : ${LBOPT:---none--}
  470. X 7.  Special options for your system : ${EXTRA:---none--}
  471. X 8.  Number of register variable     : ${REGISTERS}
  472. X 9.  Symbolic links                  : ${LSTAT}
  473. X10.  Use include <utime.h>           : ${UTIME_H}"
  474. X
  475. X        if [ ".${DIRENT}" = .yes ] 
  476. X        then
  477. X            echo "11.  Your system support dirent.h"
  478. X        else
  479. X            if [ ".${SYSDIR}" = .yes -a ".${DIRENT}" != .yes ]
  480. X            then
  481. X                echo "11.  Your system support sys/dir.h"
  482. X            else
  483. X                echo "11.  No directory support -r disabled."
  484. X            fi
  485. X        fi
  486. X    
  487. X        echo "12.  Word must start at even addres: ${NOALLIGN}, Bytorder on your system: ${BYTEORDER}"
  488. X        echo "
  489. X d. Set default settings                    mkshar.  Create shell archive
  490. X c. Compile compress                        mktar.   Create tar archive
  491. X t. Test compress                           cleanup. Cleanup
  492. X i. Install compress                        genmake. Generate makefile
  493. X q. Stop
  494. X"
  495. X        echo ${n} "   Choice [1..10,d,c,t,i,q,mkshar,mktar,cleanup] : ${c}"
  496. X
  497. X        (
  498. X            echo "# Current parameters."
  499. X            for var in CC CCOPT LBOPT BINDIR MANDIR DIRENT SYSDIR IBUFSIZ \
  500. X                        OBUFSIZ USERMEM REGISTERS LSTAT BYTEORDER NOALLIGN \
  501. X                        EXTRA DEFINED UTIME_H
  502. X            do
  503. X                echo "${var}='`eval echo \$\{${var}\}`'"
  504. X            done
  505. X        ) >compress.def
  506. X
  507. X        read choice var1 var2 var3 var4 varr
  508. X        echo ""
  509. X    else
  510. X        choice=D
  511. X    fi
  512. X
  513. X    case "${choice}" in
  514. X    1)
  515. X        if [ ".${var1}" = . ]
  516. X        then
  517. X            echo ${n} "Directory to install compress in (default:${BINDIR}) ? ${c}"
  518. X            read var1 dummy
  519. X        fi
  520. X
  521. X        BINDIR="${var1:-${BINDIR}}"
  522. X
  523. X        if [ ".${var2}" = . ]
  524. X        then
  525. X            echo ${n} "Directory to install manuals in (default:${MANDIR}) ? ${c}"
  526. X            read var2 dummy
  527. X        fi
  528. X
  529. X        MANDIR="${var2:-${MANDIR}}"
  530. X        ;;
  531. X
  532. X    2)
  533. X        if [ ".${var1}" = . ]
  534. X        then
  535. X            echo "Compress use a lot of memory, the more memory it can just the faster"
  536. X            echo "the programm is and the better compression is."
  537. X            echo ${n} "Memory free for compress (default:${USERMEM}) ? ${c}"
  538. X            read var1 dummy 
  539. X        fi
  540. X
  541. X        USERMEM="${var1:-${USERMEM}}"
  542. X        ;;
  543. X
  544. X    3)    
  545. X        if [ ".${var1}" = . ]
  546. X        then
  547. X            echo "For input and output compress use buffers. A bigger buffer reduce"
  548. X            echo "system (kernel) overhead. If your system is a 16 bits system don't"
  549. X            echo "make the buffers bigger than 2048 bytes. The default 2048 is in"
  550. X            echo "most cases a good answer."
  551. X            echo ${n} "Best input buffer size (default:${IBUFSIZ}) ? ${c}"
  552. X            read var1 var2 dummy
  553. X
  554. X            if [ ".${var2}" = . ] 
  555. X            then
  556. X                echo ${n} "Best output buffer size (default:${OBUFSIZ}) ? ${c}"
  557. X                read D dummy 
  558. X            fi
  559. X        fi
  560. X
  561. X        var2="${var2:-${var1}}"
  562. X         IBUFSIZ="${var1:-${IBUFSIZ}}"
  563. X         OBUFSIZ="${var2:-${OBUFSIZ}}"
  564. X        ;;
  565. X
  566. X    4)
  567. X        if [ ".${var1}" = . ]
  568. X        then    
  569. X            echo "C compiler to use for compilation (must by cc compatible)".
  570. X            echo ${n} "C Compiler (default:${CC}) ? ${c}"
  571. X            read var1 dummy
  572. X        fi
  573. X
  574. X        CC="${var1:-${CC}}"
  575. X        ;;
  576. X
  577. X    5)
  578. X        if [ ".${var1}" = . ]
  579. X        then
  580. X            echo ${n} "Compiler options (default:${CCOPT:-none}) ? ${c}"
  581. X            read var1
  582. X        fi
  583. X
  584. X        [ ".${var1}" != . ] && CCOPT="${var1} ${var2} ${var3} ${var4} ${varr}"
  585. X        ;;    
  586. X
  587. X    6)
  588. X        if [ ".${var1}" = . ]
  589. X        then
  590. X            echo ${n} "Libary options (default:${LBOPT:-none}) ? ${c}"
  591. X            read var1
  592. X        fi
  593. X
  594. X        [ ".${var1}" != . ] && LBOPT="${var1} ${var2} ${var3} ${var4} ${varr}"
  595. X        ;;    
  596. X
  597. X    7)
  598. X        if [ ".${var1}" = . ]
  599. X        then
  600. X            echo "Some system needs extra defines see README"
  601. X            echo ${n} "Special for your system (default:${EXTRA:-none}) ? ${c}"
  602. X            read var1
  603. X        fi
  604. X
  605. X        [ ".${var1}" != . ] && EXTRA="${var1} ${var2} ${var3} ${var4} ${varr}"
  606. X        ;;    
  607. X
  608. X    8)
  609. X        if [ ".${var1}" = . ]
  610. X        then
  611. X            echo ${n} "Number of register variable (default:${REGISTERS}) ? ${c}"
  612. X            read var1 dummy
  613. X        fi
  614. X
  615. X        REGISTERS="${var1:-${REGISTERS}}"
  616. X        ;;
  617. X
  618. X    9)
  619. X        if [ ".${var1}" = . ]
  620. X        then
  621. X            echo ${n} "Symbolic links (default:${LSTAT}) ? ${c}"
  622. X            read var1 dummy
  623. X        fi
  624. X
  625. X        case "${var1:-${DIRENT}}" in
  626. X        y|Y|yes|YES) LSTAT=yes; ;;
  627. X        *)             LSTAT=no; ;;
  628. X        esac
  629. X        ;;
  630. X
  631. X    10)
  632. X        if [ ".${var1}" = . ]
  633. X        then
  634. X            echo ${n} "Do your system support utime.h (default:${UTIME_H}) ? ${c}"
  635. X            read var1 dummy
  636. X        fi
  637. X
  638. X        case "${var1:-${DIRENT}}" in
  639. X        y|Y|yes|YES) UTIME_H=yes; ;;
  640. X        *)             UTIME_H=no; ;;
  641. X        esac
  642. X        ;;
  643. X
  644. X    11)
  645. X        case "${var1}" in
  646. X        dirent)
  647. X            DIRENT=yes; SYSDIR=no;
  648. X            ;;
  649. X        sys/dir) 
  650. X            DIRENT=no; SYSDIR=yes;
  651. X            ;;
  652. X        *)
  653. X            echo ${n} "Do your system support dirent.h (default:${DIRENT}) ? ${c}"
  654. X            read var1 dummy
  655. X            case "${var1:-${DIRENT}}" in
  656. X            y|Y|yes|YES) DIRENT=yes; SYSDIR=no; ;;
  657. X            *)             DIRENT=no; SYSDIR=no; ;;
  658. X            esac
  659. X
  660. X            if [ ${DIRENT} = no ]
  661. X            then
  662. X                echo ${n} "Do your system support sys/dir.h (default:${SYSDIR}) ? ${c}"
  663. X                read var1 dummy
  664. X                case "${var1:-${SYSDIR}}" in
  665. X                y|Y|yes|YES) DIRENT=no; SYSDIR=yes; ;;
  666. X                *)             DIRENT=no; SYSDIR=no; ;;
  667. X                esac
  668. X            fi
  669. X            ;;
  670. X        esac
  671. X        ;;
  672. X
  673. X    12)
  674. X        if [ ".${var1}" = . ]
  675. X        then
  676. X            echo "If your system don't need word allignment for words (like 80386)"
  677. X            echo "compress can use this fact to by faster. If your are not sure type y"
  678. X            echo ${n} "Must words start at a even address (default:${NOALLIGN}) ? ${c}"
  679. X            read var1 var2 varr
  680. X        fi
  681. X
  682. X        if [ ".${var2}" = . ]
  683. X        then
  684. X            echo ${n} "Byteorder on your system (default:${BYTEORDER}) ? ${c}"
  685. X            read var2 varr 
  686. X        fi
  687. X
  688. X        case "${var1}" in
  689. X        n|no|N|NO)    var1=no; ;;
  690. X        *)            var1=yes; ;;
  691. X        esac
  692. X
  693. X         NOALLIGN="${var1:-${NOALLIGN}}"
  694. X         BYTEORDER="${var2:-${BYTEORDER}}"
  695. X        ;;
  696. X
  697. X    d|D)
  698. X        echo "Testing the system to find out what kind of system we have."
  699. X        BINDIR=/usr/bin
  700. X        MANDIR=/usr/man/man1
  701. X        DIRENT=no
  702. X        SYSDIR=no
  703. X        UTIME_H=no
  704. X        IBUFSIZ=2048
  705. X        OBUFSIZ=2048
  706. X        USERMEM=0
  707. X        REGISTERS=2
  708. X        LSTAT=no
  709. X        CCOPT='-O'
  710. X        LBOPT=
  711. X        EXTRA=
  712. X        [ -f /usr/include/sys/dir.h ] && { SYSDIR=yes; }
  713. X        [ -f /usr/include/dirent.h ] && { DIRENT=yes; }
  714. X        [ -f /usr/include/utime.h ] && { UTIME_H=yes; }
  715. X        [ -d /usr/local/bin ] && { BINDIR=/usr/local/bin; }
  716. X        [ -d /usr/local/man ] && { BINDIR=/usr/local/man/man1; }
  717. X        [ -f /usr/bin/compress ] && { BINDIR=/usr/bin; }
  718. X    
  719. X        if [ ".${CC}" = . ]
  720. X        then
  721. X            echo ${n} "Find compiler. Compiler is: ${c}"
  722. X            echo 'main() {return 0;}' >/tmp/sh$$.c
  723. X
  724. X            for cc in cc gcc
  725. X            do
  726. X                if ${cc} -c /tmp/sh$$.c >/dev/null 2>&1
  727. X                then
  728. X                    rm -f sh$$.o
  729. X                    CC=${cc}
  730. X                    echo ${CC}
  731. X                    break
  732. X                fi
  733. X            done
  734. X
  735. X            if [ ".${CC}" = . ]
  736. X            then
  737. X                echo "Can't file one of the standaard compilers. Give C Compiler name"
  738. X                echo ${n} "C Compiler : ${c}"
  739. X                read CC dummy
  740. X            fi
  741. X        fi
  742. X
  743. X        echo ${n} "Test best buffer size: ${c}"
  744. X        cat >/tmp/sh$$.c <<!
  745. X#include <stdio.h>
  746. X        main()
  747. X            {
  748. X                int        size;
  749. X    
  750. X                size = 1024;
  751. X#ifdef BUFSIZ
  752. X                if (size < BUFSIZ)    size = BUFSIZ;
  753. X#endif
  754. X                if (sizeof(int)<4)    size = 2048;
  755. X                printf("%d\n", size);
  756. X                return 0;
  757. X            }
  758. X!
  759. X        ${CC} /tmp/sh$$.c && IBUFSIZ=`./a.out`
  760. X        rm -f /tmp/sh$$.c a.out
  761. X        OBUFSIZ=${IBUFSIZ}
  762. X        echo "${IBUFSIZ}"
  763. X
  764. X        echo ${n} "Test byte order of system: ${c}"
  765. X        cat >/tmp/sh$$.c <<!
  766. X        main()
  767. X            {
  768. X                long    test;
  769. X        extern    int        write();
  770. X        
  771. X                test = 0x31323334L;
  772. X                write(1, (char *)&test, 4);
  773. X                return 0;
  774. X            }
  775. X!
  776. X        ${CC} /tmp/sh$$.c && BYTEORDER=`./a.out`
  777. X        BYTEORDER="${BYTEORDER:-0000}"
  778. X        echo ${BYTEORDER}
  779. X        rm -f /tmp/sh$$.c a.out
  780. X
  781. X
  782. X        echo ${n} "Test word allignment. Must words be allign: ${c}"
  783. X        cat >/tmp/sh$$.c <<!
  784. X        sig() {exit(1);}
  785. X        main()
  786. X            {
  787. X                int        i;
  788. X                char    bfr1[6];
  789. X                char    bfr2[6];
  790. X                long    test;
  791. X        extern    int        write();
  792. X
  793. X                for (i = 1 ; i <= 15 ; ++i)
  794. X                    signal(i, sig);
  795. X    
  796. X                bfr1[0]=' ';bfr1[1]='1';bfr1[2]='2';
  797. X                bfr1[3]='3';bfr1[4]='4';bfr1[5]=' ';
  798. X                bfr2[0]='X';bfr2[1]='X';bfr2[2]='X';
  799. X                bfr2[3]='X';bfr2[4]='X';bfr2[5]='X';
  800. X
  801. X                test = *(long *)(bfr1+1);
  802. X                *(long *)(bfr2+0) = test;
  803. X    
  804. X                if (bfr2[0] == '1' && bfr2[1] == '2' && bfr2[2] == '3' &&
  805. X                    bfr2[3] == '4' && bfr2[4] == 'X')
  806. X                    write(1, "no", 2);
  807. X
  808. X                return 0;
  809. X            }
  810. X!
  811. X        ${CC} /tmp/sh$$.c && NOALLIGN=`( ./a.out ) 2>/dev/null`
  812. X        NOALLIGN="${NOALLIGN:-yes}"
  813. X        echo ${NOALLIGN}
  814. X        rm -f /tmp/sh$$.c a.out core
  815. X
  816. X        echo ${n} "Test number of register vars. Registers var: ${c}"
  817. X        cat >/tmp/sh$$.c <<!
  818. X        main()
  819. X            {
  820. X                long            l11;
  821. X                long            l12;
  822. X                long            l13;
  823. X                long            l1;
  824. X                register long    rl01; register long    rl02;
  825. X                register long    rl03; register long    rl04;
  826. X                register long    rl05; register long    rl06;
  827. X                register long    rl07; register long    rl08;
  828. X                register long    rl09; register long    rl10;
  829. X                register long    rl11; register long    rl12;
  830. X                register long    rl13; register long    rl14;
  831. X                register long    rl15; register long    rl16;
  832. X                register long    rl17; register long    rl18;
  833. X                register long    rl19; register long    rl20;
  834. X                long            l2;
  835. X                long            l22;
  836. X                long            l23;
  837. X                long            l24;
  838. X
  839. X                l1 = (char *)&l1-(char *)&l2;
  840. X                if (l1 < 0)    l1 = -l1;
  841. X                l1 = 21-(l1/sizeof(long));
  842. X                if (l1 > 0 && l1 < 21)
  843. X                    printf("%ld", l1);
  844. X                exit(0);
  845. X            }
  846. X!
  847. X        cc /tmp/sh$$.c && REGISTERS=`./a.out`
  848. X        REGISTERS=${REGISTERS:-2};
  849. X        echo ${REGISTERS}
  850. X        rm -f a.out /tmp/sh$$.c
  851. X
  852. X        echo ${n} "Test if errno is declared in errno.h: ${c}"
  853. X        cat >/tmp/sh$$.c <<!
  854. X#include    <stdio.h>
  855. X#include    <errno.h>
  856. X        main()
  857. X            {
  858. X                return    errno;
  859. X            }
  860. X!
  861. X        if cc /tmp/sh$$.c
  862. X        then
  863. X            echo "Yes"
  864. X        else
  865. X            echo "No"
  866. X            EXTRA="${EXTRA} -DDEF_ERRNO=1"
  867. X        fi
  868. X
  869. X        rm -f a.out /tmp/sh$$.c
  870. X
  871. X
  872. X        echo ${n} "Test if system support symbolic links? ${c}"
  873. X        cat >/tmp/sh$$.c <<!
  874. X        main()
  875. X            {
  876. X                lstat(0, 0);
  877. X            }
  878. X!
  879. X        LSTAT=no
  880. X        ${CC} /tmp/sh$$.c >/dev/null 2>&1 && LSTAT=yes
  881. X        echo "${LSTAT}"
  882. X        rm -f a.out /tmp/sh$$.c
  883. X
  884. X        echo ${n} "Test availble memory${c}"
  885. X        for size in 75000 130000 230000 440000 800000
  886. X        do
  887. X            cat >/tmp/sh$$.c <<!
  888. X            char    test[${size}+128000];
  889. X    
  890. X            extern    int                alarm();
  891. X            extern    int                exit();
  892. X            extern    int                signal();
  893. X    
  894. X            sig() {exit(1);}
  895. X
  896. X            main()
  897. X                {
  898. X                    register int    i;
  899. X                    register long    j;
  900. X    
  901. X                    for (i = 1 ; i <= 15 ; ++i)
  902. X                        signal(i, sig);        
  903. X
  904. X                    alarm(2);
  905. X    
  906. X                    for (i = 0 ; i < 10 ; ++i)
  907. X                        for (j = 0 ; j < sizeof(test) ; j+= 1024)
  908. X                            test[j] = i;
  909. X
  910. X                    alarm(0);
  911. X                    return 0;
  912. X                }
  913. X!
  914. X            ${CC} /tmp/sh$$.c >/dev/null 2>&1 || break
  915. X            ./a.out || break
  916. X            rm a.out /tmp/sh$$.c
  917. X            USERMEM=${size}
  918. X            echo ${n} " ${size}${c}"
  919. X        done
  920. X
  921. X        rm a.out /tmp/sh$$.c
  922. X
  923. X        echo ""
  924. X
  925. X        if [ ${USERMEM} = 0 ]
  926. X        then
  927. X            echo ${n} "Memory size is 0, segmented processor: ${c}"
  928. X            cat >/tmp/sh$$.c <<!
  929. X            long htab0[8192];
  930. X            long htab1[8192];
  931. X            long htab2[8192];
  932. X            long htab3[8192];
  933. X            long htab4[8192];
  934. X            long htab5[8192];
  935. X            long htab6[8192];
  936. X            long htab7[8192];
  937. X            long htab8[8192];
  938. X            short code0tab[16384];
  939. X            short code1tab[16384];
  940. X            short code2tab[16384];
  941. X            short code3tab[16384];
  942. X            short code4tab[16384];
  943. X            main() {return 0;}
  944. X!
  945. X            rm -f ./a.out
  946. X            if ${CC} /tmp/sh$$.c >/dev/null 2>&1 
  947. X            then
  948. X                :
  949. X            else
  950. X                opt="-Ml"
  951. X
  952. X                while [ ".${opt}" != . ]
  953. X                do
  954. X                    if ${CC} ${opt} /tmp/sh$$.c >/dev/null 2>&1 
  955. X                    then
  956. X                        :
  957. X                    else
  958. X                        CCOPT="${CCOPT} ${opt}"
  959. X                        break
  960. X                    fi
  961. X
  962. X                    echo ${n} "Large model compile option: ${c}"
  963. X                    read opt dummy
  964. X                done
  965. X            fi
  966. X
  967. X            if [ -f ./a.out ]
  968. X            then
  969. X                if ./a.out
  970. X                then
  971. X                    echo "Yes"
  972. X                    MEMSIZE=0
  973. X                    EXTRA="${EXTRA} -DMAXSEG_64K=1 -DBITS=16"
  974. X                else
  975. X                    echo "No"
  976. X                fi
  977. X            fi
  978. X
  979. X            rm ./a.out /tmp/sh$$.c
  980. X        fi
  981. X
  982. X        DEFINED=yes
  983. X        echo ""
  984. X        echo "I have now create the default options for compiling compress ${version}"
  985. X    ;;
  986. X
  987. X    c|C)
  988. X        options="${CCOPT} -o compress"
  989. X        [ "${DIRENT}" = yes ] && options="${options} -DDIRENT=1"
  990. X        [ "${SYSDIR}" = yes ] && options="${options} -DSYSDIR=1"
  991. X        [ "${LSTAT}" != no  ] && options="${options} -DLSTAT=1"
  992. X        [ "${UTIME_H}" != no  ] && options="${options} -DUTIME_H=1"
  993. X        options="${options} -DUSERMEM=${USERMEM}"
  994. X        options="${options} -DREGISTERS=${REGISTERS}"
  995. X        options="${options} -DIBUFSIZ=${IBUFSIZ} -DOBUFSIZ=${OBUFSIZ}"
  996. X        options="${options} -DBYTEORDER=${BYTEORDER}"
  997. X        [ "${NOALLIGN}" = no ] && options="${options} -DNOALLIGN=1"
  998. X        options="${options} ${EXTRA}"
  999. X
  1000. X        echo ""
  1001. X        echo "Compiling compress ${version}"
  1002. X
  1003. X        echo ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c ${LBOPT}
  1004. X
  1005. X        if ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c ${LBOPT}
  1006. X        then
  1007. X            echo ""
  1008. X            ./compress -V
  1009. X            echo ""
  1010. X            echo "Compress compiled, use 'i' to install compress in ${BINDIR}"
  1011. X        else
  1012. X            echo ""
  1013. X            echo "Error(s) in compilation"
  1014. X        fi
  1015. X        echo ""
  1016. X        echo ${n} "Press return to continue${c}"
  1017. X        read dummy
  1018. X        ;;
  1019. X
  1020. X    s|S)
  1021. X        options="-O -S"
  1022. X        [ "${DIRENT}" = yes ] && options="${options} -DDIRENT=1"
  1023. X        [ "${SYSDIR}" = yes ] && options="${options} -DSYSDIR=1"
  1024. X        [ "${LSTAT}" != no  ] && options="${options} -DLSTAT=1"
  1025. X        [ "${UTIME_H}" != no  ] && options="${options} -DUTIME_H=1"
  1026. X        options="${options} -DUSERMEM=${USERMEM}"
  1027. X        options="${options} -DREGISTERS=${REGISTERS}"
  1028. X        options="${options} -DIBUFSIZ=${IBUFSIZ} -DOBUFSIZ=${OBUFSIZ}"
  1029. X        options="${options} -DBYTEORDER=${BYTEORDER}"
  1030. X        [ "${NOALLIGN}" = no ] && options="${options} -DNOALLIGN=1"
  1031. X        options="${options} ${EXTRA}"
  1032. X
  1033. X        echo ""
  1034. X        echo "Compiling compress ${version}"
  1035. X
  1036. X        echo ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c 
  1037. X
  1038. X        ${CC} ${options} "-DCOMPILE_DATE=\"`date`\"" compress42.c 
  1039. X        echo ""
  1040. X        echo ${n} "Press return to continue${c}"
  1041. X        read dummy
  1042. X        ;;
  1043. X
  1044. X    t|T)
  1045. X        if [ ! -x ./compress ]
  1046. X        then
  1047. X            echo "Compile compress first before testing!"
  1048. X        else
  1049. X            if [ ".${var1}" = . ]
  1050. X            then
  1051. X                echo "To test compress you need a test set. For a test set alle filein one"
  1052. X                echo "directory are combined to one file with cpio and compress/decompressed"
  1053. X                echo ${n} "Test directory [default:current]: ${c}"
  1054. X                read var1 varr
  1055. X            fi
  1056. X
  1057. X            if [ ! -d ${var1:-.} ]
  1058. X            then
  1059. X                echo "$var1: no directory"
  1060. X            else
  1061. X                var1=`cd ${var1:-.};pwd`
  1062. X                find ${var1} -type f -print |
  1063. X                    ( while read fn ; do [ -r ${fn} ] && echo ${fn} ; done ) |
  1064. X                    sort >/tmp/sh$$.fi
  1065. X
  1066. X                (
  1067. X                    echo "==============================================================================="
  1068. X                    echo "Directory: ${var1:-/}"
  1069. X                    echo "./compress -V"
  1070. X                    ./compress -V
  1071. X
  1072. X                    if [ -x ${BINDIR}/compress ]
  1073. X                    then
  1074. X                        old=${var2:-${BINDIR}/compress}
  1075. X                        set -- ./compress ${old} \
  1076. X                                ${old} ./compress \
  1077. X                                ./compress ./compress \
  1078. X                                ${old} ${old}
  1079. X
  1080. X                        echo "${old} -V"
  1081. X                        ${old} -V </dev/null dummy-file
  1082. X                    else
  1083. X                        set -- ./compress ./compress
  1084. X                    fi
  1085. X
  1086. X                    while [ $# != 0 ]
  1087. X                    do
  1088. X                        echo "---------------- $1 -> $2 ----------------"
  1089. X                        if [ -x /sbin/sync ] ;    then /sbin/sync
  1090. X                                                else sync ; fi
  1091. X
  1092. X                        sleep 1
  1093. X
  1094. X                        cpio -o </tmp/sh$$.fi |
  1095. X                            ( time $1 -v 2>/tmp/sh$$.tm1 ) |
  1096. X                            ( time $2 -d 2>/tmp/sh$$.tm2 ) |
  1097. X                            ( cpio -ivt >/tmp/sh$$.fo )
  1098. X        
  1099. X                        awk </tmp/sh$$.fo '{print $8}'  >/tmp/sh$$.foo
  1100. X    
  1101. X                        if cmp /tmp/sh$$.fi /tmp/sh$$.foo
  1102. X                        then
  1103. X                            :
  1104. X                        else
  1105. X                            echo ------ ERROR
  1106. X                            diff /tmp/sh$$.fi /tmp/sh$$.foo
  1107. X                        fi
  1108. X
  1109. X                        echo "---------------"
  1110. X                        echo "compress   $1("`cat /tmp/sh$$.tm1`")"
  1111. X                        echo "decompress $2("`cat /tmp/sh$$.tm2`")"
  1112. X                        shift 2
  1113. X                    done
  1114. X                ) 2>&1 | tee /tmp/sh$$.log
  1115. X
  1116. X                cat /tmp/sh$$.log >>comp.log && rm /tmp/sh$$.log
  1117. X            fi
  1118. X
  1119. X            echo ""
  1120. X        fi
  1121. X
  1122. X        echo ${n} "Press return to continue${c}"
  1123. X        read dummy
  1124. X        ;;
  1125. X    i|I)
  1126. X        if [ ".${var1}" = . ]
  1127. X        then
  1128. X            echo ${n} "Install compress with user ? (default current user) ? ${c}"
  1129. X            read var1 dummy
  1130. X        fi
  1131. X
  1132. X        pwd=`pwd`
  1133. X
  1134. X        ( cat - <<!
  1135. X            set -x
  1136. X
  1137. X            cd ${pwd}
  1138. X
  1139. X            [ -f ${BINDIR}/compress ] &&
  1140. X                { rm -f ${BINDIR}/compress.old ;
  1141. X                  mv ${BINDIR}/compress ${BINDIR}/compress.old || exit 1; }
  1142. X
  1143. X            rm -f ${BINDIR}/uncompress ${BINDIR}/zcat || exit 1
  1144. X
  1145. X            cp compress ${BINDIR}/compress || exit 1
  1146. X            strip ${BINDIR}/compress
  1147. X            rm -f ${BINDIR}/uncompress || exit 1
  1148. X            ln ${BINDIR}/compress ${BINDIR}/uncompress || exit 1
  1149. X            rm -f  ${BINDIR}/zcat || exit 1
  1150. X            ln -f ${BINDIR}/compress ${BINDIR}/zcat || exit 1
  1151. X            cp zcmp zdiff zmore ${BINDIR}/. || exit 1
  1152. X            chmod 0755 ${BINDIR}/compress ${BINDIR}/zcmp ${BINDIR}/zdiff \
  1153. X                       ${BINDIR}/zmore || exit 1
  1154. X            cp compress.1 zcmp.1 zmore.1 ${MANDIR}/. || exit 1
  1155. X            chmod 0644 ${MANDIR}/compress.1 ${MANDIR}/zcmp.1 \
  1156. X                       ${MANDIR}/zmore.1 || exit 1
  1157. X
  1158. X            if [ ".${var1}" != . ]
  1159. X            then
  1160. X                chown ${var1} ${BINDIR}/compress ${BINDIR}/zcmp \
  1161. X                              ${BINDIR}/zdiff ${BINDIR}/zmore \
  1162. X                              ${MANDIR}/compress.1 ${MANDIR}/zcmp.1 \
  1163. X                                 ${MANDIR}/zmore.1 
  1164. X            fi
  1165. X!
  1166. X        ) | (
  1167. X            if [ ".${var1}" = . ] ;    then sh 
  1168. X                                    else su - ${var1} -c sh ; fi
  1169. X        )
  1170. X
  1171. X        echo ""
  1172. X        echo ${n} "Press return to continue${c}"
  1173. X        read dummy
  1174. X        ;;
  1175. X
  1176. X    genmake)
  1177. X        options=
  1178. X        [ "${DIRENT}" = yes ] && options="${options} -DDIRENT=1"
  1179. X        [ "${SYSDIR}" = yes ] && options="${options} -DSYSDIR=1"
  1180. X        [ "${LSTAT}" != no  ] && options="${options} -DLSTAT=1"
  1181. X        [ "${UTIME_H}" != no  ] && options="${options} -DUTIME_H=1"
  1182. X        options="${options} -DUSERMEM=${USERMEM}"
  1183. X        options="${options} -DREGISTERS=${REGISTERS}"
  1184. X        options="${options} -DIBUFSIZ=${IBUFSIZ} -DOBUFSIZ=${OBUFSIZ}"
  1185. X        options="${options} -DBYTEORDER=${BYTEORDER}"
  1186. X        [ "${NOALLIGN}" = no ] && options="${options} -DNOALLIGN=1"
  1187. X        options="${options} ${EXTRA}"
  1188. X
  1189. X        cat - <<! >Makefile
  1190. X# Makefile generated by build.
  1191. X
  1192. X# C complier
  1193. XCC=${CC}
  1194. X
  1195. X# Install directory for binarys
  1196. XBINDIR=${BINDIR}
  1197. X
  1198. X# Install directory for manual
  1199. XMANDIR=${MANDIR}
  1200. X
  1201. X# compiler options:
  1202. X# options is a collection of:
  1203. X#
  1204. X#    -DDIRENT=1                    Use dirent.h
  1205. X#    -DSYSDIR=1                    Use sys/dir.h
  1206. X#    -DLSTAT=1                    Use lstat for finding symlinks.
  1207. X#    -DUTIME_H=1                    Use utime.h
  1208. X#    -DUSERMEM=<size>            Availble memory for compress (default 800k).
  1209. X#    -DREGISTERS=<nbr>            Number of registers (default 2).
  1210. X#    -DIBUFSIZ=<size>            Input buffer size (default BUFSIZ).
  1211. X#    -DOBUFSIZ=<size>            Output buffer size (default BUFSIZ)
  1212. X#    -DBYTEORDER=<order>            Byte order (default: unknown).
  1213. X#    -DNOALLIGN=1                Data word allignment (default: yes).
  1214. X#    -DDEF_ERRNO=1                Define error (not defined in errno.h).
  1215. X#    -DMAXSEG_64K=1 -BITS=16        Support segment processsor like 80286.
  1216. X#
  1217. Xoptions=${options}
  1218. X
  1219. X# libary options
  1220. XLBOPT=${LBOPT}
  1221. X
  1222. X
  1223. Xcompress:    Makefile compress42.c patchlevel.h
  1224. X    $(CC) -o compress $(options) "-DCOMPILE_DATE=\"\`date\`\"" compress42.c $(LBOPT)
  1225. X
  1226. Xinstall:    compress
  1227. X        [ -f ${BINDIR}/compress ] && \
  1228. X            { rm -f ${BINDIR}/compress.old ; \
  1229. X              mv ${BINDIR}/compress ${BINDIR}/compress.old ; }
  1230. X        rm -f ${BINDIR}/uncompress ${BINDIR}/zcat
  1231. X        cp compress ${BINDIR}/compress
  1232. X        strip ${BINDIR}/compress
  1233. X        rm -f ${BINDIR}/uncompress
  1234. X        ln ${BINDIR}/compress ${BINDIR}/uncompress
  1235. X        rm -f  ${BINDIR}/zcat
  1236. X        ln -f ${BINDIR}/compress ${BINDIR}/zcat
  1237. X        cp zcmp zdiff zmore ${BINDIR}/.
  1238. X        chmod 0755 ${BINDIR}/compress ${BINDIR}/zcmp ${BINDIR}/zdiff \
  1239. X                   ${BINDIR}/zmore
  1240. X        cp compress.1 zcmp.1 zmore.1 ${MANDIR}/.
  1241. X        chmod 0644 ${MANDIR}/compress.1 ${MANDIR}/zcmp.1 \
  1242. X                   ${MANDIR}/zmore.1
  1243. X
  1244. Xcleanup:
  1245. X        rm -f compress compress.def comp.log
  1246. X!
  1247. X        ;;
  1248. X
  1249. X    mkshar)
  1250. X        xshar -sc -opart -l64 MANIFEST Acknowleds zmore Changes compress.1 \
  1251. X            zcmp zmore.1 README LZW.INFO zcmp.1 zdiff build Makefile.def \
  1252. X            compress42.c patchlevel.h
  1253. X        ;;
  1254. X
  1255. X    mktar)
  1256. X        rm -f comp.tar
  1257. X        tar cvf comp.tar MANIFEST Acknowleds zmore Changes compress.1 \
  1258. X            zcmp zmore.1 README LZW.INFO zcmp.1 zdiff build Makefile.def \
  1259. X            compress42.c patchlevel.h
  1260. X        ;;
  1261. X
  1262. X    cleanup)
  1263. X        rm -f compress compress.def comp.log
  1264. X        exit 0
  1265. X        ;;
  1266. X
  1267. X    q|Q)
  1268. X        exit 0
  1269. X        ;;
  1270. X    *)
  1271. X        echo "                                      Unknown choice ${choice}"
  1272. X        sleep 2
  1273. X        ;;
  1274. X    esac
  1275. Xdone
  1276. END_OF_FILE
  1277. if test 19727 -ne `wc -c <'build'`; then
  1278.     echo shar: \"'build'\" unpacked with wrong size!
  1279. fi
  1280. chmod +x 'build'
  1281. # end of 'build'
  1282. fi
  1283. if test -f 'compress.1' -a "${1}" != "-c" ; then 
  1284.   echo shar: Will not clobber existing file \"'compress.1'\"
  1285. else
  1286. echo shar: Extracting \"'compress.1'\" \(6484 characters\)
  1287. sed "s/^X//" >'compress.1' <<'END_OF_FILE'
  1288. X.PU
  1289. X.TH COMPRESS 1 local
  1290. X.SH NAME
  1291. Xcompress, uncompress, zcat \- compress and expand data (version 4.1)
  1292. X.SH SYNOPSIS
  1293. X.ll +8
  1294. X.B compress
  1295. X[
  1296. X.B \-f
  1297. X] [
  1298. X.B \-v
  1299. X] [
  1300. X.B \-c
  1301. X] [
  1302. X.B \-V
  1303. X] [
  1304. X.B \-r
  1305. X] [
  1306. X.B \-b
  1307. X.I bits
  1308. X] [
  1309. X.I "name \&..."
  1310. X]
  1311. X.ll -8
  1312. X.br
  1313. X.B uncompress
  1314. X[
  1315. X.B \-f
  1316. X] [
  1317. X.B \-v
  1318. X] [
  1319. X.B \-c
  1320. X] [
  1321. X.B \-V
  1322. X] [
  1323. X.I "name \&..."
  1324. X]
  1325. X.br
  1326. X.B zcat
  1327. X[
  1328. X.B \-V
  1329. X] [
  1330. X.I "name \&..."
  1331. X]
  1332. X.SH DESCRIPTION
  1333. X.I Compress
  1334. Xreduces the size of the named files using adaptive Lempel-Ziv coding.
  1335. XWhenever possible,
  1336. Xeach file is replaced by one with the extension
  1337. X.B "\&.Z,"
  1338. Xwhile keeping the same ownership modes, access and modification times.
  1339. XIf no files are specified, the standard input is compressed to the
  1340. Xstandard output.
  1341. X.I Compress
  1342. Xwill only attempt to compress regular files.
  1343. XIn particular, it will ignore symbolic links. If a file has multiple
  1344. Xhard links,
  1345. X.I compress
  1346. Xwill refuse to compress it unless the
  1347. X.B \-f
  1348. Xflag is given.
  1349. X.PP
  1350. XIf
  1351. X.B \-f
  1352. Xis not given and
  1353. X.I compress
  1354. Xis run in the foreground,
  1355. Xthe user is prompted as to whether an existing file should be overwritten.
  1356. X.PP
  1357. XCompressed files can be restored to their original form using
  1358. X.I uncompress
  1359. Xor
  1360. X.I zcat.
  1361. X.PP
  1362. X.I uncompress
  1363. Xtakes a list of files on its command line and replaces each
  1364. Xfile whose name ends with
  1365. X.B "\&.Z"
  1366. Xand which begins with the correct magic number with an uncompressed
  1367. Xfile without the 
  1368. X.B "\&.Z."
  1369. XThe uncompressed file will have the mode, ownership and
  1370. Xtimestamps of the compressed file.
  1371. X.PP
  1372. XThe
  1373. X.B \-c
  1374. Xoption makes
  1375. X.I compress/uncompress
  1376. Xwrite to the standard output; no files are changed.
  1377. X.PP
  1378. X.I zcat
  1379. Xis identical to
  1380. X.I uncompress
  1381. X.B \-c.
  1382. X.I zcat
  1383. Xuncompresses either a list of files on the command line or its
  1384. Xstandard input and writes the uncompressed data on standard output.
  1385. X.I zcat
  1386. Xwill uncompress files that have the correct magic number whether
  1387. Xthey have a
  1388. X.B "\&.Z"
  1389. Xsuffix or not.
  1390. X.PP
  1391. XIf the
  1392. X.B \-r
  1393. Xflag is specified, 
  1394. X.I compress
  1395. Xwill operate recursively. If any of the file names specified on the command
  1396. Xline are directories, 
  1397. X.I compress
  1398. Xwill descend into the directory and compress all the files it finds there.
  1399. X.PP
  1400. XThe
  1401. X.B \-V
  1402. Xflag tells each of these programs to print its version and patchlevel,
  1403. Xalong with any preprocessor flags specified during compilation, on
  1404. Xstderr before doing any compression or uncompression.
  1405. X.PP
  1406. X.I Compress
  1407. Xuses the modified Lempel-Ziv algorithm popularized in
  1408. X"A Technique for High Performance Data Compression",
  1409. XTerry A. Welch,
  1410. X.I "IEEE Computer,"
  1411. Xvol. 17, no. 6 (June 1984), pp. 8-19.
  1412. XCommon substrings in the file are first replaced by 9-bit codes 257 and up.
  1413. XWhen code 512 is reached, the algorithm switches to 10-bit codes and
  1414. Xcontinues to use more bits until the
  1415. Xlimit specified by the
  1416. X.B \-b
  1417. Xflag is reached (default 16).
  1418. X.I Bits
  1419. Xmust be between 9 and 16.  The default can be changed in the source to allow
  1420. X.I compress
  1421. Xto be run on a smaller machine.
  1422. X.PP
  1423. XAfter the
  1424. X.I bits
  1425. Xlimit is attained,
  1426. X.I compress
  1427. Xperiodically checks the compression ratio.  If it is increasing,
  1428. X.I compress
  1429. Xcontinues to use the existing code dictionary.  However,
  1430. Xif the compression ratio decreases,
  1431. X.I compress
  1432. Xdiscards the table of substrings and rebuilds it from scratch.  This allows
  1433. Xthe algorithm to adapt to the next "block" of the file.
  1434. X.PP
  1435. XNote that the
  1436. X.B \-b
  1437. Xflag is omitted for
  1438. X.I uncompress,
  1439. Xsince the 
  1440. X.I bits
  1441. Xparameter specified during compression
  1442. Xis encoded within the output, along with
  1443. Xa magic number to ensure that neither decompression of random data nor
  1444. Xrecompression of compressed data is attempted. 
  1445. X.PP
  1446. X.ne 8
  1447. XThe amount of compression obtained depends on the size of the
  1448. Xinput, the number of
  1449. X.I bits
  1450. Xper code, and the distribution of common substrings.
  1451. XTypically, text such as source code or English
  1452. Xis reduced by 50\-60%.
  1453. XCompression is generally much better than that achieved by
  1454. XHuffman coding (as used in
  1455. X.IR pack ),
  1456. Xor adaptive Huffman coding
  1457. X.RI ( compact ),
  1458. Xand takes less time to compute.
  1459. X.PP
  1460. XUnder the
  1461. X.B \-v
  1462. Xoption,
  1463. Xa message is printed yielding the percentage of
  1464. Xreduction for each file compressed.
  1465. X.PP
  1466. XExit status is normally 0;
  1467. Xif the last file is larger after (attempted) compression, the status is 2;
  1468. Xif an error occurs, exit status is 1.
  1469. X.SH "SEE ALSO"
  1470. Xpack(1), compact(1)
  1471. X.SH "DIAGNOSTICS"
  1472. XUsage: compress [\-dfvcVr] [\-b maxbits] [file ...]
  1473. X.in +8
  1474. XInvalid options were specified on the command line.
  1475. X.in -8
  1476. XMissing maxbits
  1477. X.in +8
  1478. XMaxbits must follow
  1479. X.BR \-b \.
  1480. X.in -8
  1481. X.IR file :
  1482. Xnot in compressed format
  1483. X.in +8
  1484. XThe file specified to
  1485. X.I uncompress
  1486. Xhas not been compressed.
  1487. X.in -8
  1488. X.IR file :
  1489. Xcompressed with 
  1490. X.I xx
  1491. Xbits, can only handle 
  1492. X.I yy
  1493. Xbits
  1494. X.in +8
  1495. X.I File
  1496. Xwas compressed by a program that could deal with
  1497. Xmore 
  1498. X.I bits
  1499. Xthan the compress code on this machine.
  1500. XRecompress the file with smaller
  1501. X.IR bits \.
  1502. X.in -8
  1503. X.IR file :
  1504. Xalready has .Z suffix -- no change
  1505. X.in +8
  1506. XThe file is assumed to be already compressed.
  1507. XRename the file and try again.
  1508. X.in -8
  1509. X.IR file :
  1510. Xfilename too long to tack on .Z
  1511. X.in +8
  1512. XThe file cannot be compressed because its name is longer than
  1513. X12 characters.
  1514. XRename and try again.
  1515. XThis message does not occur on BSD systems.
  1516. X.in -8
  1517. X.I file
  1518. Xalready exists; do you wish to overwrite (y or n)?
  1519. X.in +8
  1520. XRespond "y" if you want the output file to be replaced; "n" if not.
  1521. X.in -8
  1522. Xuncompress: corrupt input
  1523. X.in +8
  1524. XA SIGSEGV violation was detected which usually means that the input file has
  1525. Xbeen corrupted.
  1526. X.in -8
  1527. XCompression: 
  1528. X.I "xx.xx%"
  1529. X.in +8
  1530. XPercentage of the input saved by compression.
  1531. X(Relevant only for
  1532. X.BR \-v \.)
  1533. X.in -8
  1534. X-- not a regular file or directory: ignored
  1535. X.in +8
  1536. XWhen the input file is not a regular file or directory,
  1537. X(e.g. a symbolic link, socket, FIFO, device file), it is
  1538. Xleft unaltered.
  1539. X.in -8
  1540. X-- has 
  1541. X.I xx 
  1542. Xother links: unchanged
  1543. X.in +8
  1544. XThe input file has links; it is left unchanged.  See
  1545. X.IR ln "(1)"
  1546. Xfor more information. Use the
  1547. X.B \-f
  1548. Xflag to force compression of multiply-linked files.
  1549. X.in -8
  1550. X-- file unchanged
  1551. X.in +8
  1552. XNo savings is achieved by
  1553. Xcompression.  The input remains virgin.
  1554. X.in -8
  1555. X.SH "BUGS"
  1556. XAlthough compressed files are compatible between machines with large memory,
  1557. X.BR \-b \12
  1558. Xshould be used for file transfer to architectures with 
  1559. Xa small process data space (64KB or less, as exhibited by the DEC PDP
  1560. Xseries, the Intel 80286, etc.)
  1561. X.PP
  1562. XInvoking compress with a \-r
  1563. Xflag will occasionally cause it to produce spurious error warnings of the form
  1564. X.PP
  1565. X.in 8
  1566. X"<filename>.Z already has .Z suffix - ignored"
  1567. X.in -8
  1568. X.PP
  1569. XThese warnings can be ignored. See the comments in compress.c:compdir()
  1570. Xfor an explanation.
  1571. X
  1572. END_OF_FILE
  1573. if test 6484 -ne `wc -c <'compress.1'`; then
  1574.     echo shar: \"'compress.1'\" unpacked with wrong size!
  1575. fi
  1576. # end of 'compress.1'
  1577. fi
  1578. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1579.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1580. else
  1581. echo shar: Extracting \"'patchlevel.h'\" \(76 characters\)
  1582. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1583. Xstatic char    ident[] = "@(#)(N)compress 4.2.3";
  1584. X#define    version_id (ident+4)
  1585. END_OF_FILE
  1586. if test 76 -ne `wc -c <'patchlevel.h'`; then
  1587.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1588. fi
  1589. # end of 'patchlevel.h'
  1590. fi
  1591. if test -f 'zcmp' -a "${1}" != "-c" ; then 
  1592.   echo shar: Will not clobber existing file \"'zcmp'\"
  1593. else
  1594. echo shar: Extracting \"'zcmp'\" \(772 characters\)
  1595. sed "s/^X//" >'zcmp' <<'END_OF_FILE'
  1596. X:
  1597. X#!/bin/sh
  1598. X
  1599. XOPTIONS=
  1600. XFILES=
  1601. Xfor ARG
  1602. Xdo
  1603. X    case "$ARG" in
  1604. X    -*)    OPTIONS="$OPTIONS $ARG";;
  1605. X    *)    FILES="$FILES $ARG";;
  1606. X    esac
  1607. Xdone
  1608. Xif test -z "$FILES"; then
  1609. X    echo "Usage: zcmp [cmp_options] file [file]"
  1610. X    exit 1
  1611. Xfi
  1612. Xset $FILES
  1613. Xif test $# -eq 1; then
  1614. X    FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
  1615. X    zcat $FILE | cmp $OPTIONS - $FILE
  1616. X    STAT="$?"
  1617. Xelif test $# -eq 2; then
  1618. X    case "$1" in
  1619. X    *.Z)    case "$2" in
  1620. X        *.Z)    F=`basename $2 .Z`
  1621. X            zcat $2 > /tmp/$F.$$
  1622. X            zcat $1 | cmp $OPTIONS - /tmp/$F.$$
  1623. X            STAT="$?";;
  1624. X        *)    zcat $1 | cmp $OPTIONS - $2;;
  1625. X        esac;;
  1626. X    *)    case "$2" in
  1627. X        *.Z)    F=`basename $2 .Z`
  1628. X            zcat $2 > /tmp/$F.$$
  1629. X            cmp $OPTIONS $1 /tmp/$F.$$
  1630. X            STAT="$?";;
  1631. X        *)    cmp $OPTIONS $1 $2
  1632. X            STAT="$?";;
  1633. X        esac;;
  1634. X    esac
  1635. X    exit "$STAT"
  1636. Xelse
  1637. X    echo "Usage: zcmp [cmp_options] file [file]"
  1638. X    exit 1
  1639. Xfi
  1640. END_OF_FILE
  1641. if test 772 -ne `wc -c <'zcmp'`; then
  1642.     echo shar: \"'zcmp'\" unpacked with wrong size!
  1643. fi
  1644. chmod +x 'zcmp'
  1645. # end of 'zcmp'
  1646. fi
  1647. if test -f 'zcmp.1' -a "${1}" != "-c" ; then 
  1648.   echo shar: Will not clobber existing file \"'zcmp.1'\"
  1649. else
  1650. echo shar: Extracting \"'zcmp.1'\" \(797 characters\)
  1651. sed "s/^X//" >'zcmp.1' <<'END_OF_FILE'
  1652. X.TH ZCMP 1
  1653. X.SH NAME
  1654. Xzcmp, zdiff \- compare compressed files
  1655. X.SH SYNOPSIS
  1656. X.B zcmp
  1657. X[ cmp_options ] file1
  1658. X[ file2 ]
  1659. X.br
  1660. X.B zdiff
  1661. X[ diff_options ] file1
  1662. X[ file2 ]
  1663. X.SH DESCRIPTION
  1664. X.I  Zcmp
  1665. Xand 
  1666. X.I zdiff
  1667. Xare used to invoke the
  1668. X.I cmp
  1669. Xor the
  1670. X.I diff
  1671. Xprogram on compressed files.  All options specified are passed directly to
  1672. X.I cmp
  1673. Xor
  1674. X.IR diff "."
  1675. XIf only 1 file is specified, then the files compared are
  1676. X.I file1
  1677. Xand an uncompressed
  1678. X.IR file1 ".Z."
  1679. XIf two files are specified, then they are uncompressed (if ending with ".Z")
  1680. Xand fed to
  1681. X.I cmp
  1682. Xor
  1683. X.IR diff "."
  1684. XThe exit status from 
  1685. X.I cmp
  1686. Xor
  1687. X.I diff
  1688. Xis preserved.
  1689. X.SH "SEE ALSO"
  1690. Xcmp(1), diff(1), zmore(1), zcat(1), compress(1), uncompress(1)
  1691. X.SH BUGS
  1692. XMessages from the
  1693. X.I cmp
  1694. Xor
  1695. X.I diff
  1696. Xprograms refer to temporary filenames instead of those specified.
  1697. END_OF_FILE
  1698. if test 797 -ne `wc -c <'zcmp.1'`; then
  1699.     echo shar: \"'zcmp.1'\" unpacked with wrong size!
  1700. fi
  1701. # end of 'zcmp.1'
  1702. fi
  1703. if test -f 'zdiff' -a "${1}" != "-c" ; then 
  1704.   echo shar: Will not clobber existing file \"'zdiff'\"
  1705. else
  1706. echo shar: Extracting \"'zdiff'\" \(736 characters\)
  1707. sed "s/^X//" >'zdiff' <<'END_OF_FILE'
  1708. X:
  1709. X#!/bin/sh
  1710. X
  1711. XOPTIONS=
  1712. XFILES=
  1713. Xfor ARG
  1714. Xdo
  1715. X    case "$ARG" in
  1716. X    -*)    OPTIONS="$OPTIONS $ARG";;
  1717. X    *)    FILES="$FILES $ARG";;
  1718. X    esac
  1719. Xdone
  1720. Xif test -z "$FILES"; then
  1721. X    echo "Usage: zdiff [diff_options] file [file]"
  1722. X    exit 1
  1723. Xfi
  1724. Xset $FILES
  1725. Xif test $# -eq 1; then
  1726. X    FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
  1727. X    zcat $FILE | diff $OPTIONS - $FILE
  1728. X    STAT="$?"
  1729. Xelif test $# -eq 2; then
  1730. X    case "$1" in
  1731. X    *.Z)    case "$2" in
  1732. X        *.Z)    F=`basename $2 .Z`
  1733. X            zcat $2 > /tmp/$F.$$
  1734. X            zcat $1 | diff $OPTIONS - /tmp/$F.$$
  1735. X            STAT="$?";;
  1736. X        *)    zcat $1 | diff $OPTIONS - $2;;
  1737. X        esac;;
  1738. X    *)    case "$2" in
  1739. X        *.Z)    zcat $2 | diff $OPTIONS $1 -
  1740. X            STAT="$?";;
  1741. X        *)    diff $OPTIONS $1 $2
  1742. X            STAT="$?";;
  1743. X        esac;;
  1744. X    esac
  1745. X    exit "$STAT"
  1746. Xelse
  1747. X    echo "Usage: zdiff [diff_options] file [file]"
  1748. X    exit 1
  1749. Xfi
  1750. END_OF_FILE
  1751. if test 736 -ne `wc -c <'zdiff'`; then
  1752.     echo shar: \"'zdiff'\" unpacked with wrong size!
  1753. fi
  1754. chmod +x 'zdiff'
  1755. # end of 'zdiff'
  1756. fi
  1757. if test -f 'zmore' -a "${1}" != "-c" ; then 
  1758.   echo shar: Will not clobber existing file \"'zmore'\"
  1759. else
  1760. echo shar: Extracting \"'zmore'\" \(319 characters\)
  1761. sed "s/^X//" >'zmore' <<'END_OF_FILE'
  1762. X:
  1763. X#!/bin/sh
  1764. X
  1765. XFIRST=1
  1766. Xfor FILE
  1767. Xdo
  1768. X    if test $FIRST -eq 0; then
  1769. X        echo "--More--(Next file: $FILE)\c"
  1770. X        stty cbreak -echo
  1771. X        ANS=`dd bs=1 count=1 2>/dev/null` 
  1772. X        stty -cbreak echo
  1773. X        echo " "
  1774. X        if test "$ANS" = 'e'; then
  1775. X            exit
  1776. X        fi
  1777. X    fi
  1778. X    echo "------> $FILE <------"
  1779. X    zcat $FILE | more
  1780. X    if test -t; then
  1781. X        FIRST=0
  1782. X    fi
  1783. Xdone
  1784. END_OF_FILE
  1785. if test 319 -ne `wc -c <'zmore'`; then
  1786.     echo shar: \"'zmore'\" unpacked with wrong size!
  1787. fi
  1788. chmod +x 'zmore'
  1789. # end of 'zmore'
  1790. fi
  1791. if test -f 'zmore.1' -a "${1}" != "-c" ; then 
  1792.   echo shar: Will not clobber existing file \"'zmore.1'\"
  1793. else
  1794. echo shar: Extracting \"'zmore.1'\" \(3702 characters\)
  1795. sed "s/^X//" >'zmore.1' <<'END_OF_FILE'
  1796. X.TH ZMORE 1
  1797. X.SH NAME
  1798. Xzmore \- file perusal filter for crt viewing of compressed text
  1799. X.SH SYNOPSIS
  1800. X.B zmore
  1801. X[ name ...  ]
  1802. X.SH DESCRIPTION
  1803. X.I  Zmore
  1804. Xis a filter which allows examination of compressed text files
  1805. Xone screenful at a time on a soft-copy terminal.
  1806. XIt normally pauses after each screenful, printing --More--
  1807. Xat the bottom of the screen.
  1808. XIf the user then types a carriage return, one more line is displayed.
  1809. XIf the user hits a space,
  1810. Xanother screenful is displayed.  Other possibilites are enumerated later.
  1811. X.PP
  1812. X.I Zmore
  1813. Xlooks in the file
  1814. X.I /etc/termcap
  1815. Xto determine terminal characteristics,
  1816. Xand to determine the default window size.
  1817. XOn a terminal capable of displaying 24 lines,
  1818. Xthe default window size is 22 lines.
  1819. X.PP
  1820. XOther sequences which may be typed when
  1821. X.I zmore
  1822. Xpauses, and their effects, are as follows (\fIi\fP is an optional integer
  1823. Xargument, defaulting to 1) :
  1824. X.PP
  1825. X.IP \fIi\|\fP<space>
  1826. Xdisplay
  1827. X.I i
  1828. Xmore lines, (or another screenful if no argument is given)
  1829. X.PP
  1830. X.IP ^D
  1831. Xdisplay 11 more lines (a ``scroll'').
  1832. XIf
  1833. X.I i
  1834. Xis given, then the scroll size is set to \fIi\|\fP.
  1835. X.PP
  1836. X.IP d
  1837. Xsame as ^D (control-D)
  1838. X.PP
  1839. X.IP \fIi\|\fPz
  1840. Xsame as typing a space except that \fIi\|\fP, if present, becomes the new
  1841. Xwindow size.  Note that the window size reverts back to the default at the
  1842. Xend of the current file.
  1843. X.PP
  1844. X.IP \fIi\|\fPs
  1845. Xskip \fIi\|\fP lines and print a screenful of lines
  1846. X.PP
  1847. X.IP \fIi\|\fPf
  1848. Xskip \fIi\fP screenfuls and print a screenful of lines
  1849. X.PP
  1850. X.IP "q or Q"
  1851. Xquit reading the current file; go on to the next (if any)
  1852. X.PP
  1853. X.IP e
  1854. XWhen the prompt --More--(Next file: 
  1855. X.IR file )
  1856. Xis printed, this command causes zmore to exit.
  1857. X.PP 
  1858. X.IP =
  1859. XDisplay the current line number.
  1860. X.PP
  1861. X.IP \fIi\|\fP/expr
  1862. Xsearch for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP
  1863. XIf the pattern is not found,
  1864. X.I zmore
  1865. Xgoes on to the next file (if any).
  1866. XOtherwise, a screenful is displayed, starting two lines before the place
  1867. Xwhere the expression was found.
  1868. XThe user's erase and kill characters may be used to edit the regular
  1869. Xexpression.
  1870. XErasing back past the first column cancels the search command.
  1871. X.PP
  1872. X.IP \fIi\|\fPn
  1873. Xsearch for the \fIi\|\fP-th occurrence of the last regular expression entered.
  1874. X.PP
  1875. X.IP !command
  1876. Xinvoke a shell with \fIcommand\|\fP. 
  1877. XThe character `!' in "command" are replaced with the
  1878. Xthe previous shell command.  The sequence "\\!" is replaced by "!".
  1879. X.PP
  1880. X.IP ":q or :Q"
  1881. Xquit reading the current file; go on to the next (if any)
  1882. X(same as q or Q).
  1883. X.PP
  1884. X.IP .
  1885. X(dot) repeat the previous command.
  1886. X.PP
  1887. XThe commands take effect immediately, i.e., it is not necessary to
  1888. Xtype a carriage return.
  1889. XUp to the time when the command character itself is given,
  1890. Xthe user may hit the line kill character to cancel the numerical
  1891. Xargument being formed.
  1892. XIn addition, the user may hit the erase character to redisplay the
  1893. X--More-- message.
  1894. X.PP
  1895. XAt any time when output is being sent to the terminal, the user can
  1896. Xhit the quit key (normally control\-\\).
  1897. X.I Zmore
  1898. Xwill stop sending output, and will display the usual --More--
  1899. Xprompt.
  1900. XThe user may then enter one of the above commands in the normal manner.
  1901. XUnfortunately, some output is lost when this is done, due to the
  1902. Xfact that any characters waiting in the terminal's output queue
  1903. Xare flushed when the quit signal occurs.
  1904. X.PP
  1905. XThe terminal is set to
  1906. X.I noecho
  1907. Xmode by this program so that the output can be continuous.
  1908. XWhat you type will thus not show on your terminal, except for the / and !
  1909. Xcommands.
  1910. X.PP
  1911. XIf the standard output is not a teletype, then
  1912. X.I zmore
  1913. Xacts just like
  1914. X.I zcat,
  1915. Xexcept that a header is printed before each file.
  1916. X.SH FILES
  1917. X.DT
  1918. X/etc/termcap        Terminal data base
  1919. X.SH "SEE ALSO"
  1920. Xmore(1), zcat(1), compress(1), uncompress(1)
  1921. END_OF_FILE
  1922. if test 3702 -ne `wc -c <'zmore.1'`; then
  1923.     echo shar: \"'zmore.1'\" unpacked with wrong size!
  1924. fi
  1925. # end of 'zmore.1'
  1926. fi
  1927. echo shar: End of archive 1 \(of 2\).
  1928. cp /dev/null ark1isdone
  1929. MISSING=""
  1930. for I in 1 2 ; do
  1931.     if test ! -f ark${I}isdone ; then
  1932.     MISSING="${MISSING} ${I}"
  1933.     fi
  1934. done
  1935. if test "${MISSING}" = "" ; then
  1936.     echo You have unpacked both archives.
  1937.     rm -f ark[1-9]isdone
  1938. else
  1939.     echo You still need to unpack the following archives:
  1940.     echo "        " ${MISSING}
  1941. fi
  1942. ##  End of shell archive.
  1943. exit 0
  1944. exit 0 # Just in case...
  1945. -- 
  1946.         Andrew Patrick acting as Comp.Sources.Reviewed Moderator
  1947.               Department of Communications, Ottawa, CANADA
  1948.                          csr@calvin.dgbt.doc.CA
  1949.