Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/qdos/qdos.c view on Meta::CPAN
if (!strncmp(jbp->longid, JBLONGID, strlen(JBLONGID)))
{
if (eb_len != JBEXTRALEN)
fputs("warning: invalid length in QZ field", stderr);
if (jbp->header.d_type)
{
fs_heads(fgetchid(G.outfile), (timeout_t)-1,
&jbp->header, 14);
G.pInfo->file_attr |= S_IXUSR;
}
}
break;
default:
Trace((stderr,"qfix: unknown extra field block, ID=%d\n",
extra->shortid));
break;
}
/* Skip this extra field block */
ef_ptr += (eb_len + EB_HEADSIZE);
ef_len -= (eb_len + EB_HEADSIZE);
}
}
#ifdef QDOS
# include <utime.h>
long timezone = 0;
#endif
/****************************/
/* Function close_outfile() */
/****************************/
void close_outfile(__G)
__GDEF
{
union {
iztimes t3; /* mtime, atime, ctime */
struct utimbuf t2; /* modtime, actime */
} zt;
#ifdef USE_EF_UT_TIME
unsigned eb_izux_flg;
#endif
if (G.extra_field) {
qfix(__G__ G.extra_field, G.lrec.extra_field_length);
}
fclose(G.outfile);
/*---------------------------------------------------------------------------
Change the file permissions from default ones to those stored in the
zipfile.
---------------------------------------------------------------------------*/
#ifndef NO_CHMOD
if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
perror("chmod (file attributes) error");
#endif
/*---------------------------------------------------------------------------
Convert from MSDOS-format local time and date to Unix-format 32-bit GMT
time: adjust base year from 1980 to 1970, do usual conversions from
yy/mm/dd hh:mm:ss to elapsed seconds, and account for timezone and day-
light savings time differences. If we have a Unix extra field, however,
we're laughing: both mtime and atime are ours.
---------------------------------------------------------------------------*/
/* skip restoring time stamps on user's request */
if (uO.D_flag <= 1) {
#ifdef USE_EF_UT_TIME
eb_izux_flg = (G.extra_field ? ef_scan_for_izux(G.extra_field,
G.lrec.extra_field_length, 0,
G.lrec.last_mod_dos_datetime,
#ifdef IZ_CHECK_TZ
(G.tz_is_valid ? &(zt.t3) : NULL),
#else
&(zt.t3),
#endif
NULL) : 0);
if (eb_izux_flg & EB_UT_FL_MTIME) {
TTrace((stderr,
"\nclose_outfile: Unix e.f. modif. time = %ld\n",
zt.t3.mtime));
} else {
zt.t3.mtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
}
if (eb_izux_flg & EB_UT_FL_ATIME) {
TTrace((stderr,
"close_outfile: Unix e.f. access time = %ld\n",
zt.t3.atime));
} else {
zt.t3.atime = zt.t3.mtime;
TTrace((stderr,
"\nclose_outfile: modification/access times = %ld\n",
zt.t3.mtime));
}
#else
zt.t3.atime = zt.t3.mtime
= dos_to_unix_time(G.lrec.last_mod_dos_datetime);
#endif
/* set the file's access and modification times */
if (utime(G.filename, &(zt.t2))) {
Info(slide, 0x201, ((char *)slide,
"warning: cannot set the time for %s\n",
FnFilter1(G.filename)));
}
}
} /* end function close_outfile() */
#ifdef TIMESTAMP
/***************************/
( run in 1.122 second using v1.01-cache-2.11-cpan-140bd7fdf52 )