gun.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <utime.h>
#include "zlib.h"

Include dependency graph for gun.c:

Go to the source code of this file.

Data Structures

struct  ind
struct  outd

Defines

#define local   static
#define SIZE   32768U
#define PIECE   16384
#define NEXT()
#define FLUSHCODE()

Functions

local unsigned in (void *in_desc, unsigned char **buf)
local int out (void *out_desc, unsigned char *buf, unsigned len)
local int lunpipe (unsigned have, unsigned char *next, struct ind *indp, int outfile, z_stream *strm)
local int gunpipe (z_stream *strm, int infile, int outfile)
local void copymeta (char *from, char *to)
local int gunzip (z_stream *strm, char *inname, char *outname, int test)
int main (int argc, char **argv)

Variables

unsigned char inbuf [SIZE]
unsigned char outbuf [SIZE]
unsigned short prefix [65536]
unsigned char suffix [65536]
unsigned char match [65280+2]


Define Documentation

 
#define FLUSHCODE  ) 
 

Value:

do { \
        left = 0; \
        rem = 0; \
        if (chunk > have) { \
            chunk -= have; \
            have = 0; \
            if (NEXT() == -1) \
                break; \
            chunk--; \
            if (chunk > have) { \
                chunk = have = 0; \
                break; \
            } \
        } \
        have -= chunk; \
        next += chunk; \
        chunk = 0; \
    } while (0)

Definition at line 167 of file gun.c.

Referenced by lunpipe().

#define local   static
 

Definition at line 69 of file gun.c.

 
#define NEXT  ) 
 

Value:

(have ? 0 : (have = in(indp, &next)), \
                last = have ? (have--, (int)(*next++)) : -1)

Definition at line 151 of file gun.c.

#define PIECE   16384
 

Definition at line 73 of file gun.c.

Referenced by in(), and out().

#define SIZE   32768U
 

Definition at line 72 of file gun.c.


Function Documentation

local void copymeta char *  from,
char *  to
 

Definition at line 508 of file gun.c.

References utimbuf::actime, chmod, chown, utimbuf::modtime, S_IFMT, S_IFREG, stat::st_atime, stat::st_gid, stat::st_mode, stat::st_mtime, stat::st_uid, stat, and utime.

Referenced by gunzip().

local int gunpipe z_stream strm,
int  infile,
int  outfile
 

Definition at line 374 of file gun.c.

References first, flags, inbuf, ind, NEXT, next, z_stream_s::next_in, Z_NULL, and Z_OK.

Referenced by gunzip().

local int gunzip z_stream strm,
char *  inname,
char *  outname,
int  test
 

Definition at line 539 of file gun.c.

References close, copymeta(), errno, fprintf(), gunpipe(), infile, z_stream_s::msg, z_stream_s::next_in, NULL, O_CREAT, O_RDONLY, O_TRUNC, O_WRONLY, open, outfile, stderr, strerror(), unlink, Z_BUF_ERROR, Z_DATA_ERROR, Z_ERRNO, Z_MEM_ERROR, Z_NULL, and Z_OK.

Referenced by main().

local unsigned in void *  in_desc,
unsigned char **  buf
 

Definition at line 85 of file gun.c.

References int(), me, next, PIECE, read, and SIZE.

local int lunpipe unsigned  have,
unsigned char *  next,
struct ind indp,
int  outfile,
z_stream strm
 

Definition at line 196 of file gun.c.

References bits, outd::check, chunk, flags, FLUSHCODE, left(), max, z_stream_s::msg, NEXT, outbuf, outd::outfile, rem, Z_BUF_ERROR, Z_DATA_ERROR, and Z_OK.

int main int  argc,
char **  argv
 

Definition at line 622 of file gun.c.

References fprintf(), free, gunzip(), inflateBackEnd(), inflateBackInit, int(), malloc(), memcpy(), NULL, z_stream_s::opaque, stderr, strcmp, strlen(), test, Z_NULL, Z_OK, z_stream_s::zalloc, and z_stream_s::zfree.

local int out void *  out_desc,
unsigned char *  buf,
unsigned  len
 

Definition at line 127 of file gun.c.

References crc32(), int(), me, PIECE, and write.


Variable Documentation

unsigned char inbuf[SIZE]
 

Definition at line 157 of file gun.c.

unsigned char match[65280+2]
 

Definition at line 161 of file gun.c.

unsigned char outbuf[SIZE]
 

Definition at line 158 of file gun.c.

unsigned short prefix[65536]
 

Definition at line 159 of file gun.c.

Referenced by expudir(), find_command(), getjob(), queryparam(), and setopts().

unsigned char suffix[65536]
 

Definition at line 160 of file gun.c.


Generated on Fri Apr 14 23:20:42 2006 for minix by  doxygen 1.4.6