LMMS
Loading...
Searching...
No Matches
fileio.c File Reference
#include "unzip.h"
#include "crc32.h"
#include "crypt.h"
#include "ttyio.h"
#include "ebcdic.h"

Macros

#define __FILEIO_C   /* identifies this source module */
#define UNZIP_INTERNAL
#define IZ_ISO2OEM_ARRAY   /* pull in iso2oem[] table */
#define WriteError(buf, len, strm)
#define WriteTxtErr(buf, len, strm)
#define VMSREC_C_UNDEF   0
#define VMSREC_C_VAR   2
#define VMSPK_ITEMID   0
#define VMSPK_ITEMLEN   2
#define VMSPK_ITEMHEADSZ   4
#define VMSATR_C_RECATTR   4
#define VMS_FABSIG   0x42414656 /* "VFAB" */
#define VMSFAB_B_RFM   31 /* record format byte */
#define VMSFAB_B_ORG   29 /* file organization byte */
#define YRBASE   1970

Functions

static int is_vms_varlen_txt OF ((__GPRO__ uch *ef_buf, unsigned ef_len))
static int disk_error OF ((__GPRO))
int open_input_file (__G)
int open_outfile (__G)
void undefer_input (__G)
void defer_leftover_input (__G)
unsigned readbuf (__G__ buf, size) __GDEF char *buf
 while (size)
int readbyte (__G)
int seek_zipf (__G__ abs_offset) __GDEF zoff_t abs_offset
 if (request< 0)
else if (bufstart !=G.cur_zipfile_bufstart)
 return (PK_OK)
int flush (__G__ rawbuf, size, unshrink) __GDEF uch *rawbuf
 if (uO.tflag||size==0L) return PK_OK
 if (G.disk_full) return PK_DISK
 if (!G.pInfo->textmode)
 if (q > transbuf)
static int is_vms_varlen_txt (__G__ ef_buf, ef_len) __GDEF uch *ef_buf
 if (ef_len==0||ef_buf==NULL)
 return (vms_rectype==VMSREC_C_VAR)
static int disk_error (__G)
int UZ_EXP UzpMessagePrnt (zvoid *pG, uch *buf, ulg size, int flag)
int UZ_EXP UzpInput (zvoid *pG, uch *buf, int *size, int flag)
void UZ_EXP UzpMorePause (zvoid *pG, ZCONST char *prompt, int flag)
int UZ_EXP UzpPassword (zvoid *pG, int *rcnt, char *pwbuf, int size, ZCONST char *zfn, ZCONST char *efn)
void handler (int signal)
time_t dos_to_unix_time (ulg dosdatetime)
int check_for_newer (__G__ filename) __GDEF char *filename
 Trace ((stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename)))
 if (SSTAT(filename, &G.statbuf))
 Trace ((stderr, "check_for_newer: stat(%s) returns 0: file exists\n", FnFilter1(filename)))
 TTrace ((stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n",(ulg) existing,(ulg) archive,(long)(existing-archive)))
 return (existing >=archive)
int do_string (__G__ length, option) __GDEF unsigned int length
 if (!length) return PK_COOL
 switch (option)
ush makeword (ZCONST uch *b)
ulg makelong (ZCONST uch *sig)
zusz_t makeint64 (ZCONST uch *sig)
char * fzofft (__G__ val, pre, post) __GDEF zoff_t val
 if (pre==FZOFFT_HEX_WID)
else if (pre !=NULL)
 strcat (fmt, FZOFFT_FMT)
 if (post==NULL)

Variables

static ZCONST char Far CannotOpenZipfile []
static ZCONST char Far CannotCreateFile []
static ZCONST char Far ReadError [] = "error: zipfile read error\n"
static ZCONST char Far FilenameTooLongTrunc []
static ZCONST char Far ExtraFieldTooLong []
static ZCONST char Far DiskFullQuery []
static ZCONST char Far ZipfileCorrupt []
static ZCONST char Far MorePrompt [] = "--More--(%lu)"
static ZCONST char Far QuitPrompt []
static ZCONST char Far HidePrompt []
static ZCONST char Far PasswPrompt [] = "[%s] %s password: "
static ZCONST char Far PasswPrompt2 [] = "Enter password: "
static ZCONST char Far PasswRetry [] = "password incorrect--reenter: "
register unsigned size
unsigned n
zoff_t inbuf_offset = request % INBUFSIZ
zoff_t bufstart = request - inbuf_offset
 else
G inptr = G.inbuf + (int)inbuf_offset
int unshrink
register uchq
uchtransbuf
ulg transbufsiz
G crc32val = crc32(G.crc32val, rawbuf, (extent)size)
return PK_OK
unsigned ef_len
unsigned eb_len
ucheb_data
unsigned eb_datlen
uch vms_rectype = VMSREC_C_UNDEF
ZCONST ush ydays []
 existing
 archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime)
int option
unsigned int block_len
int error =PK_OK
ZCONST char * pre
ZCONST char * post
 fmt [0] = '%'

Macro Definition Documentation

◆ __FILEIO_C

#define __FILEIO_C   /* identifies this source module */

◆ IZ_ISO2OEM_ARRAY

#define IZ_ISO2OEM_ARRAY   /* pull in iso2oem[] table */

◆ UNZIP_INTERNAL

#define UNZIP_INTERNAL

◆ VMS_FABSIG

#define VMS_FABSIG   0x42414656 /* "VFAB" */

◆ VMSATR_C_RECATTR

#define VMSATR_C_RECATTR   4

◆ VMSFAB_B_ORG

#define VMSFAB_B_ORG   29 /* file organization byte */

◆ VMSFAB_B_RFM

#define VMSFAB_B_RFM   31 /* record format byte */

◆ VMSPK_ITEMHEADSZ

#define VMSPK_ITEMHEADSZ   4

◆ VMSPK_ITEMID

#define VMSPK_ITEMID   0

◆ VMSPK_ITEMLEN

#define VMSPK_ITEMLEN   2

◆ VMSREC_C_UNDEF

#define VMSREC_C_UNDEF   0

◆ VMSREC_C_VAR

#define VMSREC_C_VAR   2

◆ WriteError

#define WriteError ( buf,
len,
strm )
Value:
((extent)write(fileno(strm),(char *)(buf),(extent)(len)) != (extent)(len))
unsigned int extent
Definition unzpriv.h:669

