[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 06/07: Drop removed files
From: |
Samuel Thibault |
Subject: |
[hurd] 06/07: Drop removed files |
Date: |
Mon, 16 Sep 2013 07:41:31 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch master
in repository hurd.
commit c0ae7d7f3a266b558409adb61b9c9c4cdf3315e8
Author: Samuel Thibault <address@hidden>
Date: Mon Sep 16 01:41:19 2013 +0000
Drop removed files
---
exec/crypt.h | 12 -
exec/do-bunzip2.c | 1745 ---------------------------------------------------
exec/gzip.h | 315 ----------
exec/inflate.c | 954 ----------------------------
exec/tailor.h | 14 -
exec/unzip.c | 199 ------
exec/util.c | 272 --------
proc/exc-reply.defs | 36 --
8 files changed, 3547 deletions(-)
diff --git a/exec/crypt.h b/exec/crypt.h
deleted file mode 100644
index 2a4c203..0000000
--- a/exec/crypt.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* crypt.h (dummy version) -- do not perform encryption
- * Hardly worth copyrighting :-)
- */
-
-#ifdef CRYPT
-# undef CRYPT /* dummy version */
-#endif
-
-#define RAND_HEAD_LEN 12 /* length of encryption random header */
-
-#define zencode
-#define zdecode
diff --git a/exec/do-bunzip2.c b/exec/do-bunzip2.c
deleted file mode 100644
index 716a0cd..0000000
--- a/exec/do-bunzip2.c
+++ /dev/null
@@ -1,1745 +0,0 @@
-/* bunzip2 engine, modified by address@hidden */
-
-/* Stolen from util.c. */
-#include <stdio.h>
-#include <sys/types.h>
-
-/* I/O interface */
-extern int (*unzip_read) (char *buf, size_t maxread);
-extern void (*unzip_write) (const char *buf, size_t nwrite);
-extern void (*unzip_read_error) (void);
-extern void (*unzip_error) (const char *msg);
-
-/* bzip2 doesn't require window sliding. Just for buffering. */
-#define INBUFSIZ 0x1000
-#define OUTBUFSIZ 0x1000
-
-static unsigned char inbuf[INBUFSIZ];
-static unsigned char outbuf[OUTBUFSIZ];
-static unsigned inptr;
-static unsigned insize;
-static unsigned outcnt;
-
-/* ===========================================================================
- * Fill the input buffer. This is called only when the buffer is empty.
- */
-static int
-fill_inbuf (int eof_ok)
-{
- int len;
-
- /* Read as much as possible */
- insize = 0;
- do
- {
- len = (*unzip_read)((char*)inbuf+insize, INBUFSIZ-insize);
- if (len == 0 || len == EOF)
- break;
- insize += len;
- }
- while (insize < INBUFSIZ);
-
- if (insize == 0)
- {
- if (eof_ok)
- return EOF;
- unzip_read_error();
- }
-
- inptr = 1;
- return inbuf[0];
-}
-
-static void
-flush_outbuf (void)
-{
- if (outcnt == 0)
- return;
-
- (*unzip_write) ((char *) outbuf, outcnt);
- outcnt = 0;
-}
-
-static inline int
-bz2_getc (void *stream)
-{
- return inptr < insize ? inbuf[inptr++] : fill_inbuf (1);
-}
-
-static inline int
-bz2_putc (int c, void *stream)
-{
- if (outcnt == OUTBUFSIZ)
- flush_outbuf ();
- outbuf[outcnt++] = c;
- return c;
-}
-
-static inline int
-bz2_ferror (void *stream)
-{
- return 0;
-}
-
-static inline int
-bz2_fflush (void *stream)
-{
- flush_outbuf ();
- return 0;
-}
-
-static inline int
-bz2_fclose (void *stream)
-{
- flush_outbuf ();
- return 0;
-}
-
-#define fprintf(s, f...) /**/
-
-
-/*-----------------------------------------------------------*/
-/*--- A block-sorting, lossless compressor bzip2.c ---*/
-/*-----------------------------------------------------------*/
-
-/*--
- This program is bzip2, a lossless, block-sorting data compressor,
- version 0.1pl2, dated 29-Aug-1997.
-
- Copyright (C) 1996, 1997 by Julian Seward.
- Guildford, Surrey, UK
- email: address@hidden
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- The GNU General Public License is contained in the file LICENSE.
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the file ALGORITHMS.
---*/
-
-/*----------------------------------------------------*/
-/*--- IMPORTANT ---*/
-/*----------------------------------------------------*/
-
-/*--
- WARNING:
- This program (attempts to) compress data by performing several
- non-trivial transformations on it. Unless you are 100% familiar
- with *all* the algorithms contained herein, and with the
- consequences of modifying them, you should NOT meddle with the
- compression or decompression machinery. Incorrect changes can
- and very likely *will* lead to disastrous loss of data.
-
- DISCLAIMER:
- I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
- USE OF THIS PROGRAM, HOWSOEVER CAUSED.
-
- Every compression of a file implies an assumption that the
- compressed file can be decompressed to reproduce the original.
- Great efforts in design, coding and testing have been made to
- ensure that this program works correctly. However, the
- complexity of the algorithms, and, in particular, the presence
- of various special cases in the code which occur with very low
- but non-zero probability make it impossible to rule out the
- possibility of bugs remaining in the program. DO NOT COMPRESS
- ANY DATA WITH THIS PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE
- POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.
-
- That is not to say this program is inherently unreliable.
- Indeed, I very much hope the opposite is true. bzip2 has been
- carefully constructed and extensively tested.
-
- PATENTS:
- To the best of my knowledge, bzip2 does not use any patented
- algorithms. However, I do not have the resources available to
- carry out a full patent search. Therefore I cannot give any
- guarantee of the above statement.
---*/
-
-
-
-/*----------------------------------------------------*/
-/*--- and now for something much more pleasant :-) ---*/
-/*----------------------------------------------------*/
-
-/*---------------------------------------------*/
-/*--
- Place a 1 beside your platform, and 0 elsewhere.
---*/
-
-/*--
- Generic 32-bit Unix.
- Also works on 64-bit Unix boxes.
---*/
-#define BZ_UNIX 1
-
-/*--
- Win32, as seen by Jacob Navia's excellent
- port of (Chris Fraser & David Hanson)'s excellent
- lcc compiler.
---*/
-#define BZ_LCCWIN32 0
-
-
-
-/*---------------------------------------------*/
-/*--
- Some stuff for all platforms.
---*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#if DEBUG
- #include <assert.h>
-#endif
-#include <string.h>
-#include <signal.h>
-#include <math.h>
-
-#define ERROR_IF_EOF(i) { if ((i) == EOF) ioError(); }
-#define ERROR_IF_NOT_ZERO(i) { if ((i) != 0) ioError(); }
-#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); }
-
-
-/*---------------------------------------------*/
-/*--
- Platform-specific stuff.
---*/
-
-#if BZ_UNIX
- #include <sys/types.h>
- #include <utime.h>
- #include <unistd.h>
- #include <malloc.h>
- #include <sys/stat.h>
- #include <sys/times.h>
-
- #define Int32 int
- #define UInt32 unsigned int
- #define Char char
- #define UChar unsigned char
- #define Int16 short
- #define UInt16 unsigned short
-
- #define PATH_SEP '/'
- #define MY_LSTAT lstat
- #define MY_S_IFREG S_ISREG
- #define MY_STAT stat
-
- #define APPEND_FILESPEC(root, name) \
- root=snocString((root), (name))
-
- #define SET_BINARY_MODE(fd) /**/
-
- /*--
- You should try very hard to persuade your C compiler
- to inline the bits marked INLINE. Otherwise bzip2 will
- run rather slowly. gcc version 2.x is recommended.
- --*/
- #ifdef __GNUC__
- #define INLINE inline
- #define NORETURN __attribute__ ((noreturn))
- #else
- #define INLINE /**/
- #define NORETURN /**/
- #endif
-#endif
-
-
-
-#if BZ_LCCWIN32
- #include <io.h>
- #include <fcntl.h>
- #include <sys\stat.h>
-
- #define Int32 int
- #define UInt32 unsigned int
- #define Int16 short
- #define UInt16 unsigned short
- #define Char char
- #define UChar unsigned char
-
- #define INLINE /**/
- #define NORETURN /**/
- #define PATH_SEP '\\'
- #define MY_LSTAT _stat
- #define MY_STAT _stat
- #define MY_S_IFREG(x) ((x) & _S_IFREG)
-
- #if 0
- /*-- lcc-win32 seems to expand wildcards itself --*/
- #define APPEND_FILESPEC(root, spec) \
- do { \
- if ((spec)[0] == '-') { \
- root = snocString((root), (spec)); \
- } else { \
- struct _finddata_t c_file; \
- long hFile; \
- hFile = _findfirst((spec), &c_file); \
- if ( hFile == -1L ) { \
- root = snocString ((root), (spec)); \
- } else { \
- int anInt = 0; \
- while ( anInt == 0 ) { \
- root = snocString((root), \
- &c_file.name[0]); \
- anInt = _findnext(hFile, &c_file); \
- } \
- } \
- } \
- } while ( 0 )
- #else
- #define APPEND_FILESPEC(root, name) \
- root = snocString ((root), (name))
- #endif
-
- #define SET_BINARY_MODE(fd) \
- do { \
- int retVal = setmode ( fileno ( fd ), \
- O_BINARY ); \
- ERROR_IF_MINUS_ONE ( retVal ); \
- } while ( 0 )
-
-#endif
-
-
-/*---------------------------------------------*/
-/*--
- Some more stuff for all platforms :-)
---*/
-
-#define Bool unsigned char
-#define True 1
-#define False 0
-
-/*--
- IntNative is your platform's `native' int size.
- Only here to avoid probs with 64-bit platforms.
---*/
-#define IntNative int
-
-
-/*--
- change to 1, or compile with -DDEBUG=1 to debug
---*/
-#ifndef DEBUG
-#define DEBUG 0
-#endif
-
-
-/*---------------------------------------------------*/
-/*--- ---*/
-/*---------------------------------------------------*/
-
-/*--
- Implementation notes, July 1997
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- Memory allocation
- ~~~~~~~~~~~~~~~~~
- All large data structures are allocated on the C heap,
- for better or for worse. That includes the various
- arrays of pointers, striped words, bytes, frequency
- tables and buffers for compression and decompression.
-
- bzip2 can operate at various block-sizes, ranging from
- 100k to 900k in 100k steps, and it allocates only as
- much as it needs to. When compressing, we know from the
- command-line options what the block-size is going to be,
- so all allocation can be done at start-up; if that
- succeeds, there can be no further allocation problems.
-
- Decompression is more complicated. Each compressed file
- contains, in its header, a byte indicating the block
- size used for compression. This means bzip2 potentially
- needs to reallocate memory for each file it deals with,
- which in turn opens the possibility for a memory allocation
- failure part way through a run of files, by encountering
- a file requiring a much larger block size than all the
- ones preceding it.
-
- The policy is to simply give up if a memory allocation
- failure occurs. During decompression, it would be
- possible to move on to subsequent files in the hope that
- some might ask for a smaller block size, but the
- complications for doing this seem more trouble than they
- are worth.
-
-
- Compressed file formats
- ~~~~~~~~~~~~~~~~~~~~~~~
- [This is now entirely different from both 0.21, and from
- any previous Huffman-coded variant of bzip.
- See the associated file bzip2.txt for details.]
-
-
- Error conditions
- ~~~~~~~~~~~~~~~~
- Dealing with error conditions is the least satisfactory
- aspect of bzip2. The policy is to try and leave the
- filesystem in a consistent state, then quit, even if it
- means not processing some of the files mentioned in the
- command line. `A consistent state' means that a file
- exists either in its compressed or uncompressed form,
- but not both. This boils down to the rule `delete the
- output file if an error condition occurs, leaving the
- input intact'. Input files are only deleted when we can
- be pretty sure the output file has been written and
- closed successfully.
-
- Errors are a dog because there's so many things to
- deal with. The following can happen mid-file, and
- require cleaning up.
-
- internal `panics' -- indicating a bug
- corrupted or inconsistent compressed file
- can't allocate enough memory to decompress this file
- I/O error reading/writing/opening/closing
- signal catches -- Control-C, SIGTERM, SIGHUP.
-
- Other conditions, primarily pertaining to file names,
- can be checked in-between files, which makes dealing
- with them easier.
---*/
-
-
-
-/*---------------------------------------------------*/
-/*--- Misc (file handling) data decls ---*/
-/*---------------------------------------------------*/
-
-static UInt32 bytesIn, bytesOut;
-static Int32 verbosity;
-static Bool smallMode;
-static UInt32 globalCrc;
-
-
-
-
-static void panic ( Char* );
-static void ioError ( void );
-static void uncompressOutOfMemory ( Int32, Int32 );
-static void blockOverrun ( void );
-static void badBlockHeader ( void );
-static void crcError ( UInt32, UInt32 );
-static void cleanUpAndFail ( Int32 );
-static void compressedStreamEOF ( void );
-
-
-
-/*---------------------------------------------------*/
-/*--- Data decls for the front end ---*/
-/*---------------------------------------------------*/
-
-/*--
- The overshoot bytes allow us to avoid most of
- the cost of pointer renormalisation during
- comparison of rotations in sorting.
- The figure of 20 is derived as follows:
- qSort3 allows an overshoot of up to 10.
- It then calls simpleSort, which calls
- fullGtU, also with max overshoot 10.
- fullGtU does up to 10 comparisons without
- renormalising, giving 10+10 == 20.
---*/
-#define NUM_OVERSHOOT_BYTES 20
-
-/*--
- These are the main data structures for
- the Burrows-Wheeler transform.
---*/
-
-/*--
- Pointers to compression and decompression
- structures. Set by
- allocateCompressStructures and
- setDecompressStructureSizes
-
- The structures are always set to be suitable
- for a block of size 100000 * blockSize100k.
---*/
-static UInt16 *ll16; /*-- small decompress --*/
-static UChar *ll4; /*-- small decompress --*/
-
-static Int32 *tt; /*-- fast decompress --*/
-static UChar *ll8; /*-- fast decompress --*/
-
-
-/*--
- freq table collected to save a pass over the data
- during decompression.
---*/
-static Int32 unzftab[256];
-
-
-/*--
- index of the last char in the block, so
- the block size == last + 1.
---*/
-static Int32 last;
-
-
-/*--
- index in zptr[] of original string after sorting.
---*/
-static Int32 origPtr;
-
-
-/*--
- always: in the range 0 .. 9.
- The current block size is 100000 * this number.
---*/
-static Int32 blockSize100k;
-
-
-/*--
- Used when sorting. If too many long comparisons
- happen, we stop sorting, randomise the block
- slightly, and try again.
---*/
-
-static Bool blockRandomised;
-
-
-
-/*---------------------------------------------------*/
-/*--- Data decls for the back end ---*/
-/*---------------------------------------------------*/
-
-#define MAX_ALPHA_SIZE 258
-#define MAX_CODE_LEN 23
-
-#define RUNA 0
-#define RUNB 1
-
-#define N_GROUPS 6
-#define G_SIZE 50
-#define N_ITERS 4
-
-#define MAX_SELECTORS (2 + (900000 / G_SIZE))
-
-static Bool inUse[256];
-static Int32 nInUse;
-
-static UChar seqToUnseq[256];
-static UChar unseqToSeq[256];
-
-static UChar selector [MAX_SELECTORS];
-static UChar selectorMtf[MAX_SELECTORS];
-
-static UChar len [N_GROUPS][MAX_ALPHA_SIZE];
-
-/*-- decompress only --*/
-static Int32 limit [N_GROUPS][MAX_ALPHA_SIZE];
-static Int32 base [N_GROUPS][MAX_ALPHA_SIZE];
-static Int32 perm [N_GROUPS][MAX_ALPHA_SIZE];
-static Int32 minLens[N_GROUPS];
-
-
-/*---------------------------------------------------*/
-/*--- 32-bit CRC grunge ---*/
-/*---------------------------------------------------*/
-
-/*--
- I think this is an implementation of the AUTODIN-II,
- Ethernet & FDDI 32-bit CRC standard. Vaguely derived
- from code by Rob Warnock, in Section 51 of the
- comp.compression FAQ.
---*/
-
-static UInt32 crc32Table[256] = {
-
- /*-- Ugly, innit? --*/
-
- 0x00000000UL, 0x04c11db7UL, 0x09823b6eUL, 0x0d4326d9UL,
- 0x130476dcUL, 0x17c56b6bUL, 0x1a864db2UL, 0x1e475005UL,
- 0x2608edb8UL, 0x22c9f00fUL, 0x2f8ad6d6UL, 0x2b4bcb61UL,
- 0x350c9b64UL, 0x31cd86d3UL, 0x3c8ea00aUL, 0x384fbdbdUL,
- 0x4c11db70UL, 0x48d0c6c7UL, 0x4593e01eUL, 0x4152fda9UL,
- 0x5f15adacUL, 0x5bd4b01bUL, 0x569796c2UL, 0x52568b75UL,
- 0x6a1936c8UL, 0x6ed82b7fUL, 0x639b0da6UL, 0x675a1011UL,
- 0x791d4014UL, 0x7ddc5da3UL, 0x709f7b7aUL, 0x745e66cdUL,
- 0x9823b6e0UL, 0x9ce2ab57UL, 0x91a18d8eUL, 0x95609039UL,
- 0x8b27c03cUL, 0x8fe6dd8bUL, 0x82a5fb52UL, 0x8664e6e5UL,
- 0xbe2b5b58UL, 0xbaea46efUL, 0xb7a96036UL, 0xb3687d81UL,
- 0xad2f2d84UL, 0xa9ee3033UL, 0xa4ad16eaUL, 0xa06c0b5dUL,
- 0xd4326d90UL, 0xd0f37027UL, 0xddb056feUL, 0xd9714b49UL,
- 0xc7361b4cUL, 0xc3f706fbUL, 0xceb42022UL, 0xca753d95UL,
- 0xf23a8028UL, 0xf6fb9d9fUL, 0xfbb8bb46UL, 0xff79a6f1UL,
- 0xe13ef6f4UL, 0xe5ffeb43UL, 0xe8bccd9aUL, 0xec7dd02dUL,
- 0x34867077UL, 0x30476dc0UL, 0x3d044b19UL, 0x39c556aeUL,
- 0x278206abUL, 0x23431b1cUL, 0x2e003dc5UL, 0x2ac12072UL,
- 0x128e9dcfUL, 0x164f8078UL, 0x1b0ca6a1UL, 0x1fcdbb16UL,
- 0x018aeb13UL, 0x054bf6a4UL, 0x0808d07dUL, 0x0cc9cdcaUL,
- 0x7897ab07UL, 0x7c56b6b0UL, 0x71159069UL, 0x75d48ddeUL,
- 0x6b93dddbUL, 0x6f52c06cUL, 0x6211e6b5UL, 0x66d0fb02UL,
- 0x5e9f46bfUL, 0x5a5e5b08UL, 0x571d7dd1UL, 0x53dc6066UL,
- 0x4d9b3063UL, 0x495a2dd4UL, 0x44190b0dUL, 0x40d816baUL,
- 0xaca5c697UL, 0xa864db20UL, 0xa527fdf9UL, 0xa1e6e04eUL,
- 0xbfa1b04bUL, 0xbb60adfcUL, 0xb6238b25UL, 0xb2e29692UL,
- 0x8aad2b2fUL, 0x8e6c3698UL, 0x832f1041UL, 0x87ee0df6UL,
- 0x99a95df3UL, 0x9d684044UL, 0x902b669dUL, 0x94ea7b2aUL,
- 0xe0b41de7UL, 0xe4750050UL, 0xe9362689UL, 0xedf73b3eUL,
- 0xf3b06b3bUL, 0xf771768cUL, 0xfa325055UL, 0xfef34de2UL,
- 0xc6bcf05fUL, 0xc27dede8UL, 0xcf3ecb31UL, 0xcbffd686UL,
- 0xd5b88683UL, 0xd1799b34UL, 0xdc3abdedUL, 0xd8fba05aUL,
- 0x690ce0eeUL, 0x6dcdfd59UL, 0x608edb80UL, 0x644fc637UL,
- 0x7a089632UL, 0x7ec98b85UL, 0x738aad5cUL, 0x774bb0ebUL,
- 0x4f040d56UL, 0x4bc510e1UL, 0x46863638UL, 0x42472b8fUL,
- 0x5c007b8aUL, 0x58c1663dUL, 0x558240e4UL, 0x51435d53UL,
- 0x251d3b9eUL, 0x21dc2629UL, 0x2c9f00f0UL, 0x285e1d47UL,
- 0x36194d42UL, 0x32d850f5UL, 0x3f9b762cUL, 0x3b5a6b9bUL,
- 0x0315d626UL, 0x07d4cb91UL, 0x0a97ed48UL, 0x0e56f0ffUL,
- 0x1011a0faUL, 0x14d0bd4dUL, 0x19939b94UL, 0x1d528623UL,
- 0xf12f560eUL, 0xf5ee4bb9UL, 0xf8ad6d60UL, 0xfc6c70d7UL,
- 0xe22b20d2UL, 0xe6ea3d65UL, 0xeba91bbcUL, 0xef68060bUL,
- 0xd727bbb6UL, 0xd3e6a601UL, 0xdea580d8UL, 0xda649d6fUL,
- 0xc423cd6aUL, 0xc0e2d0ddUL, 0xcda1f604UL, 0xc960ebb3UL,
- 0xbd3e8d7eUL, 0xb9ff90c9UL, 0xb4bcb610UL, 0xb07daba7UL,
- 0xae3afba2UL, 0xaafbe615UL, 0xa7b8c0ccUL, 0xa379dd7bUL,
- 0x9b3660c6UL, 0x9ff77d71UL, 0x92b45ba8UL, 0x9675461fUL,
- 0x8832161aUL, 0x8cf30badUL, 0x81b02d74UL, 0x857130c3UL,
- 0x5d8a9099UL, 0x594b8d2eUL, 0x5408abf7UL, 0x50c9b640UL,
- 0x4e8ee645UL, 0x4a4ffbf2UL, 0x470cdd2bUL, 0x43cdc09cUL,
- 0x7b827d21UL, 0x7f436096UL, 0x7200464fUL, 0x76c15bf8UL,
- 0x68860bfdUL, 0x6c47164aUL, 0x61043093UL, 0x65c52d24UL,
- 0x119b4be9UL, 0x155a565eUL, 0x18197087UL, 0x1cd86d30UL,
- 0x029f3d35UL, 0x065e2082UL, 0x0b1d065bUL, 0x0fdc1becUL,
- 0x3793a651UL, 0x3352bbe6UL, 0x3e119d3fUL, 0x3ad08088UL,
- 0x2497d08dUL, 0x2056cd3aUL, 0x2d15ebe3UL, 0x29d4f654UL,
- 0xc5a92679UL, 0xc1683bceUL, 0xcc2b1d17UL, 0xc8ea00a0UL,
- 0xd6ad50a5UL, 0xd26c4d12UL, 0xdf2f6bcbUL, 0xdbee767cUL,
- 0xe3a1cbc1UL, 0xe760d676UL, 0xea23f0afUL, 0xeee2ed18UL,
- 0xf0a5bd1dUL, 0xf464a0aaUL, 0xf9278673UL, 0xfde69bc4UL,
- 0x89b8fd09UL, 0x8d79e0beUL, 0x803ac667UL, 0x84fbdbd0UL,
- 0x9abc8bd5UL, 0x9e7d9662UL, 0x933eb0bbUL, 0x97ffad0cUL,
- 0xafb010b1UL, 0xab710d06UL, 0xa6322bdfUL, 0xa2f33668UL,
- 0xbcb4666dUL, 0xb8757bdaUL, 0xb5365d03UL, 0xb1f740b4UL
-};
-
-
-/*---------------------------------------------*/
-
-static void initialiseCRC ( void )
-{
- globalCrc = 0xffffffffUL;
-}
-
-
-/*---------------------------------------------*/
-
-static UInt32 getFinalCRC ( void )
-{
- return ~globalCrc;
-}
-
-
-/*---------------------------------------------*/
-
-static UInt32 getGlobalCRC ( void )
-{
- return globalCrc;
-}
-
-
-/*---------------------------------------------*/
-
-static void setGlobalCRC ( UInt32 newCrc )
-{
- globalCrc = newCrc;
-}
-
-
-/*---------------------------------------------*/
-
-#define UPDATE_CRC(crcVar,cha) \
-{ \
- crcVar = (crcVar << 8) ^ \
- crc32Table[(crcVar >> 24) ^ \
- ((UChar)cha)]; \
-}
-
-
-/*---------------------------------------------------*/
-/*--- Bit stream I/O ---*/
-/*---------------------------------------------------*/
-
-
-static UInt32 bsBuff;
-static Int32 bsLive;
-static void* bsStream;
-static Bool bsWriting;
-
-
-/*---------------------------------------------*/
-
-static void bsSetStream ( void* f, Bool wr )
-{
- if (bsStream != NULL) panic ( "bsSetStream" );
- bsStream = f;
- bsLive = 0;
- bsBuff = 0;
- bytesOut = 0;
- bytesIn = 0;
- bsWriting = wr;
-}
-
-
-/*---------------------------------------------*/
-
-static void bsFinishedWithStream ( void )
-{
- if (bsWriting)
- while (bsLive > 0) {
- bz2_putc ( (UChar)(bsBuff >> 24), bsStream );
- bsBuff <<= 8;
- bsLive -= 8;
- bytesOut++;
- }
- bsStream = NULL;
-}
-
-
-/*---------------------------------------------*/
-
-#define bsNEEDR(nz) \
-{ \
- while (bsLive < nz) { \
- Int32 zzi = bz2_getc ( bsStream ); \
- if (zzi == EOF) compressedStreamEOF(); \
- bsBuff = (bsBuff << 8) | (zzi & 0xffL); \
- bsLive += 8; \
- } \
-}
-
-
-/*---------------------------------------------*/
-
-#define bsR1(vz) \
-{ \
- bsNEEDR(1); \
- vz = (bsBuff >> (bsLive-1)) & 1; \
- bsLive--; \
-}
-
-
-/*---------------------------------------------*/
-
-static INLINE UInt32 bsR ( Int32 n )
-{
- UInt32 v;
- bsNEEDR ( n );
- v = (bsBuff >> (bsLive-n)) & ((1 << n)-1);
- bsLive -= n;
- return v;
-}
-
-
-/*---------------------------------------------*/
-
-static UChar bsGetUChar ( void )
-{
- return (UChar)bsR(8);
-}
-
-
-
-/*---------------------------------------------*/
-
-static Int32 bsGetUInt32 ( void )
-{
- UInt32 u;
- u = 0;
- u = (u << 8) | bsR(8);
- u = (u << 8) | bsR(8);
- u = (u << 8) | bsR(8);
- u = (u << 8) | bsR(8);
- return u;
-}
-
-
-/*---------------------------------------------*/
-
-static UInt32 bsGetIntVS ( UInt32 numBits )
-{
- return (UInt32)bsR(numBits);
-}
-
-
-
-/*---------------------------------------------------*/
-/*--- Huffman coding low-level stuff ---*/
-/*---------------------------------------------------*/
-
-
-/*---------------------------------------------*/
-
-static void hbCreateDecodeTables ( Int32 *limit,
- Int32 *base,
- Int32 *perm,
- UChar *length,
- Int32 minLen,
- Int32 maxLen,
- Int32 alphaSize )
-{
- Int32 pp, i, j, vec;
-
- pp = 0;
- for (i = minLen; i <= maxLen; i++)
- for (j = 0; j < alphaSize; j++)
- if (length[j] == i) { perm[pp] = j; pp++; };
-
- for (i = 0; i < MAX_CODE_LEN; i++) base[i] = 0;
- for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
-
- for (i = 1; i < MAX_CODE_LEN; i++) base[i] += base[i-1];
-
- for (i = 0; i < MAX_CODE_LEN; i++) limit[i] = 0;
- vec = 0;
-
- for (i = minLen; i <= maxLen; i++) {
- vec += (base[i+1] - base[i]);
- limit[i] = vec-1;
- vec <<= 1;
- }
- for (i = minLen + 1; i <= maxLen; i++)
- base[i] = ((limit[i-1] + 1) << 1) - base[i];
-}
-
-
-
-/*---------------------------------------------------*/
-/*--- Undoing the reversible transformation ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-
-#define SET_LL4(i,n) \
- { if (((i) & 0x1) == 0) \
- ll4[(i) >> 1] = (ll4[(i) >> 1] & 0xf0) | (n); else \
- ll4[(i) >> 1] = (ll4[(i) >> 1] & 0x0f) | ((n) << 4); \
- }
-
-
-#define GET_LL4(i) \
- (((UInt32)(ll4[(i) >> 1])) >> (((i) << 2) & 0x4) & 0xF)
-
-
-#define SET_LL(i,n) \
- { ll16[i] = (UInt16)(n & 0x0000ffff); \
- SET_LL4(i, n >> 16); \
- }
-
-
-#define GET_LL(i) \
- (((UInt32)ll16[i]) | (GET_LL4(i) << 16))
-
-
-/*---------------------------------------------*/
-/*--
- Manage memory for compression/decompression.
- When compressing, a single block size applies to
- all files processed, and that's set when the
- program starts. But when decompressing, each file
- processed could have been compressed with a
- different block size, so we may have to free
- and reallocate on a per-file basis.
-
- A call with argument of zero means
- `free up everything.' And a value of zero for
- blockSize100k means no memory is currently allocated.
---*/
-
-
-/*---------------------------------------------*/
-
-static void setDecompressStructureSizes ( Int32 newSize100k )
-{
- if (! (0 <= newSize100k && newSize100k <= 9 &&
- 0 <= blockSize100k && blockSize100k <= 9))
- panic ( "setDecompressStructureSizes" );
-
- if (newSize100k == blockSize100k) return;
-
- blockSize100k = newSize100k;
-
- if (ll16 != NULL) free ( ll16 );
- if (ll4 != NULL) free ( ll4 );
- if (ll8 != NULL) free ( ll8 );
- if (tt != NULL) free ( tt );
-
- if (newSize100k == 0) return;
-
- if (smallMode) {
-
- Int32 n = 100000 * newSize100k;
- ll16 = malloc ( n * sizeof(UInt16) );
- ll4 = malloc ( ((n+1) >> 1) * sizeof(UChar) );
-
- if (ll4 == NULL || ll16 == NULL) {
- Int32 totalDraw
- = n * sizeof(Int16) + ((n+1) >> 1) * sizeof(UChar);
- uncompressOutOfMemory ( totalDraw, n );
- }
-
- } else {
-
- Int32 n = 100000 * newSize100k;
- ll8 = malloc ( n * sizeof(UChar) );
- tt = malloc ( n * sizeof(Int32) );
-
- if (ll8 == NULL || tt == NULL) {
- Int32 totalDraw
- = n * sizeof(UChar) + n * sizeof(UInt32);
- uncompressOutOfMemory ( totalDraw, n );
- }
-
- }
-}
-
-
-
-/*---------------------------------------------------*/
-/*--- The new back end ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-
-static void makeMaps ( void )
-{
- Int32 i;
- nInUse = 0;
- for (i = 0; i < 256; i++)
- if (inUse[i]) {
- seqToUnseq[nInUse] = i;
- unseqToSeq[i] = nInUse;
- nInUse++;
- }
-}
-
-
-
-/*---------------------------------------------*/
-
-static void recvDecodingTables ( void )
-{
- Int32 i, j, t, nGroups, nSelectors, alphaSize;
- Int32 minLen, maxLen;
- Bool inUse16[16];
-
- /*--- Receive the mapping table ---*/
- for (i = 0; i < 16; i++)
- if (bsR(1) == 1)
- inUse16[i] = True; else
- inUse16[i] = False;
-
- for (i = 0; i < 256; i++) inUse[i] = False;
-
- for (i = 0; i < 16; i++)
- if (inUse16[i])
- for (j = 0; j < 16; j++)
- if (bsR(1) == 1) inUse[i * 16 + j] = True;
-
- makeMaps();
- alphaSize = nInUse+2;
-
- /*--- Now the selectors ---*/
- nGroups = bsR ( 3 );
- nSelectors = bsR ( 15 );
- for (i = 0; i < nSelectors; i++) {
- j = 0;
- while (bsR(1) == 1) j++;
- selectorMtf[i] = j;
- }
-
- /*--- Undo the MTF values for the selectors. ---*/
- {
- UChar pos[N_GROUPS], tmp, v;
- for (v = 0; v < nGroups; v++) pos[v] = v;
-
- for (i = 0; i < nSelectors; i++) {
- v = selectorMtf[i];
- tmp = pos[v];
- while (v > 0) { pos[v] = pos[v-1]; v--; }
- pos[0] = tmp;
- selector[i] = tmp;
- }
- }
-
- /*--- Now the coding tables ---*/
- for (t = 0; t < nGroups; t++) {
- Int32 curr = bsR ( 5 );
- for (i = 0; i < alphaSize; i++) {
- while (bsR(1) == 1) {
- if (bsR(1) == 0) curr++; else curr--;
- }
- len[t][i] = curr;
- }
- }
-
- /*--- Create the Huffman decoding tables ---*/
- for (t = 0; t < nGroups; t++) {
- minLen = 32;
- maxLen = 0;
- for (i = 0; i < alphaSize; i++) {
- if (len[t][i] > maxLen) maxLen = len[t][i];
- if (len[t][i] < minLen) minLen = len[t][i];
- }
- hbCreateDecodeTables (
- &limit[t][0], &base[t][0], &perm[t][0], &len[t][0],
- minLen, maxLen, alphaSize
- );
- minLens[t] = minLen;
- }
-}
-
-
-/*---------------------------------------------*/
-
-#define GET_MTF_VAL(lval) \
-{ \
- Int32 zt, zn, zvec, zj; \
- if (groupPos == 0) { \
- groupNo++; \
- groupPos = G_SIZE; \
- } \
- groupPos--; \
- zt = selector[groupNo]; \
- zn = minLens[zt]; \
- zvec = bsR ( zn ); \
- while (zvec > limit[zt][zn]) { \
- zn++; bsR1(zj); \
- zvec = (zvec << 1) | zj; \
- }; \
- lval = perm[zt][zvec - base[zt][zn]]; \
-}
-
-
-/*---------------------------------------------*/
-
-static void getAndMoveToFrontDecode ( void )
-{
- UChar yy[256];
- Int32 i, j, nextSym, limitLast;
- Int32 EOB, groupNo, groupPos;
-
- limitLast = 100000 * blockSize100k;
- origPtr = bsGetIntVS ( 24 );
-
- recvDecodingTables();
- EOB = nInUse+1;
- groupNo = -1;
- groupPos = 0;
-
- /*--
- Setting up the unzftab entries here is not strictly
- necessary, but it does save having to do it later
- in a separate pass, and so saves a block's worth of
- cache misses.
- --*/
- for (i = 0; i <= 255; i++) unzftab[i] = 0;
-
- for (i = 0; i <= 255; i++) yy[i] = (UChar) i;
-
- last = -1;
-
- GET_MTF_VAL(nextSym);
-
- while (True) {
-
- if (nextSym == EOB) break;
-
- if (nextSym == RUNA || nextSym == RUNB) {
- UChar ch;
- Int32 s = -1;
- Int32 N = 1;
- do {
- if (nextSym == RUNA) s = s + (0+1) * N; else
- if (nextSym == RUNB) s = s + (1+1) * N;
- N = N * 2;
- GET_MTF_VAL(nextSym);
- }
- while (nextSym == RUNA || nextSym == RUNB);
-
- s++;
- ch = seqToUnseq[yy[0]];
- unzftab[ch] += s;
-
- if (smallMode)
- while (s > 0) {
- last++;
- ll16[last] = ch;
- s--;
- }
- else
- while (s > 0) {
- last++;
- ll8[last] = ch;
- s--;
- };
-
- if (last >= limitLast) blockOverrun();
- continue;
-
- } else {
-
- UChar tmp;
- last++; if (last >= limitLast) blockOverrun();
-
- tmp = yy[nextSym-1];
- unzftab[seqToUnseq[tmp]]++;
- if (smallMode)
- ll16[last] = seqToUnseq[tmp]; else
- ll8[last] = seqToUnseq[tmp];
-
- /*--
- This loop is hammered during decompression,
- hence the unrolling.
-
- for (j = nextSym-1; j > 0; j--) yy[j] = yy[j-1];
- --*/
-
- j = nextSym-1;
- for (; j > 3; j -= 4) {
- yy[j] = yy[j-1];
- yy[j-1] = yy[j-2];
- yy[j-2] = yy[j-3];
- yy[j-3] = yy[j-4];
- }
- for (; j > 0; j--) yy[j] = yy[j-1];
-
- yy[0] = tmp;
- GET_MTF_VAL(nextSym);
- continue;
- }
- }
-}
-
-
-/*---------------------------------------------------*/
-/*--- Stuff for randomising repetitive blocks ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-static Int32 rNums[512] = {
- 619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
- 985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
- 733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
- 419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
- 878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
- 862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
- 150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
- 170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
- 73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
- 909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
- 641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
- 161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
- 382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
- 98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
- 227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
- 469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
- 184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
- 715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
- 951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
- 652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
- 645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
- 609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
- 653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
- 411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
- 170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
- 857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
- 669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
- 944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
- 344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
- 897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
- 433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
- 686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
- 946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
- 978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
- 680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
- 707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
- 297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
- 134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
- 343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
- 140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
- 170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
- 369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
- 804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
- 896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
- 661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
- 768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
- 61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
- 372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
- 780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
- 920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
- 645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
- 936, 638
-};
-
-
-#define RAND_DECLS \
- Int32 rNToGo = 0; \
- Int32 rTPos = 0; \
-
-#define RAND_MASK ((rNToGo == 1) ? 1 : 0)
-
-#define RAND_UPD_MASK \
- if (rNToGo == 0) { \
- rNToGo = rNums[rTPos]; \
- rTPos++; if (rTPos == 512) rTPos = 0; \
- } \
- rNToGo--;
-
-
-
-/*---------------------------------------------------*/
-/*--- The Reversible Transformation (tm) ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-
-
-static INLINE Int32 indexIntoF ( Int32 indx, Int32 *cftab )
-{
- Int32 nb, na, mid;
- nb = 0;
- na = 256;
- do {
- mid = (nb + na) >> 1;
- if (indx >= cftab[mid]) nb = mid; else na = mid;
- }
- while (na - nb != 1);
- return nb;
-}
-
-
-
-#define GET_SMALL(cccc) \
- \
- cccc = indexIntoF ( tPos, cftab ); \
- tPos = GET_LL(tPos);
-
-
-
-static void undoReversibleTransformation_small ( void* dst )
-{
- Int32 cftab[257], cftabAlso[257];
- Int32 i, j, tmp, tPos;
- UChar ch;
-
- /*--
- We assume here that the global array unzftab will
- already be holding the frequency counts for
- ll8[0 .. last].
- --*/
-
- /*-- Set up cftab to facilitate generation of indexIntoF --*/
- cftab[0] = 0;
- for (i = 1; i <= 256; i++) cftab[i] = unzftab[i-1];
- for (i = 1; i <= 256; i++) cftab[i] += cftab[i-1];
-
- /*-- Make a copy of it, used in generation of T --*/
- for (i = 0; i <= 256; i++) cftabAlso[i] = cftab[i];
-
- /*-- compute the T vector --*/
- for (i = 0; i <= last; i++) {
- ch = (UChar)ll16[i];
- SET_LL(i, cftabAlso[ch]);
- cftabAlso[ch]++;
- }
-
- /*--
- Compute T^(-1) by pointer reversal on T. This is rather
- subtle, in that, if the original block was two or more
- (in general, N) concatenated copies of the same thing,
- the T vector will consist of N cycles, each of length
- blocksize / N, and decoding will involve traversing one
- of these cycles N times. Which particular cycle doesn't
- matter -- they are all equivalent. The tricky part is to
- make sure that the pointer reversal creates a correct
- reversed cycle for us to traverse. So, the code below
- simply reverses whatever cycle origPtr happens to fall into,
- without regard to the cycle length. That gives one reversed
- cycle, which for normal blocks, is the entire block-size long.
- For repeated blocks, it will be interspersed with the other
- N-1 non-reversed cycles. Providing that the F-subscripting
- phase which follows starts at origPtr, all then works ok.
- --*/
- i = origPtr;
- j = GET_LL(i);
- do {
- tmp = GET_LL(j);
- SET_LL(j, i);
- i = j;
- j = tmp;
- }
- while (i != origPtr);
-
- /*--
- We recreate the original by subscripting F through T^(-1).
- The run-length-decoder below requires characters incrementally,
- so tPos is set to a starting value, and is updated by
- the GET_SMALL macro.
- --*/
- tPos = origPtr;
-
- /*-------------------------------------------------*/
- /*--
- This is pretty much a verbatim copy of the
- run-length decoder present in the distribution
- bzip-0.21; it has to be here to avoid creating
- block[] as an intermediary structure. As in 0.21,
- this code derives from some sent to me by
- Christian von Roques.
-
- It allows dst==NULL, so as to support the test (-t)
- option without slowing down the fast decompression
- code.
- --*/
- {
- IntNative retVal;
- Int32 i2, count, chPrev, ch2;
- UInt32 localCrc;
-
- count = 0;
- i2 = 0;
- ch2 = 256; /*-- not a char and not EOF --*/
- localCrc = getGlobalCRC();
-
- {
- RAND_DECLS;
- while ( i2 <= last ) {
- chPrev = ch2;
- GET_SMALL(ch2);
- if (blockRandomised) {
- RAND_UPD_MASK;
- ch2 ^= (UInt32)RAND_MASK;
- }
- i2++;
-
- if (dst)
- retVal = bz2_putc ( ch2, dst );
-
- UPDATE_CRC ( localCrc, (UChar)ch2 );
-
- if (ch2 != chPrev) {
- count = 1;
- } else {
- count++;
- if (count >= 4) {
- Int32 j2;
- UChar z;
- GET_SMALL(z);
- if (blockRandomised) {
- RAND_UPD_MASK;
- z ^= RAND_MASK;
- }
- for (j2 = 0; j2 < (Int32)z; j2++) {
- if (dst) retVal = bz2_putc (ch2, dst);
- UPDATE_CRC ( localCrc, (UChar)ch2 );
- }
- i2++;
- count = 0;
- }
- }
- }
- }
-
- setGlobalCRC ( localCrc );
- }
- /*-- end of the in-line run-length-decoder. --*/
-}
-#undef GET_SMALL
-
-
-/*---------------------------------------------*/
-
-#define GET_FAST(cccc) \
- \
- cccc = ll8[tPos]; \
- tPos = tt[tPos];
-
-
-
-static void undoReversibleTransformation_fast ( void* dst )
-{
- Int32 cftab[257];
- Int32 i, tPos;
- UChar ch;
-
- /*--
- We assume here that the global array unzftab will
- already be holding the frequency counts for
- ll8[0 .. last].
- --*/
-
- /*-- Set up cftab to facilitate generation of T^(-1) --*/
- cftab[0] = 0;
- for (i = 1; i <= 256; i++) cftab[i] = unzftab[i-1];
- for (i = 1; i <= 256; i++) cftab[i] += cftab[i-1];
-
- /*-- compute the T^(-1) vector --*/
- for (i = 0; i <= last; i++) {
- ch = (UChar)ll8[i];
- tt[cftab[ch]] = i;
- cftab[ch]++;
- }
-
- /*--
- We recreate the original by subscripting L through T^(-1).
- The run-length-decoder below requires characters incrementally,
- so tPos is set to a starting value, and is updated by
- the GET_FAST macro.
- --*/
- tPos = tt[origPtr];
-
- /*-------------------------------------------------*/
- /*--
- This is pretty much a verbatim copy of the
- run-length decoder present in the distribution
- bzip-0.21; it has to be here to avoid creating
- block[] as an intermediary structure. As in 0.21,
- this code derives from some sent to me by
- Christian von Roques.
- --*/
- {
- IntNative retVal;
- Int32 i2, count, chPrev, ch2;
- UInt32 localCrc;
-
- count = 0;
- i2 = 0;
- ch2 = 256; /*-- not a char and not EOF --*/
- localCrc = getGlobalCRC();
-
- if (blockRandomised) {
- RAND_DECLS;
- while ( i2 <= last ) {
- chPrev = ch2;
- GET_FAST(ch2);
- RAND_UPD_MASK;
- ch2 ^= (UInt32)RAND_MASK;
- i2++;
-
- retVal = bz2_putc ( ch2, dst );
- UPDATE_CRC ( localCrc, (UChar)ch2 );
-
- if (ch2 != chPrev) {
- count = 1;
- } else {
- count++;
- if (count >= 4) {
- Int32 j2;
- UChar z;
- GET_FAST(z);
- RAND_UPD_MASK;
- z ^= RAND_MASK;
- for (j2 = 0; j2 < (Int32)z; j2++) {
- retVal = bz2_putc (ch2, dst);
- UPDATE_CRC ( localCrc, (UChar)ch2 );
- }
- i2++;
- count = 0;
- }
- }
- }
-
- } else {
-
- while ( i2 <= last ) {
- chPrev = ch2;
- GET_FAST(ch2);
- i2++;
-
- retVal = bz2_putc ( ch2, dst );
- UPDATE_CRC ( localCrc, (UChar)ch2 );
-
- if (ch2 != chPrev) {
- count = 1;
- } else {
- count++;
- if (count >= 4) {
- Int32 j2;
- UChar z;
- GET_FAST(z);
- for (j2 = 0; j2 < (Int32)z; j2++) {
- retVal = bz2_putc (ch2, dst);
- UPDATE_CRC ( localCrc, (UChar)ch2 );
- }
- i2++;
- count = 0;
- }
- }
- }
-
- } /*-- if (blockRandomised) --*/
-
- setGlobalCRC ( localCrc );
- }
- /*-- end of the in-line run-length-decoder. --*/
-}
-#undef GET_FAST
-
-
-
-/*---------------------------------------------------*/
-/*--- Processing of complete files and streams ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------*/
-
-static Bool uncompressStream ( void *zStream, void *stream )
-{
- UChar magic1, magic2, magic3, magic4;
- UChar magic5, magic6;
- UInt32 storedBlockCRC, storedCombinedCRC;
- UInt32 computedBlockCRC, computedCombinedCRC;
- Int32 currBlockNo;
- IntNative retVal;
-
- SET_BINARY_MODE(stream);
- SET_BINARY_MODE(zStream);
-
- ERROR_IF_NOT_ZERO ( bz2_ferror(stream) );
- ERROR_IF_NOT_ZERO ( bz2_ferror(zStream) );
-
- bsSetStream ( zStream, False );
-
- /*--
- A bad magic number is `recoverable from';
- return with False so the caller skips the file.
- --*/
- magic1 = bsGetUChar ();
- magic2 = bsGetUChar ();
- magic3 = bsGetUChar ();
- magic4 = bsGetUChar ();
- if (magic1 != 'B' ||
- magic2 != 'Z' ||
- magic3 != 'h' ||
- magic4 < '1' ||
- magic4 > '9') {
- bsFinishedWithStream();
- retVal = bz2_fclose ( stream );
- ERROR_IF_EOF ( retVal );
- return False;
- }
-
- setDecompressStructureSizes ( magic4 - '0' );
- computedCombinedCRC = 0;
-
- if (verbosity >= 2) fprintf ( stderr, "\n " );
- currBlockNo = 0;
-
- while (True) {
- magic1 = bsGetUChar ();
- magic2 = bsGetUChar ();
- magic3 = bsGetUChar ();
- magic4 = bsGetUChar ();
- magic5 = bsGetUChar ();
- magic6 = bsGetUChar ();
- if (magic1 == 0x17 && magic2 == 0x72 &&
- magic3 == 0x45 && magic4 == 0x38 &&
- magic5 == 0x50 && magic6 == 0x90) break;
-
- if (magic1 != 0x31 || magic2 != 0x41 ||
- magic3 != 0x59 || magic4 != 0x26 ||
- magic5 != 0x53 || magic6 != 0x59) badBlockHeader();
-
- storedBlockCRC = bsGetUInt32 ();
-
- if (bsR(1) == 1)
- blockRandomised = True; else
- blockRandomised = False;
-
- currBlockNo++;
- if (verbosity >= 2)
- fprintf ( stderr, "[%d: huff+mtf ", currBlockNo );
- getAndMoveToFrontDecode ();
- ERROR_IF_NOT_ZERO ( bz2_ferror(zStream) );
-
- initialiseCRC();
- if (verbosity >= 2) fprintf ( stderr, "rt+rld" );
- if (smallMode)
- undoReversibleTransformation_small ( stream );
- else
- undoReversibleTransformation_fast ( stream );
-
- ERROR_IF_NOT_ZERO ( bz2_ferror(stream) );
-
- computedBlockCRC = getFinalCRC();
- if (verbosity >= 3)
- fprintf ( stderr, " {0x%x, 0x%x}", storedBlockCRC, computedBlockCRC );
- if (verbosity >= 2) fprintf ( stderr, "] " );
-
- /*-- A bad CRC is considered a fatal error. --*/
- if (storedBlockCRC != computedBlockCRC)
- crcError ( storedBlockCRC, computedBlockCRC );
-
- computedCombinedCRC = (computedCombinedCRC << 1) | (computedCombinedCRC
>> 31);
- computedCombinedCRC ^= computedBlockCRC;
- };
-
- if (verbosity >= 2) fprintf ( stderr, "\n " );
-
- storedCombinedCRC = bsGetUInt32 ();
- if (verbosity >= 2)
- fprintf ( stderr,
- "combined CRCs: stored = 0x%x, computed = 0x%x\n ",
- storedCombinedCRC, computedCombinedCRC );
- if (storedCombinedCRC != computedCombinedCRC)
- crcError ( storedCombinedCRC, computedCombinedCRC );
-
-
- bsFinishedWithStream ();
- ERROR_IF_NOT_ZERO ( bz2_ferror(zStream) );
- retVal = bz2_fclose ( zStream );
- ERROR_IF_EOF ( retVal );
-
- ERROR_IF_NOT_ZERO ( bz2_ferror(stream) );
- retVal = bz2_fflush ( stream );
- ERROR_IF_NOT_ZERO ( retVal );
- return True;
-}
-
-
-#if 0
-
-#endif
-/*---------------------------------------------------*/
-/*--- Error [non-] handling grunge ---*/
-/*---------------------------------------------------*/
-
-
-
-static void
-myFree (void **p)
-{
- free (*p);
- *p = NULL;
-}
-
-/*---------------------------------------------*/
-/* Ugg... Orignal code doesn't free dynamic allocated memories. */
-
-static void cleanUpAndFail ( Int32 ec )
-{
- myFree ((void **) &ll16);
- myFree ((void **) &ll4);
- myFree ((void **) &ll8);
- myFree ((void **) &tt);
-
- (*unzip_error) (NULL);
-}
-
-
-/*---------------------------------------------*/
-
-static void panic ( Char* s )
-{
- cleanUpAndFail( 3 );
-}
-
-
-
-/*---------------------------------------------*/
-
-static void crcError ( UInt32 crcStored, UInt32 crcComputed )
-{
- cleanUpAndFail( 2 );
-}
-
-
-/*---------------------------------------------*/
-
-static void compressedStreamEOF ( void )
-{
- cleanUpAndFail( 2 );
-}
-
-
-/*---------------------------------------------*/
-
-static void ioError ( )
-{
- cleanUpAndFail( 1 );
-}
-
-
-/*---------------------------------------------*/
-
-static void blockOverrun ()
-{
- cleanUpAndFail( 2 );
-}
-
-
-/*---------------------------------------------*/
-
-static void badBlockHeader ()
-{
- cleanUpAndFail( 2 );
-}
-
-
-
-/*---------------------------------------------*/
-static void uncompressOutOfMemory ( Int32 draw, Int32 blockSize )
-{
- cleanUpAndFail(1);
-}
-
-
-
-/*-----------------------------------------------------------*/
-/*--- end bzip2.c ---*/
-/*-----------------------------------------------------------*/
-
-void
-do_bunzip2 (void)
-{
- Bool ret;
-
- /*-- Initialise --*/
- ll4 = NULL;
- ll16 = NULL;
- ll8 = NULL;
- tt = NULL;
-#ifdef SMALL_BZIP2
- smallMode = True;
-#else
- smallMode = False;
-#endif
- verbosity = 0;
- blockSize100k = 0;
- bsStream = NULL;
-
- outcnt = 0;
- inptr = 0;
- insize = 0;
-
- ret = uncompressStream ((void *)1, (void *)2); /* Arguments ignored. */
- if (ret != True)
- cleanUpAndFail(1);
-}
diff --git a/exec/gzip.h b/exec/gzip.h
deleted file mode 100644
index aedc257..0000000
--- a/exec/gzip.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/* gzip.h -- common declarations for all gzip modules
- * Copyright (C) 1992-1993, 1996 Jean-loup Gailly.
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- */
-
-#if defined(__STDC__) || defined(PROTO)
-# define OF(args) args
-#else
-# define OF(args) ()
-#endif
-
-#ifdef __STDC__
- typedef void *voidp;
-#else
- typedef char *voidp;
-#endif
-
-/* I don't like nested includes, but the string and io functions are used
- * too often
- */
-#include <stdio.h>
-#if !defined(NO_STRING_H) || defined(STDC_HEADERS)
-# include <string.h>
-# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
-# include <memory.h>
-# endif
-# define memzero(s, n) memset ((voidp)(s), 0, (n))
-#else
-# include <strings.h>
-# define strchr index
-# define strrchr rindex
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-# define memzero(s, n) bzero((s), (n))
-#endif
-
-#ifndef RETSIGTYPE
-# define RETSIGTYPE void
-#endif
-
-#define local static
-
-typedef unsigned char uch;
-typedef unsigned short ush;
-typedef unsigned long ulg;
-
-/* Return codes from gzip */
-#define OK 0
-#define ERROR 1
-#define WARNING 2
-
-/* Compression methods (see algorithm.doc) */
-#define STORED 0
-#define COMPRESSED 1
-#define PACKED 2
-#define LZHED 3
-/* methods 4 to 7 reserved */
-#define DEFLATED 8
-#define MAX_METHODS 9
-extern int method; /* compression method */
-
-/* To save memory for 16 bit systems, some arrays are overlaid between
- * the various modules:
- * deflate: prev+head window d_buf l_buf outbuf
- * unlzw: tab_prefix tab_suffix stack inbuf outbuf
- * inflate: window inbuf
- * unpack: window inbuf prefix_len
- * unlzh: left+right window c_table inbuf c_len
- * For compression, input is done in window[]. For decompression, output
- * is done in window except for unlzw.
- */
-
-#ifndef INBUFSIZ
-# ifdef SMALL_MEM
-# define INBUFSIZ 0x2000 /* input buffer size */
-# else
-# define INBUFSIZ 0x8000 /* input buffer size */
-# endif
-#endif
-#define INBUF_EXTRA 64 /* required by unlzw() */
-
-#ifndef OUTBUFSIZ
-# ifdef SMALL_MEM
-# define OUTBUFSIZ 8192 /* output buffer size */
-# else
-# define OUTBUFSIZ 16384 /* output buffer size */
-# endif
-#endif
-#define OUTBUF_EXTRA 2048 /* required by unlzw() */
-
-#ifndef DIST_BUFSIZE
-# ifdef SMALL_MEM
-# define DIST_BUFSIZE 0x2000 /* buffer for distances, see trees.c */
-# else
-# define DIST_BUFSIZE 0x8000 /* buffer for distances, see trees.c */
-# endif
-#endif
-
-#ifdef DYN_ALLOC
-# define EXTERN(type, array) extern type * near array
-# define DECLARE(type, array, size) type * near array
-# define ALLOC(type, array, size) { \
- array = (type*)fcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) error("insufficient memory"); \
- }
-# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;}
-#else
-# define EXTERN(type, array) extern type array[]
-# define DECLARE(type, array, size) type array[size]
-# define ALLOC(type, array, size)
-# define FREE(array)
-#endif
-
-EXTERN(uch, inbuf); /* input buffer */
-EXTERN(uch, outbuf); /* output buffer */
-EXTERN(ush, d_buf); /* buffer for distances, see trees.c */
-EXTERN(uch, window); /* Sliding window and suffix table (unlzw) */
-#define tab_suffix window
-#ifndef MAXSEG_64K
-# define tab_prefix prev /* hash link (see deflate.c) */
-# define head (prev+WSIZE) /* hash head (see deflate.c) */
- EXTERN(ush, tab_prefix); /* prefix code (see unlzw.c) */
-#else
-# define tab_prefix0 prev
-# define head tab_prefix1
- EXTERN(ush, tab_prefix0); /* prefix for even codes */
- EXTERN(ush, tab_prefix1); /* prefix for odd codes */
-#endif
-
-extern unsigned insize; /* valid bytes in inbuf */
-extern unsigned inptr; /* index of next byte to be processed in inbuf */
-extern unsigned outcnt; /* bytes in output buffer */
-
-extern long bytes_in; /* number of input bytes */
-extern long bytes_out; /* number of output bytes */
-extern long header_bytes;/* number of bytes in gzip header */
-
-#define isize bytes_in
-/* for compatibility with old zip sources (to be cleaned) */
-
-extern int ifd; /* input file descriptor */
-extern int ofd; /* output file descriptor */
-extern char ifname[]; /* input file name or "stdin" */
-extern char ofname[]; /* output file name or "stdout" */
-extern char *progname; /* program name */
-
-extern long time_stamp; /* original time stamp (modification time) */
-extern long ifile_size; /* input file size, -1 for devices (debug only) */
-
-typedef int file_t; /* Do not use stdio */
-#define NO_FILE (-1) /* in memory compression */
-
-
-#define PACK_MAGIC "\037\036" /* Magic header for packed files */
-#define GZIP_MAGIC "\037\213" /* Magic header for gzip files, 1F 8B
*/
-#define OLD_GZIP_MAGIC "\037\236" /* Magic header for gzip 0.5 = freeze
1.x */
-#define LZH_MAGIC "\037\240" /* Magic header for SCO LZH Compress
files*/
-#define PKZIP_MAGIC "\120\113\003\004" /* Magic header for pkzip files */
-
-/* gzip flag byte */
-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
-#define COMMENT 0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
-#define RESERVED 0xC0 /* bit 6,7: reserved */
-
-/* internal file attribute */
-#define UNKNOWN 0xffff
-#define BINARY 0
-#define ASCII 1
-
-#ifndef WSIZE
-# define WSIZE 0x8000 /* window size--must be a power of two, and */
-#endif /* at least 32K for zip's deflate method */
-
-#define MIN_MATCH 3
-#define MAX_MATCH 258
-/* The minimum and maximum match lengths */
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-#define MAX_DIST (WSIZE-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
- * distances are limited to MAX_DIST instead of WSIZE.
- */
-
-extern int decrypt; /* flag to turn on decryption */
-extern int exit_code; /* program exit code */
-extern int verbose; /* be verbose (-v) */
-extern int quiet; /* be quiet (-q) */
-extern int level; /* compression level */
-extern int test; /* check .z file integrity */
-extern int to_stdout; /* output to stdout (-c) */
-extern int save_orig_name; /* set if original name must be saved */
-
-#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf(0))
-#define try_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf(1))
-
-/* put_byte is used for the compressed output, put_ubyte for the
- * uncompressed output. However unlzw() uses window for its
- * suffix table instead of its output buffer, so it does not use put_ubyte
- * (to be cleaned up).
- */
-#define put_byte(c) {outbuf[outcnt++]=(uch)(c); if (outcnt==OUTBUFSIZ)\
- flush_outbuf();}
-#define put_ubyte(c) {window[outcnt++]=(uch)(c); if (outcnt==WSIZE)\
- flush_window();}
-
-/* Output a 16 bit value, lsb first */
-#define put_short(w) \
-{ if (outcnt < OUTBUFSIZ-2) { \
- outbuf[outcnt++] = (uch) ((w) & 0xff); \
- outbuf[outcnt++] = (uch) ((ush)(w) >> 8); \
- } else { \
- put_byte((uch)((w) & 0xff)); \
- put_byte((uch)((ush)(w) >> 8)); \
- } \
-}
-
-/* Output a 32 bit value to the bit stream, lsb first */
-#define put_long(n) { \
- put_short((n) & 0xffff); \
- put_short(((ulg)(n)) >> 16); \
-}
-
-#define seekable() 0 /* force sequential output */
-#define translate_eol 0 /* no option -a yet */
-
-#define tolow(c) (isupper(c) ? (c)-'A'+'a' : (c)) /* force to lower case */
-
-/* Macros for getting two-byte and four-byte header values */
-#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8))
-#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16))
-
-/* Diagnostic functions */
-#ifdef DEBUG
-# define Assert(cond,msg) {if(!(cond)) error(msg);}
-# define Trace(x) fprintf x
-# define Tracev(x) {if (verbose) fprintf x ;}
-# define Tracevv(x) {if (verbose>1) fprintf x ;}
-# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
-#else
-# define Assert(cond,msg)
-# define Trace(x)
-# define Tracev(x)
-# define Tracevv(x)
-# define Tracec(c,x)
-# define Tracecv(c,x)
-#endif
-
-#define WARN(msg) {if (!quiet) fprintf msg ; \
- if (exit_code == OK) exit_code = WARNING;}
-
- /* in zip.c: */
-extern int zip OF((int in, int out));
-extern int file_read OF((char *buf, unsigned size));
-
- /* in unzip.c */
-extern int unzip OF((int in, int out));
-extern int check_zipfile OF((int in));
-
- /* in unpack.c */
-extern int unpack OF((int in, int out));
-
- /* in unlzh.c */
-extern int unlzh OF((int in, int out));
-
- /* in gzip.c */
-RETSIGTYPE abort_gzip OF((void));
-
- /* in deflate.c */
-void lm_init OF((int pack_level, ush *flags));
-ulg deflate OF((void));
-
- /* in trees.c */
-void ct_init OF((ush *attr, int *method));
-int ct_tally OF((int dist, int lc));
-ulg flush_block OF((char *buf, ulg stored_len, int eof));
-
- /* in bits.c */
-void bi_init OF((file_t zipfile));
-void send_bits OF((int value, int length));
-unsigned bi_reverse OF((unsigned value, int length));
-void bi_windup OF((void));
-void copy_block OF((char *buf, unsigned len, int header));
-extern int (*read_buf) OF((char *buf, unsigned size));
-
- /* in util.c: */
-extern int copy OF((int in, int out));
-extern ulg updcrc OF((uch *s, unsigned n));
-extern void clear_bufs OF((void));
-extern int fill_inbuf OF((int eof_ok));
-extern void flush_outbuf OF((void));
-extern void flush_window OF((void));
-extern void write_buf OF((int fd, voidp buf, unsigned cnt));
-extern char *strlwr OF((char *s));
-/* extern char *basename OF((char *fname));*/
-extern void make_simple_name OF((char *name));
-extern char *add_envopt OF((int *argcp, char ***argvp, char *env));
-extern void error OF((char *m));
-extern void warn OF((char *a, char *b));
-extern void read_error OF((void));
-extern void write_error OF((void));
-extern void display_ratio OF((long num, long den, FILE *file));
-extern voidp xmalloc OF((unsigned int size));
-
- /* in inflate.c */
-extern int inflate OF((void));
diff --git a/exec/inflate.c b/exec/inflate.c
deleted file mode 100644
index c3be438..0000000
--- a/exec/inflate.c
+++ /dev/null
@@ -1,954 +0,0 @@
-/* inflate.c -- Not copyrighted 1992 by Mark Adler
- version c10p1, 10 January 1993 */
-
-/* You can do whatever you like with this source file, though I would
- prefer that if you modify it and redistribute it that you include
- comments to that effect with your name and the date. Thank you.
- [The history has been moved to the file ChangeLog.]
- */
-
-/*
- Inflate deflated (PKZIP's method 8 compressed) data. The compression
- method searches for as much of the current string of bytes (up to a
- length of 258) in the previous 32K bytes. If it doesn't find any
- matches (of at least length 3), it codes the next byte. Otherwise, it
- codes the length of the matched string and its distance backwards from
- the current position. There is a single Huffman code that codes both
- single bytes (called "literals") and match lengths. A second Huffman
- code codes the distance information, which follows a length code. Each
- length or distance code actually represents a base value and a number
- of "extra" (sometimes zero) bits to get to add to the base value. At
- the end of each deflated block is a special end-of-block (EOB) literal/
- length code. The decoding process is basically: get a literal/length
- code; if EOB then done; if a literal, emit the decoded byte; if a
- length then get the distance and emit the referred-to bytes from the
- sliding window of previously emitted data.
-
- There are (currently) three kinds of inflate blocks: stored, fixed, and
- dynamic. The compressor deals with some chunk of data at a time, and
- decides which method to use on a chunk-by-chunk basis. A chunk might
- typically be 32K or 64K. If the chunk is uncompressible, then the
- "stored" method is used. In this case, the bytes are simply stored as
- is, eight bits per byte, with none of the above coding. The bytes are
- preceded by a count, since there is no longer an EOB code.
-
- If the data is compressible, then either the fixed or dynamic methods
- are used. In the dynamic method, the compressed data is preceded by
- an encoding of the literal/length and distance Huffman codes that are
- to be used to decode this block. The representation is itself Huffman
- coded, and so is preceded by a description of that code. These code
- descriptions take up a little space, and so for small blocks, there is
- a predefined set of codes, called the fixed codes. The fixed method is
- used if the block codes up smaller that way (usually for quite small
- chunks), otherwise the dynamic method is used. In the latter case, the
- codes are customized to the probabilities in the current block, and so
- can code it much better than the pre-determined fixed codes.
-
- The Huffman codes themselves are decoded using a mutli-level table
- lookup, in order to maximize the speed of decoding plus the speed of
- building the decoding tables. See the comments below that precede the
- lbits and dbits tuning parameters.
- */
-
-
-/*
- Notes beyond the 1.93a appnote.txt:
-
- 1. Distance pointers never point before the beginning of the output
- stream.
- 2. Distance pointers can point back across blocks, up to 32k away.
- 3. There is an implied maximum of 7 bits for the bit length table and
- 15 bits for the actual data.
- 4. If only one code exists, then it is encoded using one bit. (Zero
- would be more efficient, but perhaps a little confusing.) If two
- codes exist, they are coded using one bit each (0 and 1).
- 5. There is no way of sending zero distance codes--a dummy must be
- sent if there are none. (History: a pre 2.0 version of PKZIP would
- store blocks with no distance codes, but this was discovered to be
- too harsh a criterion.) Valid only for 1.93a. 2.04c does allow
- zero distance codes, which is sent as one code of zero bits in
- length.
- 6. There are up to 286 literal/length codes. Code 256 represents the
- end-of-block. Note however that the static length tree defines
- 288 codes just to fill out the Huffman codes. Codes 286 and 287
- cannot be used though, since there is no length base or extra bits
- defined for them. Similarly, there are up to 30 distance codes.
- However, static trees define 32 codes (all 5 bits) to fill out the
- Huffman codes, but the last two had better not show up in the data.
- 7. Unzip can check dynamic Huffman blocks for complete code sets.
- The exception is that a single code would not be complete (see #4).
- 8. The five bits following the block type is really the number of
- literal codes sent minus 257.
- 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
- (1+6+6). Therefore, to output three times the length, you output
- three codes (1+1+1), whereas to output four times the same length,
- you only need two codes (1+3). Hmm.
- 10. In the tree reconstruction algorithm, Code = Code + Increment
- only if BitLength(i) is not zero. (Pretty obvious.)
- 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
- 12. Note: length code 284 can represent 227-258, but length code 285
- really is 258. The last length deserves its own, short code
- since it gets used a lot in very redundant files. The length
- 258 is special since 258 - 3 (the min match length) is 255.
- 13. The literal/length and distance code bit lengths are read as a
- single stream of lengths. It is possible (and advantageous) for
- a repeat code (16, 17, or 18) to go across the boundary between
- the two sets of lengths.
- */
-
-#ifdef RCSID
-static char rcsid[] = "$Id: inflate.c,v 1.1 1994/12/14 04:31:21 roland Exp $";
-#endif
-
-#include <sys/types.h>
-
-#include "tailor.h"
-
-#if defined(STDC_HEADERS) || !defined(NO_STDLIB_H)
-# include <stdlib.h>
-#endif
-
-#include "gzip.h"
-#define slide window
-
-/* Huffman code lookup table entry--this entry is four bytes for machines
- that have 16-bit pointers (e.g. PC's in the small or medium model).
- Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16
- means that v is a literal, 16 < e < 32 means that v is a pointer to
- the next table, which codes e - 16 bits, and lastly e == 99 indicates
- an unused code. If a code with e == 99 is looked up, this implies an
- error in the data. */
-struct huft {
- uch e; /* number of extra bits or operation */
- uch b; /* number of bits in this code or subcode */
- union {
- ush n; /* literal, length base, or distance base */
- struct huft *t; /* pointer to next level of table */
- } v;
-};
-
-
-/* Function prototypes */
-int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *,
- struct huft **, int *));
-int huft_free OF((struct huft *));
-int inflate_codes OF((struct huft *, struct huft *, int, int));
-int inflate_stored OF((void));
-int inflate_fixed OF((void));
-int inflate_dynamic OF((void));
-int inflate_block OF((int *));
-int inflate OF((void));
-
-
-/* The inflate algorithm uses a sliding 32K byte window on the uncompressed
- stream to find repeated byte strings. This is implemented here as a
- circular buffer. The index is updated simply by incrementing and then
- and'ing with 0x7fff (32K-1). */
-/* It is left to other modules to supply the 32K area. It is assumed
- to be usable as if it were declared "uch slide[32768];" or as just
- "uch *slide;" and then malloc'ed in the latter case. The definition
- must be in unzip.h, included above. */
-/* unsigned wp; current position in slide */
-#define wp outcnt
-#define flush_output(w) (wp=(w),flush_window())
-
-/* Tables for deflate from PKZIP's appnote.txt. */
-static unsigned border[] = { /* Order of the bit length code lengths */
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-static ush cplens[] = { /* Copy lengths for literal codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- /* note: see note #13 above about the 258 in this list. */
-static ush cplext[] = { /* Extra bits for literal codes 257..285 */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */
-static ush cpdist[] = { /* Copy offsets for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577};
-static ush cpdext[] = { /* Extra bits for distance codes */
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13};
-
-
-
-/* Macros for inflate() bit peeking and grabbing.
- The usage is:
-
- NEEDBITS(j)
- x = b & mask_bits[j];
- DUMPBITS(j)
-
- where NEEDBITS makes sure that b has at least j bits in it, and
- DUMPBITS removes the bits from b. The macros use the variable k
- for the number of bits in b. Normally, b and k are register
- variables for speed, and are initialized at the beginning of a
- routine that uses these macros from a global bit buffer and count.
-
- If we assume that EOB will be the longest code, then we will never
- ask for bits with NEEDBITS that are beyond the end of the stream.
- So, NEEDBITS should not read any more bytes than are needed to
- meet the request. Then no bytes need to be "returned" to the buffer
- at the end of the last block.
-
- However, this assumption is not true for fixed blocks--the EOB code
- is 7 bits, but the other literal/length codes can be 8 or 9 bits.
- (The EOB code is shorter than other codes because fixed blocks are
- generally short. So, while a block always has an EOB, many other
- literal/length codes have a significantly lower probability of
- showing up at all.) However, by making the first table have a
- lookup of seven bits, the EOB code will be found in that first
- lookup, and so will not require that too many bits be pulled from
- the stream.
- */
-
-ulg bb; /* bit buffer */
-unsigned bk; /* bits in bit buffer */
-
-ush mask_bits[] = {
- 0x0000,
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-#ifdef CRYPT
- uch cc;
-# define NEXTBYTE() \
- (decrypt ? (cc = get_byte(), zdecode(cc), cc) : get_byte())
-#else
-# define NEXTBYTE() (uch)get_byte()
-#endif
-#define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE())<<k;k+=8;}}
-#define DUMPBITS(n) {b>>=(n);k-=(n);}
-
-
-/*
- Huffman code decoding is performed using a multi-level table lookup.
- The fastest way to decode is to simply build a lookup table whose
- size is determined by the longest code. However, the time it takes
- to build this table can also be a factor if the data being decoded
- is not very long. The most common codes are necessarily the
- shortest codes, so those codes dominate the decoding time, and hence
- the speed. The idea is you can have a shorter table that decodes the
- shorter, more probable codes, and then point to subsidiary tables for
- the longer codes. The time it costs to decode the longer codes is
- then traded against the time it takes to make longer tables.
-
- This results of this trade are in the variables lbits and dbits
- below. lbits is the number of bits the first level table for literal/
- length codes can decode in one step, and dbits is the same thing for
- the distance codes. Subsequent tables are also less than or equal to
- those sizes. These values may be adjusted either when all of the
- codes are shorter than that, in which case the longest code length in
- bits is used, or when the shortest code is *longer* than the requested
- table size, in which case the length of the shortest code in bits is
- used.
-
- There are two different values for the two tables, since they code a
- different number of possibilities each. The literal/length table
- codes 286 possible values, or in a flat code, a little over eight
- bits. The distance table codes 30 possible values, or a little less
- than five bits, flat. The optimum values for speed end up being
- about one bit more than those, so lbits is 8+1 and dbits is 5+1.
- The optimum values may differ though from machine to machine, and
- possibly even between compilers. Your mileage may vary.
- */
-
-
-int lbits = 9; /* bits in base literal/length lookup table */
-int dbits = 6; /* bits in base distance lookup table */
-
-
-/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
-#define BMAX 16 /* maximum bit length of any code (16 for explode) */
-#define N_MAX 288 /* maximum number of codes in any set */
-
-
-unsigned hufts; /* track memory usage */
-
-
-int huft_build(b, n, s, d, e, t, m)
-unsigned *b; /* code lengths in bits (all assumed <= BMAX) */
-unsigned n; /* number of codes (assumed <= N_MAX) */
-unsigned s; /* number of simple-valued codes (0..s-1) */
-ush *d; /* list of base values for non-simple codes */
-ush *e; /* list of extra bits for non-simple codes */
-struct huft **t; /* result: starting table */
-int *m; /* maximum lookup bits, returns actual */
-/* Given a list of code lengths and a maximum table size, make a set of
- tables to decode that set of codes. Return zero on success, one if
- the given code set is incomplete (the tables are still built in this
- case), two if the input is invalid (all zero length codes or an
- oversubscribed set of lengths), and three if not enough memory. */
-{
- unsigned a; /* counter for codes of length k */
- unsigned c[BMAX+1]; /* bit length count table */
- unsigned f; /* i repeats in table every f entries */
- int g; /* maximum code length */
- int h; /* table level */
- register unsigned i; /* counter, current code */
- register unsigned j; /* counter */
- register int k; /* number of bits in current code */
- int l; /* bits per table (returned in m) */
- register unsigned *p; /* pointer into c[], b[], or v[] */
- register struct huft *q; /* points to current table */
- struct huft r; /* table entry for structure assignment */
- struct huft *u[BMAX]; /* table stack */
- unsigned v[N_MAX]; /* values in order of bit length */
- register int w; /* bits before this table == (l * h) */
- unsigned x[BMAX+1]; /* bit offsets, then code stack */
- unsigned *xp; /* pointer into x */
- int y; /* number of dummy codes added */
- unsigned z; /* number of entries in current table */
-
-
- /* Generate counts for each bit length */
- memzero(c, sizeof(c));
- p = b; i = n;
- do {
- Tracecv(*p, (stderr, (n-i >= ' ' && n-i <= '~' ? "%c %d\n" : "0x%x %d\n"),
- n-i, *p));
- c[*p]++; /* assume all entries <= BMAX */
- p++; /* Can't combine with above line (Solaris bug) */
- } while (--i);
- if (c[0] == n) /* null input--all zero length codes */
- {
- *t = (struct huft *)NULL;
- *m = 0;
- return 0;
- }
-
-
- /* Find minimum and maximum length, bound *m by those */
- l = *m;
- for (j = 1; j <= BMAX; j++)
- if (c[j])
- break;
- k = j; /* minimum code length */
- if ((unsigned)l < j)
- l = j;
- for (i = BMAX; i; i--)
- if (c[i])
- break;
- g = i; /* maximum code length */
- if ((unsigned)l > i)
- l = i;
- *m = l;
-
-
- /* Adjust last length count to fill out codes, if needed */
- for (y = 1 << j; j < i; j++, y <<= 1)
- if ((y -= c[j]) < 0)
- return 2; /* bad input: more codes than bits */
- if ((y -= c[i]) < 0)
- return 2;
- c[i] += y;
-
-
- /* Generate starting offsets into the value table for each length */
- x[1] = j = 0;
- p = c + 1; xp = x + 2;
- while (--i) { /* note that i == g from above */
- *xp++ = (j += *p++);
- }
-
-
- /* Make a table of values in order of bit lengths */
- p = b; i = 0;
- do {
- if ((j = *p++) != 0)
- v[x[j]++] = i;
- } while (++i < n);
-
-
- /* Generate the Huffman codes and for each, make the table entries */
- x[0] = i = 0; /* first Huffman code is zero */
- p = v; /* grab values in bit order */
- h = -1; /* no tables yet--level -1 */
- w = -l; /* bits decoded == (l * h) */
- u[0] = (struct huft *)NULL; /* just to keep compilers happy */
- q = (struct huft *)NULL; /* ditto */
- z = 0; /* ditto */
-
- /* go through the bit lengths (k already is bits in shortest code) */
- for (; k <= g; k++)
- {
- a = c[k];
- while (a--)
- {
- /* here i is the Huffman code of length k bits for value *p */
- /* make tables up to required level */
- while (k > w + l)
- {
- h++;
- w += l; /* previous table always l bits */
-
- /* compute minimum size table less than or equal to l bits */
- z = (z = g - w) > (unsigned)l ? l : z; /* upper limit on table size */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from patterns left */
- xp = c + k;
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
- }
- z = 1 << j; /* table entries for j-bit table */
-
- /* allocate and link in new table */
- if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
- (struct huft *)NULL)
- {
- if (h)
- huft_free(u[0]);
- return 3; /* not enough memory */
- }
- hufts += z + 1; /* track memory usage */
- *t = q + 1; /* link to list for huft_free() */
- *(t = &(q->v.t)) = (struct huft *)NULL;
- u[h] = ++q; /* table starts after link */
-
- /* connect to last table, if there is one */
- if (h)
- {
- x[h] = i; /* save pattern for backing up */
- r.b = (uch)l; /* bits to dump before this table */
- r.e = (uch)(16 + j); /* bits in this table */
- r.v.t = q; /* pointer to this table */
- j = i >> (w - l); /* (get around Turbo C bug) */
- u[h-1][j] = r; /* connect to last table */
- }
- }
-
- /* set up table entry in r */
- r.b = (uch)(k - w);
- if (p >= v + n)
- r.e = 99; /* out of values--invalid code */
- else if (*p < s)
- {
- r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */
- r.v.n = (ush)(*p); /* simple code is just the value */
- p++; /* one compiler does not like *p++ */
- }
- else
- {
- r.e = (uch)e[*p - s]; /* non-simple--look up in lists */
- r.v.n = d[*p++ - s];
- }
-
- /* fill code-like entries with r */
- f = 1 << (k - w);
- for (j = i >> w; j < z; j += f)
- q[j] = r;
-
- /* backwards increment the k-bit code i */
- for (j = 1 << (k - 1); i & j; j >>= 1)
- i ^= j;
- i ^= j;
-
- /* backup over finished tables */
- while ((i & ((1 << w) - 1)) != x[h])
- {
- h--; /* don't need to update q */
- w -= l;
- }
- }
- }
-
-
- /* Return true (1) if we were given an incomplete table */
- return y != 0 && g != 1;
-}
-
-
-
-int huft_free(t)
-struct huft *t; /* table to free */
-/* Free the malloc'ed tables built by huft_build(), which makes a linked
- list of the tables it made, with the links in a dummy first entry of
- each table. */
-{
- register struct huft *p, *q;
-
-
- /* Go through linked list, freeing from the malloced (t[-1]) address. */
- p = t;
- while (p != (struct huft *)NULL)
- {
- q = (--p)->v.t;
- free((char*)p);
- p = q;
- }
- return 0;
-}
-
-
-int inflate_codes(tl, td, bl, bd)
-struct huft *tl, *td; /* literal/length and distance decoder tables */
-int bl, bd; /* number of bits decoded by tl[] and td[] */
-/* inflate (decompress) the codes in a deflated (compressed) block.
- Return an error code or zero if it all goes ok. */
-{
- register unsigned e; /* table entry flag/number of extra bits */
- unsigned n, d; /* length and index for copy */
- unsigned w; /* current window position */
- struct huft *t; /* pointer to table entry */
- unsigned ml, md; /* masks for bl and bd bits */
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local copies of globals */
- b = bb; /* initialize bit buffer */
- k = bk;
- w = wp; /* initialize window position */
-
- /* inflate the coded data */
- ml = mask_bits[bl]; /* precompute masks for speed */
- md = mask_bits[bd];
- for (;;) /* do until end of block */
- {
- NEEDBITS((unsigned)bl)
- if ((e = (t = tl + ((unsigned)b & ml))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- if (e == 16) /* then it's a literal */
- {
- slide[w++] = (uch)t->v.n;
- Tracevv((stderr, "%c", slide[w-1]));
- if (w == WSIZE)
- {
- flush_output(w);
- w = 0;
- }
- }
- else /* it's an EOB or a length */
- {
- /* exit if end of block */
- if (e == 15)
- break;
-
- /* get length of block to copy */
- NEEDBITS(e)
- n = t->v.n + ((unsigned)b & mask_bits[e]);
- DUMPBITS(e);
-
- /* decode distance of block to copy */
- NEEDBITS((unsigned)bd)
- if ((e = (t = td + ((unsigned)b & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((unsigned)b & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- NEEDBITS(e)
- d = w - t->v.n - ((unsigned)b & mask_bits[e]);
- DUMPBITS(e)
- Tracevv((stderr,"\\[%d,%d]", w-d, n));
-
- /* do the copy */
- do {
- n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
-#if !defined(NOMEMCPY) && !defined(DEBUG)
- if (w - d >= e) /* (this test assumes unsigned comparison) */
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
- do {
- slide[w++] = slide[d++];
- Tracevv((stderr, "%c", slide[w-1]));
- } while (--e);
- if (w == WSIZE)
- {
- flush_output(w);
- w = 0;
- }
- } while (n);
- }
- }
-
-
- /* restore the globals from the locals */
- wp = w; /* restore global window pointer */
- bb = b; /* restore global bit buffer */
- bk = k;
-
- /* done */
- return 0;
-}
-
-
-
-int inflate_stored()
-/* "decompress" an inflated type 0 (stored) block. */
-{
- unsigned n; /* number of bytes in block */
- unsigned w; /* current window position */
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local copies of globals */
- b = bb; /* initialize bit buffer */
- k = bk;
- w = wp; /* initialize window position */
-
-
- /* go to byte boundary */
- n = k & 7;
- DUMPBITS(n);
-
-
- /* get the length and its complement */
- NEEDBITS(16)
- n = ((unsigned)b & 0xffff);
- DUMPBITS(16)
- NEEDBITS(16)
- if (n != (unsigned)((~b) & 0xffff))
- return 1; /* error in compressed data */
- DUMPBITS(16)
-
-
- /* read and output the compressed data */
- while (n--)
- {
- NEEDBITS(8)
- slide[w++] = (uch)b;
- if (w == WSIZE)
- {
- flush_output(w);
- w = 0;
- }
- DUMPBITS(8)
- }
-
-
- /* restore the globals from the locals */
- wp = w; /* restore global window pointer */
- bb = b; /* restore global bit buffer */
- bk = k;
- return 0;
-}
-
-
-
-int inflate_fixed()
-/* decompress an inflated type 1 (fixed Huffman codes) block. We should
- either replace this with a custom decoder, or at least precompute the
- Huffman tables. */
-{
- int i; /* temporary variable */
- struct huft *tl; /* literal/length code table */
- struct huft *td; /* distance code table */
- int bl; /* lookup bits for tl */
- int bd; /* lookup bits for td */
- unsigned l[288]; /* length list for huft_build */
-
-
- /* set up literal table */
- for (i = 0; i < 144; i++)
- l[i] = 8;
- for (; i < 256; i++)
- l[i] = 9;
- for (; i < 280; i++)
- l[i] = 7;
- for (; i < 288; i++) /* make a complete, but wrong code set */
- l[i] = 8;
- bl = 7;
- if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0)
- return i;
-
-
- /* set up distance table */
- for (i = 0; i < 30; i++) /* make an incomplete code set */
- l[i] = 5;
- bd = 5;
- if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1)
- {
- huft_free(tl);
- return i;
- }
-
-
- /* decompress until an end-of-block code */
- if (inflate_codes(tl, td, bl, bd))
- return 1;
-
-
- /* free the decoding tables, return */
- huft_free(tl);
- huft_free(td);
- return 0;
-}
-
-
-
-int inflate_dynamic()
-/* decompress an inflated type 2 (dynamic Huffman codes) block. */
-{
- int i; /* temporary variables */
- unsigned j;
- unsigned l; /* last length */
- unsigned m; /* mask for bit lengths table */
- unsigned n; /* number of lengths to get */
- struct huft *tl; /* literal/length code table */
- struct huft *td; /* distance code table */
- int bl; /* lookup bits for tl */
- int bd; /* lookup bits for td */
- unsigned nb; /* number of bit length codes */
- unsigned nl; /* number of literal/length codes */
- unsigned nd; /* number of distance codes */
-#ifdef PKZIP_BUG_WORKAROUND
- unsigned ll[288+32]; /* literal/length and distance code lengths */
-#else
- unsigned ll[286+30]; /* literal/length and distance code lengths */
-#endif
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local bit buffer */
- b = bb;
- k = bk;
-
-
- /* read in table lengths */
- NEEDBITS(5)
- nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */
- DUMPBITS(5)
- NEEDBITS(5)
- nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */
- DUMPBITS(5)
- NEEDBITS(4)
- nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */
- DUMPBITS(4)
-#ifdef PKZIP_BUG_WORKAROUND
- if (nl > 288 || nd > 32)
-#else
- if (nl > 286 || nd > 30)
-#endif
- return 1; /* bad lengths */
-
-
- /* read in bit-length-code lengths */
- for (j = 0; j < nb; j++)
- {
- NEEDBITS(3)
- ll[border[j]] = (unsigned)b & 7;
- DUMPBITS(3)
- }
- for (; j < 19; j++)
- ll[border[j]] = 0;
-
-
- /* build decoding table for trees--single level, 7 bit lookup */
- bl = 7;
- if ((i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl)) != 0)
- {
- if (i == 1)
- huft_free(tl);
- return i; /* incomplete code set */
- }
-
-
- /* read in literal and distance code lengths */
- n = nl + nd;
- m = mask_bits[bl];
- i = l = 0;
- while ((unsigned)i < n)
- {
- NEEDBITS((unsigned)bl)
- j = (td = tl + ((unsigned)b & m))->b;
- DUMPBITS(j)
- j = td->v.n;
- if (j < 16) /* length of code in bits (0..15) */
- ll[i++] = l = j; /* save last length in l */
- else if (j == 16) /* repeat last length 3 to 6 times */
- {
- NEEDBITS(2)
- j = 3 + ((unsigned)b & 3);
- DUMPBITS(2)
- if ((unsigned)i + j > n)
- return 1;
- while (j--)
- ll[i++] = l;
- }
- else if (j == 17) /* 3 to 10 zero length codes */
- {
- NEEDBITS(3)
- j = 3 + ((unsigned)b & 7);
- DUMPBITS(3)
- if ((unsigned)i + j > n)
- return 1;
- while (j--)
- ll[i++] = 0;
- l = 0;
- }
- else /* j == 18: 11 to 138 zero length codes */
- {
- NEEDBITS(7)
- j = 11 + ((unsigned)b & 0x7f);
- DUMPBITS(7)
- if ((unsigned)i + j > n)
- return 1;
- while (j--)
- ll[i++] = 0;
- l = 0;
- }
- }
-
-
- /* free decoding table for trees */
- huft_free(tl);
-
-
- /* restore the global bit buffer */
- bb = b;
- bk = k;
-
-
- /* build the decoding tables for literal/length and distance codes */
- bl = lbits;
- if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0)
- {
- if (i == 1) {
- fprintf(stderr, " incomplete literal tree\n");
- huft_free(tl);
- }
- return i; /* incomplete code set */
- }
- bd = dbits;
- if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0)
- {
- if (i == 1) {
- fprintf(stderr, " incomplete distance tree\n");
-#ifdef PKZIP_BUG_WORKAROUND
- i = 0;
- }
-#else
- huft_free(td);
- }
- huft_free(tl);
- return i; /* incomplete code set */
-#endif
- }
-
-
- /* decompress until an end-of-block code */
- if (inflate_codes(tl, td, bl, bd))
- return 1;
-
-
- /* free the decoding tables, return */
- huft_free(tl);
- huft_free(td);
- return 0;
-}
-
-
-
-int inflate_block(e)
-int *e; /* last block flag */
-/* decompress an inflated block */
-{
- unsigned t; /* block type */
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local bit buffer */
- b = bb;
- k = bk;
-
-
- /* read in last block bit */
- NEEDBITS(1)
- *e = (int)b & 1;
- DUMPBITS(1)
-
-
- /* read in block type */
- NEEDBITS(2)
- t = (unsigned)b & 3;
- DUMPBITS(2)
-
-
- /* restore the global bit buffer */
- bb = b;
- bk = k;
-
-
- /* inflate that block type */
- if (t == 2)
- return inflate_dynamic();
- if (t == 0)
- return inflate_stored();
- if (t == 1)
- return inflate_fixed();
-
-
- /* bad block type */
- return 2;
-}
-
-
-
-int inflate()
-/* decompress an inflated entry */
-{
- int e; /* last block flag */
- int r; /* result code */
- unsigned h; /* maximum struct huft's malloc'ed */
-
-
- /* initialize window, bit buffer */
- wp = 0;
- bk = 0;
- bb = 0;
-
-
- /* decompress until the last block */
- h = 0;
- do {
- hufts = 0;
- if ((r = inflate_block(&e)) != 0)
- return r;
- if (hufts > h)
- h = hufts;
- } while (!e);
-
- /* Undo too much lookahead. The next read will be byte aligned so we
- * can discard unused bits in the last meaningful byte.
- */
- while (bk >= 8) {
- bk -= 8;
- inptr--;
- }
-
- /* flush out slide */
- flush_output(wp);
-
-
- /* return success */
-#ifdef DEBUG
- fprintf(stderr, "<%u> ", h);
-#endif /* DEBUG */
- return 0;
-}
diff --git a/exec/tailor.h b/exec/tailor.h
deleted file mode 100644
index d207af5..0000000
--- a/exec/tailor.h
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#ifndef get_char
-# define get_char() get_byte()
-#endif
-
-#ifndef put_char
-# define put_char(c) put_byte(c)
-#endif
-
-#include <stdio.h>
-#define fprintf(stream, fmt...) /* ignore useless error msgs */ ((void)0)
-
-void (*unzip_error) (const char *msg);
-#define error(msg) (*unzip_error) (msg)
diff --git a/exec/unzip.c b/exec/unzip.c
deleted file mode 100644
index d0f5bf1..0000000
--- a/exec/unzip.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* unzip.c -- decompress files in gzip or pkzip format.
- * Copyright (C) 1992-1993 Jean-loup Gailly
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- *
- * The code in this file is derived from the file funzip.c written
- * and put in the public domain by Mark Adler.
- */
-
-/*
- This version can extract files in gzip or pkzip format.
- For the latter, only the first entry is extracted, and it has to be
- either deflated or stored.
- */
-
-#ifdef RCSID
-static char rcsid[] = "$Id: unzip.c,v 1.1 1994/12/14 04:30:25 roland Exp $";
-#endif
-
-#include "tailor.h"
-#include "gzip.h"
-#include "crypt.h"
-
-/* PKZIP header definitions */
-#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */
-#define LOCFLG 6 /* offset of bit flag */
-#define CRPFLG 1 /* bit for encrypted entry */
-#define EXTFLG 8 /* bit for extended local header */
-#define LOCHOW 8 /* offset of compression method */
-#define LOCTIM 10 /* file mod time (for decryption) */
-#define LOCCRC 14 /* offset of crc */
-#define LOCSIZ 18 /* offset of compressed size */
-#define LOCLEN 22 /* offset of uncompressed length */
-#define LOCFIL 26 /* offset of file name field length */
-#define LOCEXT 28 /* offset of extra field length */
-#define LOCHDR 30 /* size of local header, including sig */
-#define EXTHDR 16 /* size of extended local header, inc sig */
-
-
-/* Globals */
-
-int decrypt; /* flag to turn on decryption */
-char *key; /* not used--needed to link crypt.c */
-int pkzip = 0; /* set for a pkzip file */
-int ext_header = 0; /* set if extended local header */
-
-/* ===========================================================================
- * Check zip file and advance inptr to the start of the compressed data.
- * Get ofname from the local header if necessary.
- */
-int check_zipfile(in)
- int in; /* input file descriptors */
-{
- uch *h = inbuf + inptr; /* first local header */
-
- ifd = in;
-
- /* Check validity of local header, and skip name and extra fields */
- inptr += LOCHDR + SH(h + LOCFIL) + SH(h + LOCEXT);
-
- if (inptr > insize || LG(h) != LOCSIG) {
- fprintf(stderr, "\n%s: %s: not a valid zip file\n",
- progname, ifname);
- exit_code = ERROR;
- return ERROR;
- }
- method = h[LOCHOW];
- if (method != STORED && method != DEFLATED) {
- fprintf(stderr,
- "\n%s: %s: first entry not deflated or stored -- use unzip\n",
- progname, ifname);
- exit_code = ERROR;
- return ERROR;
- }
-
- /* If entry encrypted, decrypt and validate encryption header */
- if ((decrypt = h[LOCFLG] & CRPFLG) != 0) {
- fprintf(stderr, "\n%s: %s: encrypted file -- use unzip\n",
- progname, ifname);
- exit_code = ERROR;
- return ERROR;
- }
-
- /* Save flags for unzip() */
- ext_header = (h[LOCFLG] & EXTFLG) != 0;
- pkzip = 1;
-
- /* Get ofname and time stamp from local header (to be done) */
- return OK;
-}
-
-/* ===========================================================================
- * Unzip in to out. This routine works on both gzip and pkzip files.
- *
- * IN assertions: the buffer inbuf contains already the beginning of
- * the compressed data, from offsets inptr to insize-1 included.
- * The magic header has already been checked. The output buffer is cleared.
- */
-int unzip(in, out)
- int in, out; /* input and output file descriptors */
-{
- ulg orig_crc = 0; /* original crc */
- ulg orig_len = 0; /* original uncompressed length */
- int n;
- uch buf[EXTHDR]; /* extended local header */
-
- ifd = in;
- ofd = out;
-
- updcrc(NULL, 0); /* initialize crc */
-
- if (pkzip && !ext_header) { /* crc and length at the end otherwise */
- orig_crc = LG(inbuf + LOCCRC);
- orig_len = LG(inbuf + LOCLEN);
- }
-
- /* Decompress */
- if (method == DEFLATED) {
-
- int res = inflate();
-
- if (res == 3) {
- error("out of memory");
- } else if (res != 0) {
- error("invalid compressed data--format violated");
- }
-
- } else if (pkzip && method == STORED) {
-
- register ulg n = LG(inbuf + LOCLEN);
-
- if (n != LG(inbuf + LOCSIZ) - (decrypt ? RAND_HEAD_LEN : 0)) {
-
- fprintf(stderr, "len %ld, siz %ld\n", n, LG(inbuf + LOCSIZ));
- error("invalid compressed data--length mismatch");
- }
- while (n--) {
- uch c = (uch)get_byte();
-#ifdef CRYPT
- if (decrypt) zdecode(c);
-#endif
- put_ubyte(c);
- }
- flush_window();
- } else {
- error("internal error, invalid method");
- }
-
- /* Get the crc and original length */
- if (!pkzip) {
- /* crc32 (see algorithm.doc)
- * uncompressed input size modulo 2^32
- */
- for (n = 0; n < 8; n++) {
- buf[n] = (uch)get_byte(); /* may cause an error if EOF */
- }
- orig_crc = LG(buf);
- orig_len = LG(buf+4);
-
- } else if (ext_header) { /* If extended header, check it */
- /* signature - 4bytes: 0x50 0x4b 0x07 0x08
- * CRC-32 value
- * compressed size 4-bytes
- * uncompressed size 4-bytes
- */
- for (n = 0; n < EXTHDR; n++) {
- buf[n] = (uch)get_byte(); /* may cause an error if EOF */
- }
- orig_crc = LG(buf+4);
- orig_len = LG(buf+12);
- }
-
- /* Validate decompression */
- if (orig_crc != updcrc(outbuf, 0)) {
- error("invalid compressed data--crc error");
- }
- if (orig_len != (ulg)bytes_out) {
- error("invalid compressed data--length error");
- }
-
- /* Check if there are more entries in a pkzip file */
- if (pkzip && inptr + 4 < insize && LG(inbuf+inptr) == LOCSIG) {
- if (to_stdout) {
- WARN((stderr,
- "%s: %s has more than one entry--rest ignored\n",
- progname, ifname));
- } else {
- /* Don't destroy the input zip file */
- fprintf(stderr,
- "%s: %s has more than one entry -- unchanged\n",
- progname, ifname);
- exit_code = ERROR;
- ext_header = pkzip = 0;
- return ERROR;
- }
- }
- ext_header = pkzip = 0; /* for next file */
- return OK;
-}
diff --git a/exec/util.c b/exec/util.c
deleted file mode 100644
index 598586f..0000000
--- a/exec/util.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* Hacked and slashed by address@hidden for use in Hurd exec server. */
-
-/* util.c -- utility functions for gzip support
- * Copyright (C) 1992-1993 Jean-loup Gailly
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License, see the file COPYING.
- */
-
-#ifdef RCSID
-static char rcsid[] = "$Id: util.c,v 1.1 1994/12/14 04:29:37 roland Exp $";
-#endif
-
-#include <ctype.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#include "tailor.h"
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifndef NO_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#if defined(STDC_HEADERS) || !defined(NO_STDLIB_H)
-# include <stdlib.h>
-#else
- extern int errno;
-#endif
-
-#include "gzip.h"
-#include "crypt.h"
-
-/* cruft */
-int ifd, ofd;
-int to_stdout=1,quiet=1;
-
-/* I/O interface */
-int (*unzip_read) (char *buf, size_t maxread);
-void (*unzip_write) (const char *buf, size_t nwrite);
-#define read_error() (*unzip_read_error) ()
-void (*unzip_read_error) (void);
-
-
-extern ulg crc_32_tab[]; /* crc table, defined below */
-
-int exit_code = OK; /* program exit code */
-int method = DEFLATED;/* compression method */
-unsigned insize; /* valid bytes in inbuf */
-unsigned inptr; /* index of next byte to be processed in inbuf */
-unsigned outcnt; /* bytes in output buffer */
-DECLARE(uch, inbuf, INBUFSIZ +INBUF_EXTRA);
-DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA);
-DECLARE(uch, window, 2L*WSIZE);
-
-
-/* This function stolen from gzip.c. */
-/* ========================================================================
- * Check the magic number of the input file and update ofname if an
- * original name was given and to_stdout is not set.
- * Return the compression method, -1 for error, -2 for warning.
- * Set inptr to the offset of the next byte to be processed.
- * Updates time_stamp if there is one and --no-time is not used.
- * This function may be called repeatedly for an input file consisting
- * of several contiguous gzip'ed members.
- * IN assertions: there is at least one remaining compressed member.
- * If the member is a zip file, it must be the only one.
- */
-int get_method(in)
- int in; /* input file descriptor */
-{
- uch flags; /* compression flags */
- char magic[2]; /* magic header */
- ulg stamp; /* time stamp */
-
- /* Prime the input buffer. */
- fill_inbuf(0);
- inptr = 0;
-
- magic[0] = (char)get_byte();
- magic[1] = (char)get_byte();
-
- method = -1; /* unknown yet */
-
- if (memcmp(magic, GZIP_MAGIC, 2) == 0
- || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) {
-
- method = (int)get_byte();
- if (method != DEFLATED)
- return -1;
-
- flags = (uch)get_byte();
- if ((flags & ENCRYPTED) != 0) return -1;
- if ((flags & CONTINUATION) != 0) return -1;
- if ((flags & RESERVED) != 0) return -1;
-
- stamp = (ulg)get_byte();
- stamp |= ((ulg)get_byte()) << 8;
- stamp |= ((ulg)get_byte()) << 16;
- stamp |= ((ulg)get_byte()) << 24;
-
- (void)get_byte(); /* Ignore extra flags for the moment */
- (void)get_byte(); /* Ignore OS type for the moment */
-
- if ((flags & CONTINUATION) != 0) {
- unsigned part = (unsigned)get_byte();
- part |= ((unsigned)get_byte())<<8;
- }
- if ((flags & EXTRA_FIELD) != 0) {
- unsigned len = (unsigned)get_byte();
- len |= ((unsigned)get_byte())<<8;
- while (len--) (void)get_byte();
- }
-
- /* Get original file name if it was truncated */
- if ((flags & ORIG_NAME) != 0) {
- /* Discard the old name */
- char c; /* dummy used for NeXTstep 3.0 cc optimizer bug */
- do {c=get_byte();} while (c != 0);
- }
-
- /* Discard file comment if any */
- if ((flags & COMMENT) != 0) {
- while (get_char() != 0) /* null */ ;
- }
- } else if (memcmp(magic, PKZIP_MAGIC, 2) == 0 && inptr == 2
- && memcmp((char*)inbuf, PKZIP_MAGIC, 4) == 0) {
- /* To simplify the code, we support a zip file when alone only.
- * We are thus guaranteed that the entire local header fits in inbuf.
- */
- inptr = 0;
- if (check_zipfile(in) == OK) return 0;
- }
-
- return method != DEFLATED;
-}
-
-
-/* ===========================================================================
- * Run a set of bytes through the crc shift register. If s is a NULL
- * pointer, then initialize the crc shift register contents instead.
- * Return the current crc in either case.
- */
-ulg updcrc(s, n)
- uch *s; /* pointer to bytes to pump through */
- unsigned n; /* number of bytes in s[] */
-{
- register ulg c; /* temporary variable */
-
- static ulg crc = (ulg)0xffffffffL; /* shift register contents */
-
- if (s == NULL) {
- c = 0xffffffffL;
- } else {
- c = crc;
- if (n) do {
- c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8);
- } while (--n);
- }
- crc = c;
- return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
-}
-
-/* ===========================================================================
- * Clear input and output buffers
- */
-void clear_bufs()
-{
- outcnt = 0;
- insize = inptr = 0;
-}
-
-/* ===========================================================================
- * Fill the input buffer. This is called only when the buffer is empty.
- */
-int fill_inbuf(eof_ok)
- int eof_ok; /* set if EOF acceptable as a result */
-{
- int len;
-
- /* Read as much as possible */
- insize = 0;
- do {
- len = (*unzip_read)((char*)inbuf+insize, INBUFSIZ-insize);
- if (len == 0 || len == EOF) break;
- insize += len;
- } while (insize < INBUFSIZ);
-
- if (insize == 0) {
- if (eof_ok) return EOF;
- read_error();
- }
-
- inptr = 1;
- return inbuf[0];
-}
-
-long int bytes_out;
-
-/* ===========================================================================
- * Write the output window window[0..outcnt-1] and update crc and bytes_out.
- * (Used for the decompressed data only.)
- */
-void flush_window()
-{
- if (outcnt == 0) return;
- updcrc(window, outcnt);
-
- (*unzip_write) ((char *) window, outcnt);
- bytes_out += outcnt;
-
- outcnt = 0;
-}
-
-/* ========================================================================
- * Table of CRC-32's of all single-byte values (made by makecrc.c)
- */
-ulg crc_32_tab[] = {
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
- 0x2d02ef8dL
-};
diff --git a/proc/exc-reply.defs b/proc/exc-reply.defs
deleted file mode 100644
index 8a04723..0000000
--- a/proc/exc-reply.defs
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This special version of exc.defs exists because the proc server
- has to be able to do both halves of the exc interface separately.
- Its interface is identical to <mach/exc.defs>. */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or address@hidden
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-subsystem exc 2400;
-
-#include <mach/std_types.defs>
-
-simpleroutine exception_raise (exception_port: mach_port_t;
-
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch master updated (020d5e0 -> 1dee421), Samuel Thibault, 2013/09/16
- [hurd] 03/07: control: Add build dependency on libdaemon, Samuel Thibault, 2013/09/16
- [hurd] 04/07: Add an initscript for hurd-console, Samuel Thibault, 2013/09/16
- [hurd] 05/07: Fix link until libc gets rebuilt against new .defs, Samuel Thibault, 2013/09/16
- [hurd] 07/07: Merge branch 'upstream-merged', Samuel Thibault, 2013/09/16
- [hurd] 06/07: Drop removed files,
Samuel Thibault <=
- [hurd] 02/07: Merge branch 'upstream-merged', Samuel Thibault, 2013/09/16
- [hurd] 01/07: New upstream snapshot, Samuel Thibault, 2013/09/16