- i = 'n';
-
- } else { /* Extract entry */
- if (listing) { /* List entry */
- unsigned dostime = zip_header.formatted.modtime | (zip_header.formatted.moddate << 16);
- if (!verbose) {
- // " Length Date Time Name\n"
- // " -------- ---- ---- ----"
- printf( "%9u %02u-%02u-%02u %02u:%02u %s\n",
- (unsigned)zip_header.formatted.ucmpsize,
- (dostime & 0x01e00000) >> 21,
- (dostime & 0x001f0000) >> 16,
- (((dostime & 0xfe000000) >> 25) + 1980) % 100,
- (dostime & 0x0000f800) >> 11,
- (dostime & 0x000007e0) >> 5,
- dst_fn);
- total_usize += zip_header.formatted.ucmpsize;
- } else {
- unsigned long percents = zip_header.formatted.ucmpsize - zip_header.formatted.cmpsize;
- percents = percents * 100;
- if (zip_header.formatted.ucmpsize)
- percents /= zip_header.formatted.ucmpsize;
- // " Length Method Size Ratio Date Time CRC-32 Name\n"
- // "-------- ------ ------- ----- ---- ---- ------ ----"
- printf( "%8u Defl:N" "%9u%4u%% %02u-%02u-%02u %02u:%02u %08x %s\n",
- (unsigned)zip_header.formatted.ucmpsize,
- (unsigned)zip_header.formatted.cmpsize,
- (unsigned)percents,
- (dostime & 0x01e00000) >> 21,
- (dostime & 0x001f0000) >> 16,
- (((dostime & 0xfe000000) >> 25) + 1980) % 100,
- (dostime & 0x0000f800) >> 11,
- (dostime & 0x000007e0) >> 5,
- zip_header.formatted.crc32,
- dst_fn);
- total_usize += zip_header.formatted.ucmpsize;
- total_size += zip_header.formatted.cmpsize;
+ goto skip_cmpsize;
+ }
+
+ if (opts & OPT_l) {
+ /* List entry */
+ char dtbuf[sizeof("mm-dd-yyyy hh:mm")];
+ sprintf(dtbuf, "%02u-%02u-%04u %02u:%02u",
+ (zip.fmt.moddate >> 5) & 0xf, // mm: 0x01e0
+ (zip.fmt.moddate) & 0x1f, // dd: 0x001f
+ (zip.fmt.moddate >> 9) + 1980, // yy: 0xfe00
+ (zip.fmt.modtime >> 11), // hh: 0xf800
+ (zip.fmt.modtime >> 5) & 0x3f // mm: 0x07e0
+ // seconds/2 not shown, encoded in -- 0x001f
+ );
+ if (!verbose) {
+ // " Length Date Time Name\n"
+ // "--------- ---------- ----- ----"
+ printf( "%9u " "%s " "%s\n",
+ (unsigned)zip.fmt.ucmpsize,
+ dtbuf,
+ dst_fn);
+ } else {
+ char method6[7];
+ unsigned long percents;
+
+ sprintf(method6, "%6u", zip.fmt.method);
+ if (zip.fmt.method == 0) {
+ strcpy(method6, "Stored");