89 #define CHUNK (1U << LGCHUNK)
95 fprintf(stderr,
"gzappend error: %s%s\n", msg1, msg2);
131 if (rot >=
len) rot %=
len;
132 if (rot == 0)
return;
146 if (rot ==
len - 1) {
185 if (
len == -1)
bye(
"error reading ",
in->name);
198 #define read1(in) (in->left == 0 ? readmore(in) : 0, \
199 in->left--, *(in->next)++)
208 bypass =
n & ~((1U <<
in->size) - 1);
211 bye(
"seeking ",
in->name);
216 bye(
"unexpected end of ",
in->name);
241 if (
read1(
in) != 8)
bye(
"unknown compression method in",
in->name);
243 if (
flags & 0xe0)
bye(
"unknown header flags set in",
in->name);
261 int ret, lastbit, left, full;
263 unsigned long crc,
tot;
271 if (gz.
fd == -1)
bye(
"cannot open ",
name);
287 if (ret !=
Z_OK)
bye(
"out of memory",
" or library mismatch");
314 bye(
"invalid compressed data--format violated in",
name);
326 if (
strm->data_type & 128) {
327 if (
strm->data_type & 64)
328 left =
strm->data_type & 0x1f;
330 lastbit =
strm->data_type & 0x1f;
343 if (crc !=
read4(&gz))
344 bye(
"invalid compressed data--crc mismatch in ",
name);
346 if ((
tot & 0xffffffffUL) !=
read4(&gz))
347 bye(
"invalid compressed data--length mismatch in",
name);
352 "gzappend warning: junk at end of gzip file overwritten\n");
357 *gz.
buf = (
unsigned char)(*gz.
buf ^ (1 << ((8 - lastbit) & 7)));
369 if (ret !=
Z_OK)
bye(
"out of memory",
"");
392 unsigned char *
in, *
out;
399 fprintf(stderr,
"gzappend warning: %s not found, skipping ...\n",
414 "gzappend warning: error reading %s, skipping rest ...\n",
430 if (
len == -1)
bye(
"writing gzip file",
"");
439 out[0] = (
unsigned char)(
strm->adler);
440 out[1] = (
unsigned char)(
strm->adler >> 8);
441 out[2] = (
unsigned char)(
strm->adler >> 16);
442 out[3] = (
unsigned char)(
strm->adler >> 24);
450 if (ret == -1)
bye(
"writing gzip file",
"");
477 "gzappend 1.2 (11 Oct 2012) Copyright (C) 2003, 2012 Mark Adler\n"
480 "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n");
486 if (
argv[0][0] ==
'-') {
487 if (
argv[0][1] <
'0' ||
argv[0][1] >
'9' ||
argv[0][2] != 0)
488 bye(
"invalid compression level",
"");
490 if (*++
argv ==
NULL)
bye(
"no gzip file name after options",
"");
const lzma_allocator const uint8_t * in
const lzma_allocator const uint8_t size_t uint8_t * out
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
static static fork const void static count close
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags long
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep lseek
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value)
int ZEXPORT deflateEnd(z_streamp strm)
int ZEXPORT deflate(z_streamp strm, int flush)
unsigned gcd(unsigned a, unsigned b)
int main(int argc, char **argv)
void skip(file *in, unsigned n)
void gztack(char *name, int gd, z_stream *strm, int last)
unsigned long read4(file *in)
int gzscan(char *name, z_stream *strm, int level)
void bye(char *msg1, char *msg2)
void rotate(unsigned char *list, unsigned len, unsigned rot)
RZ_API void Ht_() free(HtName_(Ht) *ht)
int ZEXPORT inflate(z_streamp strm, int flush)
int ZEXPORT inflateEnd(z_streamp strm)
static void list(RzEgg *egg)
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char argv
static void struct sockaddr socklen_t static fromlen static backlog static fork char char char static envp int struct rusage static rusage struct utsname static buf struct sembuf unsigned
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
static struct sockaddr static addrlen static backlog const void static flags void flags
z_const unsigned char * next
static const z80_opcode fd[]
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
#define Z_DEFAULT_STRATEGY
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
#define inflateInit2(strm, windowBits)
#define Z_DEFAULT_COMPRESSION
int read(izstream &zs, T *x, Items items)