Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Data Structures | Macros | Functions | Variables
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"

Go to the source code of this file.

Data Structures

struct  ind
 
struct  outd
 

Macros

#define local   static
 
#define SIZE   32768U /* input and output buffer sizes */
 
#define PIECE   16384 /* limits i/o chunks for 16-bit int case */
 
#define NEXT()
 
#define FLUSHCODE()
 

Functions

unsigned in (void *in_desc, z_const unsigned char **buf)
 
int out (void *out_desc, unsigned char *buf, unsigned len)
 
int lunpipe (unsigned have, z_const unsigned char *next, struct ind *indp, int outfile, z_stream *strm)
 
int gunpipe (z_stream *strm, int infile, int outfile)
 
void copymeta (char *from, char *to)
 
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]
 

Macro Definition Documentation

◆ FLUSHCODE

#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)
#define NEXT()
Definition: gun.c:155

Definition at line 171 of file gun.c.

◆ local

#define local   static

Definition at line 73 of file gun.c.

◆ NEXT

#define NEXT ( )
Value:
(have ? 0 : (have = in(indp, &next)), \
last = have ? (have--, (int)(*next++)) : -1)
unsigned in(void *in_desc, z_const unsigned char **buf)
Definition: gun.c:89
unsigned int last
Definition: nkf.c:4324

Definition at line 155 of file gun.c.

◆ PIECE

#define PIECE   16384 /* limits i/o chunks for 16-bit int case */

Definition at line 77 of file gun.c.

◆ SIZE

#define SIZE   32768U /* input and output buffer sizes */

Definition at line 76 of file gun.c.

Function Documentation

◆ copymeta()

void copymeta ( char *  from,
char *  to 
)

Definition at line 517 of file gun.c.

References utimbuf::actime, chown(), utimbuf::modtime, and stat.

Referenced by gunzip().

◆ gunpipe()

int gunpipe ( z_stream strm,
int  infile,
int  outfile 
)

◆ gunzip()

int gunzip ( z_stream strm,
char *  inname,
char *  outname,
int  test 
)

◆ in()

unsigned in ( void *  in_desc,
z_const unsigned char **  buf 
)

◆ lunpipe()

int lunpipe ( unsigned  have,
z_const unsigned char *  next,
struct ind indp,
int  outfile,
z_stream strm 
)

◆ main()

int main ( int argc  ,
char **  argv 
)

◆ out()

int out ( void *  out_desc,
unsigned char *  buf,
unsigned  len 
)

Definition at line 131 of file gun.c.

References outd::check, outd::crc, crc32(), int(), len, outd::outfile, PIECE, outd::total, and write().

Variable Documentation

◆ inbuf

unsigned char inbuf[SIZE]

Definition at line 161 of file gun.c.

Referenced by gunpipe().

◆ match

unsigned char match[65280+2]

◆ outbuf

unsigned char outbuf[SIZE]

Definition at line 162 of file gun.c.

Referenced by lunpipe().

◆ prefix

unsigned short prefix[65536]

Definition at line 163 of file gun.c.

Referenced by lunpipe(), rb_str_format(), and rb_w32_pipe().

◆ suffix

unsigned char suffix[65536]

Definition at line 164 of file gun.c.

Referenced by lunpipe(), and ruby_set_inplace_mode().