◆ WriteTxtErr

#define WriteTxtErr ( buf,
len,
strm )
Value:
WriteError(buf,len,strm)
#define WriteError(buf, len, strm)
Definition fileio.c:102

◆ YRBASE

#define YRBASE   1970

Function Documentation

◆ check_for_newer()

int check_for_newer ( __G__ filename)

◆ defer_leftover_input()

void defer_leftover_input ( __G )

◆ disk_error()

int disk_error ( __G )
static

◆ do_string()

int do_string ( __G__ length,
option  )

◆ dos_to_unix_time()

time_t dos_to_unix_time ( ulg dosdatetime)

◆ flush()

int flush ( __G__ rawbuf,
size ,
unshrink  )

◆ fzofft()

char * fzofft ( __G__ val,
pre ,
post  )

◆ handler()

void handler ( int signal)

◆ if() [1/12]

if ( !G.pInfo-> textmode)

◆ if() [2/12]

if ( ! length)

◆ if() [3/12]

◆ if() [4/12]

if ( ef_len = = 0 || ef_buf == NULL)

◆ if() [5/12]

if ( G. disk_full)

◆ if() [6/12]

if ( post = NULL)

◆ if() [7/12]

else if ( pre ! = NULL)

◆ if() [8/12]

if ( pre = FZOFFT_HEX_WID)

◆ if() [9/12]

if ( q ,
transbuf  )

◆ if() [10/12]

if ( )

◆ if() [11/12]

if ( SSTAT(filename, &G.statbuf) )

◆ if() [12/12]

if ( uO.tflag|| size = =0L)

◆ is_vms_varlen_txt()

int is_vms_varlen_txt ( __G__ ef_buf,
ef_len  )
static

◆ makeint64()

zusz_t makeint64 ( ZCONST uch * sig)

◆ makelong()

ulg makelong ( ZCONST uch * sig)

◆ makeword()

ush makeword ( ZCONST uch * b)

◆ OF() [1/2]

int disk_error OF ( (__GPRO) )
static

◆ OF() [2/2]

int is_vms_varlen_txt OF ( (__GPRO__ uch *ef_buf, unsigned ef_len) )
static

◆ open_input_file()

int open_input_file ( __G )

◆ open_outfile()

int open_outfile ( __G )

◆ readbuf()

unsigned readbuf ( __G__ buf,
size  )

◆ readbyte()

int readbyte ( __G )

◆ return() [1/3]

return ( existing >= archive)

◆ return() [2/3]

return ( PK_OK )

◆ return() [3/3]

return ( vms_rectype = =VMSREC_C_VAR)

◆ seek_zipf()

int seek_zipf ( __G__ abs_offset)

◆ strcat()

strcat ( fmt ,
FZOFFT_FMT  )

◆ switch()

switch ( option )

◆ Trace() [1/2]

Trace ( (stderr, "check_for_newer: doing stat(%s)\n", FnFilter1(filename)) )

◆ Trace() [2/2]

Trace ( (stderr, "check_for_newer: stat(%s) returns 0: file exists\n", FnFilter1(filename)) )

◆ TTrace()

