Patch#2 for unzipbsd
Michael Enkelis
michaele at vice.ICO.TEK.COM
Thu May 18 06:27:01 AEST 1989
Here is PATCH#2 for unzipbsd.c
This will allow a "list" of the zip file with time and date
information, etc for each file.
This is a DIFF listing, feed to patch.
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# unzipbsd.P2
# This archive created: Wed May 17 13:25:23 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'unzipbsd.P2'" '(5383 characters)'
if test -f 'unzipbsd.P2'
then
echo shar: will not over-write existing file "'unzipbsd.P2'"
else
sed 's/^ X//' << \SHAR_EOF > 'unzipbsd.P2'
X269a270
X> int extract = 1; /* Extract contents */
X271a273
X> int list_zip = 0; /* list contents only */
X274a277,280
X> int numbad =0;
X> int Total_files =0;
X> long Total_bytes =0;
X> long Total_length =0;
X281c287
X< if (test_zip)
X---
X> if (!extract)
X407c413
X< if (!test_zip)
X---
X> if (extract)
X769,771c775,777
X< printf(" Testing: %-12s ", filename);
X< else
X< printf(" Extracting: %-12s ", filename);
X---
X> printf("Testing: %-12s ", filename);
X> if (extract)
X> printf(" Extracting: %-12s ", filename);
X779,781c785,787
X< printf(" Testing: %-12s ", filename);
X< else
X< printf("UnShrinking: %-12s ", filename);
X---
X> printf("Testing: %-12s ", filename);
X> if (extract)
X> printf("UnShrinking: %-12s ", filename);
X791,793c797,799
X< printf(" Testing: %-12s ", filename);
X< else
X< printf(" Expanding: %-12s ", filename);
X---
X> printf("Testing: %-12s ", filename);
X> if (extract)
X> printf(" Expanding: %-12s ", filename);
X815,819c821,831
X< if (crc32val != lrec.crc32)
X< printf(" Bad CRC %08lx (should be %08lx)", lrec.crc32, crc32val);
X< else
X< if (verbose)
X< printf(" Passed, CRC = %08lx", lrec.crc32);
X---
X> if (!list_zip) {
X> if (crc32val != lrec.crc32) {
X> numbad++;
X> printf(" Bad");
X> if(verbose)
X> printf(", CRC %08lx (should be %08lx)", lrec.crc32, crc32val);
X> } else {
X> printf(" Ok");
X> if (verbose)
X> printf(", CRC = %08lx", lrec.crc32);
X> }
X820a833
X> }
X868a882,891
X> byte yr, mo, dy; /* parts of a date */
X> byte hh, mm, ss; /* parts of a time */
X>
X> static char *mon[] = /* month abbreviations */
X> {
X> "Jan", "Feb", "Mar", "Apr",
X> "May", "Jun", "Jul", "Aug",
X> "Sep", "Oct", "Nov", "Dec"
X> };
X>
X882a906,913
X> yr = (lrec.last_mod_file_date >> 9) & 0x7f; /* dissect the date */
X> mo = (lrec.last_mod_file_date >> 5) & 0x0f;
X> dy = lrec.last_mod_file_date & 0x1f;
X>
X> hh = (lrec.last_mod_file_time >> 11) & 0x1f; /* dissect the time */
X> mm = (lrec.last_mod_file_time >> 5) & 0x3f;
X> ss = (lrec.last_mod_file_time & 0x1f) * 2;
X>
X888,889c919,923
X< printf("Mod time : %d\n",lrec.last_mod_file_time);
X< printf("Mod date : %d\n",lrec.last_mod_file_date);
X---
X> printf("Mod time :");
X> printf("%2d:%02d%c\n",
X> (hh > 12 ? hh - 12 : hh), mm, (hh > 11 ? 'p' : 'a'));
X> printf("Mod date :");
X> printf("%2d %3s %02d\n", dy, mon[mo - 1], (yr + 80) % 100);
X907a942,951
X> byte yr, mo, dy; /* parts of a date */
X> byte hh, mm, ss; /* parts of a time */
X>
X> static char *mon[] = /* month abbreviations */
X> {
X> "Jan", "Feb", "Mar", "Apr",
X> "May", "Jun", "Jul", "Aug",
X> "Sep", "Oct", "Nov", "Dec"
X> };
X>
X930a975,982
X> yr = (rec.last_mod_file_date >> 9) & 0x7f; /* dissect the date */
X> mo = (rec.last_mod_file_date >> 5) & 0x0f;
X> dy = rec.last_mod_file_date & 0x1f;
X>
X> hh = (rec.last_mod_file_time >> 11) & 0x1f; /* dissect the time */
X> mm = (rec.last_mod_file_time >> 5) & 0x3f;
X> ss = (rec.last_mod_file_time & 0x1f) * 2;
X>
X937,938c989,993
X< printf("Mod time : %d\n",rec.last_mod_file_time);
X< printf("Mod date : %d\n",rec.last_mod_file_date);
X---
X> printf("Mod time :");
X> printf("%2d:%02d%c\n",
X> (hh > 12 ? hh - 12 : hh), mm, (hh > 11 ? 'p' : 'a'));
X> printf("Mod date :");
X> printf("%2d %3s %02d\n", dy, mon[mo - 1], (yr + 80) % 100);
X949a1005,1028
X>
X> if (list_zip) {
X> Total_files++;
X> Total_bytes += rec.uncompressed_size;
X> Total_length += rec.compressed_size;
X>
X> printf("%-12s %8d ", filename,rec.uncompressed_size);
X> if (verbose) {
X> printf("%8d ",rec.compressed_size);
X> if (rec.compressed_size)
X> printf("%3d%% ",100L - (100L * rec.compressed_size)/
X> rec.uncompressed_size);
X> else
X> printf("--- ");
X> }
X>
X> printf("%2d %3s %02d", dy, mon[mo - 1], (yr + 80) % 100);
X>
X> if (verbose)
X> printf(" %2d:%02d%c",
X> (hh > 12 ? hh - 12 : hh), mm, (hh > 11 ? 'p' : 'a'));
X> printf("\n");
X> }
X>
X982a1062,1071
X> if (list_zip) {
X> if (verbose) {
X> printf("\nName Length Size now SF Date Time");
X> printf("\n============ ======== ======== ==== ========= ========\n");
X> } else {
X> printf("\nName Length Date");
X> printf("\n============ ======== =========\n");
X> }
X> }
X>
X996a1086,1111
X> if (test_zip) {
X> if (numbad < 1)
X> printf("No errors detected\n");
X> else
X> if (numbad == 1)
X> printf("One error detected\n");
X> else
X> printf("%d errors detected\n",numbad);
X> }
X> if (list_zip) {
X> if (verbose) {
X> printf(" ==== ======== ======== ==== \n");
X> printf("Total: %4d %8d %8d ",
X> Total_files,Total_bytes,Total_length);
X> if (Total_length)
X> printf("%3d%%\n", 100 - (100 * Total_length)/
X> Total_bytes);
X> else
X> printf("---\n");
X>
X> } else {
X> printf(" ==== ========\n");
X> printf("Total: %4d %8d\n",
X> Total_files,Total_bytes);
X> }
X> }
X1048c1163
X< while ((c = getopt (argc, argv, "dtv")) != EOF)
X---
X> while ((c = getopt (argc, argv, "dltv")) != EOF)
X1052c1167,1168
X< case 't': test_zip++; break;
X---
X> case 'l': list_zip =1;extract =0; break;
X> case 't': test_zip =1;extract =0; break;
X1114c1230
X< printf("Usage: UnZip -htv FILE[.zip]\n\n");
X---
X> printf("Usage: UnZip -hltv FILE[.zip]\n\n");
X1115a1232
X> printf(" -l List zip archive.\n");
SHAR_EOF
if test 5383 -ne "`wc -c < 'unzipbsd.P2'`"
then
echo shar: error transmitting "'unzipbsd.P2'" '(should have been 5383 characters)'
fi
fi # end of overwriting check
# End of shell archive
exit 0
--
_ _ _ __
' ) ) ) / /) / ` / /) Michael Enkelis
/ / / o _. /_ __. _ // /-- __ /_ _ // o _ tektronix!vice!michaele
/ ' (_(_(__/ /_(_(_(<_(/_ (___, /) )_/ <_(<_(/_(_/_)_ (503) 627-4099
More information about the Alt.sources
mailing list