Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/fileio.c view on Meta::CPAN
case CHECK_AUTORUN_Q:
comment_bytes_left = length;
if (length >= 10)
{
block_len = readbuf(__G__ (char *)G.outbuf, 10);
if (block_len == 0)
return PK_EOF;
comment_bytes_left -= block_len;
G.outbuf[block_len] = '\0';
if (!strcmp((char *)G.outbuf, "$AUTORUN$>")) {
char *eol;
length -= 10;
block_len = readbuf(__G__ G.autorun_command,
MIN(length, sizeof(G.autorun_command)-1));
if (block_len == 0)
return PK_EOF;
comment_bytes_left -= block_len;
G.autorun_command[block_len] = '\0';
A_TO_N(G.autorun_command);
eol = strchr(G.autorun_command, '\n');
if (!eol)
eol = G.autorun_command + strlen(G.autorun_command) - 1;
length -= eol + 1 - G.autorun_command;
while (eol >= G.autorun_command && isspace(*eol))
*eol-- = '\0';
#if (defined(WIN32) && !defined(_WIN32_WCE))
/* Win9x console always uses OEM character coding, and
WinNT console is set to OEM charset by default, too */
INTERN_TO_OEM(G.autorun_command, G.autorun_command);
#endif /* (WIN32 && !_WIN32_WCE) */
}
}
if (option == CHECK_AUTORUN_Q) /* don't display the remainder */
length = 0;
/* seek to beginning of remaining part of comment -- rewind if */
unzip-6.0/vms/vms.c view on Meta::CPAN
static struct XABALL *xaball = NULL; /* allocation */
static struct XAB *first_xab = NULL, *last_xab = NULL;
static int replace_code_all = -1; /* All-file response for replace(). */
static uch rfm;
static uch locbuf[BUFSALLOC]; /* Space for 2 buffers of BUFS512 */
static unsigned loccnt = 0;
static uch *locptr;
static char got_eol = 0;
struct bufdsc
{
struct bufdsc *next;
uch *buf;
unsigned bufcnt;
};
static struct bufdsc b1, b2, *curbuf; /* buffer ring for asynchronous I/O */
unzip-6.0/vms/vms.c view on Meta::CPAN
static int create_rms_output(__GPRO);
static int create_qio_output(__GPRO);
static int replace(__GPRO);
static int replace_rms_newversion(__GPRO);
static int replace_rms_overwrite(__GPRO);
static int find_vms_attrs(__GPRO__ int set_date_time);
static void free_up(void);
#ifdef CHECK_VERSIONS
static int get_vms_version(char *verbuf, int len);
#endif /* CHECK_VERSIONS */
static unsigned find_eol(ZCONST uch *p, unsigned n, unsigned *l);
#ifdef SET_DIR_ATTRIB
static char *vms_path_fixdown(ZCONST char *dir_spec, char *dir_file);
#endif
#ifdef TIMESTAMP
static time_t mkgmtime(struct tm *tm);
static void uxtime2vmstime(time_t utimeval, long int binval[2]);
#endif /* TIMESTAMP */
static int vms_msg_fetch(int status);
static void vms_msg(__GPRO__ ZCONST char *string, int status);
unzip-6.0/vms/vms.c view on Meta::CPAN
Info(slide, 1, ((char *)slide,
"Cannot create ($connect) output file: %s\n",
FnFilter1(G.filename)));
free_up();
return OPENOUT_FAILED;
}
} /* end if (!uO.cflag) */
init_buf_ring();
_flush_routine = text_output ? got_eol=0,_flush_stream : _flush_blocks;
_close_routine = _close_rms;
return OPENOUT_OK;
}
/* The following return codes are supported:
* OPENOUT_OK a file has been opened normally
* OPENOUT_FAILED the file open process failed
* OPENOUT_SKIPOK file open skipped at user request, err level OK
unzip-6.0/vms/vms.c view on Meta::CPAN
if ( text_output )
switch (rfm)
{
case FAB$C_VAR:
_flush_routine = _flush_varlen;
break;
case FAB$C_STM:
case FAB$C_STMCR:
case FAB$C_STMLF:
_flush_routine = _flush_stream;
got_eol = 0;
break;
default:
_flush_routine = _flush_blocks;
break;
}
else
_flush_routine = _flush_blocks;
_close_routine = _close_rms;
return OPENOUT_OK;
}
unzip-6.0/vms/vms.c view on Meta::CPAN
switch (rtype)
{
case FAT$C_VARIABLE:
_flush_routine = _flush_varlen;
break;
case FAT$C_STREAM:
case FAT$C_STREAMCR:
case FAT$C_STREAMLF:
_flush_routine = _flush_stream;
got_eol = 0;
break;
default:
_flush_routine = _flush_blocks;
break;
}
_close_routine = _close_rms;
}
else /* !(uO.cflag) : redirect output */
{
fileblk = cc$rms_fab; /* Initialize FAB. */
unzip-6.0/vms/vms.c view on Meta::CPAN
#define RECORD_END(c, f) \
( ( ORG_DOS || G.pInfo->textmode ) && c==CTRLZ \
|| ( f == FAB$C_STMLF && c==LF ) \
|| ( f == FAB$C_STMCR || ORG_DOS || G.pInfo->textmode ) && c==CR \
|| ( f == FAB$C_STM && (c==CR || c==LF || c==FF || c==VT) ) \
)
#else
# define RECORD_END(c, f) ((c) == LF || (c) == (CR))
#endif
static unsigned find_eol(p, n, l)
/*
* Find first CR, LF, CR/LF or LF/CR in string 'p' of length 'n'.
* Return offset of the sequence found or 'n' if not found.
* If found, return in '*l' length of the sequence (1 or 2) or
* zero if sequence end not seen, i.e. CR or LF is last char
* in the buffer.
*/
ZCONST uch *p;
unsigned n;
unsigned *l;
unzip-6.0/vms/vms.c view on Meta::CPAN
return PK_COOL; /* Nothing to do ... */
if ( final_flag )
{
unsigned recsize;
/*
* This is flush only call. size must be zero now.
* Just eject everything we have in locbuf.
*/
recsize = loccnt - (got_eol ? 1 : 0);
/*
* If the last char of file was ^Z ( end-of-file in MSDOS ),
* we will see it now.
*/
if ( recsize==1 && locbuf[0] == CTRLZ )
return PK_COOL;
return WriteRecord(__G__ locbuf, recsize);
}
if ( loccnt > 0 )
{
/* Find end of record partially saved in locbuf */
unsigned recsize;
int complete=0;
if ( got_eol )
{
recsize = loccnt - 1;
complete = 1;
if ( (got_eol == CR && rawbuf[0] == LF) ||
(got_eol == LF && rawbuf[0] == CR) )
end = 1;
got_eol = 0;
}
else
{
unsigned eol_len;
unsigned eol_off;
eol_off = find_eol(rawbuf, size, &eol_len);
if ( loccnt+eol_off > BUFSMAXREC )
{
/*
* No room in locbuf. Dump it and clear
*/
char buf[80]; /* CANNOT use slide for Info() */
recsize = loccnt;
start = 0;
Info(buf, 1, (buf,
"[ Warning: Record too long (%u) ]\n", loccnt+eol_off));
complete = 1;
end = 0;
}
else
{
if ( eol_off >= size )
{
end = size;
complete = 0;
}
else if ( eol_len == 0 )
{
got_eol = rawbuf[eol_off];
end = size;
complete = 0;
}
else
{
memcpy(locptr, rawbuf, eol_off);
recsize = loccnt + eol_off;
locptr += eol_off;
loccnt += eol_off;
end = eol_off + eol_len;
complete = 1;
}
}
}
if ( complete )
{
if (WriteRecord(__G__ locbuf, recsize))
return PK_DISK;
loccnt = 0;
locptr = locbuf;
}
} /* end if ( loccnt ) */
for (start = end; start < size && end < size; )
{
unsigned eol_off, eol_len;
got_eol = 0;
#ifdef undef
if (uO.cflag)
/* skip CR's at the beginning of record */
while (start < size && rawbuf[start] == CR)
++start;
#endif
if ( start >= size )
continue;
/* Find record end */
end = start+(eol_off = find_eol(rawbuf+start, size-start, &eol_len));
if ( end >= size )
continue;
if ( eol_len > 0 )
{
if ( WriteRecord(__G__ rawbuf+start, end-start) )
return PK_DISK;
start = end + eol_len;
}
else
{
got_eol = rawbuf[end];
end = size;
continue;
}
}
rest = size - start;
if (rest > 0)
{
if ( rest > BUFSMAXREC )
{
unsigned recsize;
char buf[80]; /* CANNOT use slide for Info() */
recsize = rest - (got_eol ? 1 : 0 );
Info(buf, 1, (buf,
"[ Warning: Record too long (%u) ]\n", recsize));
got_eol = 0;
return WriteRecord(__G__ rawbuf+start, recsize);
}
else
{
memcpy(locptr, rawbuf + start, rest);
locptr += rest;
loccnt += rest;
}
}
return PK_COOL;
( run in 1.820 second using v1.01-cache-2.11-cpan-98e64b0badf )