TTrace ( (stderr, "check_for_newer: existing %lu, archive %lu, e-a %ld\n",(ulg) existing,(ulg) archive,(long)(existing-archive)) )

◆ undefer_input()

void undefer_input ( __G )

◆ UzpInput()

int UZ_EXP UzpInput ( zvoid * pG,
uch * buf,
int * size,
int flag )

◆ UzpMessagePrnt()

int UZ_EXP UzpMessagePrnt ( zvoid * pG,
uch * buf,
ulg size,
int flag )

◆ UzpMorePause()

void UZ_EXP UzpMorePause ( zvoid * pG,
ZCONST char * prompt,
int flag )

◆ UzpPassword()

int UZ_EXP UzpPassword ( zvoid * pG,
int * rcnt,
char * pwbuf,
int size,
ZCONST char * zfn,
ZCONST char * efn )

◆ while()

while ( size )

Variable Documentation

◆ archive

archive = dos_to_unix_time(G.lrec.last_mod_dos_datetime)

◆ block_len

unsigned int block_len
Initial value:
{
unsigned comment_bytes_left

◆ bufstart

zoff_t bufstart = request - inbuf_offset

◆ CannotCreateFile

ZCONST char Far CannotCreateFile[]
static
Initial value:
=
"error: cannot create %s\n %s\n"

◆ CannotOpenZipfile

ZCONST char Far CannotOpenZipfile[]
static
Initial value:
=
"error: cannot open zipfile [ %s ]\n %s\n"

◆ crc32val

G crc32val = crc32(G.crc32val, rawbuf, (extent)size)

◆ DiskFullQuery

ZCONST char Far DiskFullQuery[]
static
Initial value:
=
"%s: write error (disk full?). Continue? (y/n/^C) "

◆ eb_data

uch* eb_data

◆ eb_datlen

unsigned eb_datlen

◆ eb_len

unsigned eb_len
Initial value:
{
unsigned eb_id

◆ ef_len

unsigned ef_len

◆ else

else
Initial value:
{
G.incnt += (G.inptr-G.inbuf) - (int)inbuf_offset
zoff_t inbuf_offset
Definition extract.c:1037
Uz_Globs G
Definition globals.c:42

◆ error

return error =PK_OK

◆ existing

existing
Initial value:
= ((G.statbuf.st_mtime & 1) &&
(G.statbuf.st_mtime + 1 > G.statbuf.st_mtime)) ?
G.statbuf.st_mtime + 1 : G.statbuf.st_mtime

◆ ExtraFieldTooLong

ZCONST char Far ExtraFieldTooLong[]
static
Initial value:
=
"warning: extra field too long (%d). Ignoring...\n"

◆ FilenameTooLongTrunc

ZCONST char Far FilenameTooLongTrunc[]
static
Initial value:
=
"warning: filename too long--truncating.\n"

◆ fmt

fmt[1] = '%'

◆ HidePrompt

ZCONST char Far HidePrompt[]
static
Initial value:
=
"\r \r"

◆ inbuf_offset

zoff_t inbuf_offset = request % INBUFSIZ

◆ inptr

G inptr = G.inbuf + (int)inbuf_offset

◆ MorePrompt

ZCONST char Far MorePrompt[] = "--More--(%lu)"
static

◆ n

return n
Initial value:
{
register unsigned count
_WDL_CSTRING_PREFIX void INT_PTR count
Definition wdlcstring.h:263

◆ option

int option

◆ PasswPrompt

ZCONST char Far PasswPrompt[] = "[%s] %s password: "
static

◆ PasswPrompt2

ZCONST char Far PasswPrompt2[] = "Enter password: "
static

◆ PasswRetry

ZCONST char Far PasswRetry[] = "password incorrect--reenter: "
static

◆ PK_OK

return PK_OK

◆ post

ZCONST char* post

◆ pre

ZCONST char* pre

◆ q

register uch* q
Initial value:
{
register uch *p
uch * p
Definition crypt.c:594
unsigned char uch
Definition unzip.h:401

◆ QuitPrompt

ZCONST char Far QuitPrompt[]
static
Initial value:
=
"--- Press `Q' to quit, or any other key to continue ---"

◆ ReadError

ZCONST char Far ReadError[] = "error: zipfile read error\n"
static

◆ size

ulg size

◆ transbuf

uch* transbuf

◆ transbufsiz

ulg transbufsiz

◆ unshrink

int unshrink

◆ vms_rectype

uch vms_rectype = VMSREC_C_UNDEF

◆ ydays

ZCONST ush ydays[]
Initial value:
=
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }

◆ ZipfileCorrupt

ZCONST char Far ZipfileCorrupt[]
static
Initial value:
=
"error: zipfile probably corrupt (%s)\n"