home *** CD-ROM | disk | FTP | other *** search
- 1000 '*************************************************************************
- 1010 '********** ZIPCOM V1.0 by Jack E Moore ************
- 1020 '********** SysOp: ACCOLADE! (512)388-1445 ************
- 1030 '********** 3/11/89 ************
- 1040 '*************************************************************************
- 1050 '
- 1060 ' The purpose of ZIPCOM is to allow a sysop to add more than just a 32
- 1070 'character comment to a file. ZIPCOM flings the door wide open on the
- 1080 'endless possibilities of creating a BBS unique LOGO that can be attached
- 1090 'to each .ZIP file. LOGO's, like mine below, are now possible!
- 1100 '
- 1110 '╒═════════════╡ Brought to you by ╞════════════╕
- 1120 '│ ACCOLADE! BBS in Round Rock, Texas │
- 1130 '│ (512)388-1445 24 Hours 1200-2400 baud │
- 1140 '│ 210 Meg! Running Genesis Deluxe! │
- 1150 '╘════════════╡ Jack E Moore SysOp ╞═══════════╛
- 1160 '
- 1170 ' Of course, You will need to experiment until you find a ZIP COMMENT
- 1180 'that works for you.
- 1190 '
- 1200 ' Syntax: ZIPCOM filename.ZIP
- 1210 '
- 1220 ' How does ZIPCOM do this? Easy! ZIPCOM reads a user defined ASCII
- 1230 'comment file and places it in the ZIP comment area of your .ZIP file.
- 1240 'As for the placement of this ZIP comment, ZIP allows the last 2 bytes
- 1250 'in the .ZIP file as the ZIP comment size. The last byte indicates
- 1260 'a multiple of 255 bytes, while the second to last byte indicates the
- 1270 'remainder. ie: hex 20 00 would indicate a comment size of 32 bytes and
- 1280 'hex C3 0B would indicate a comment size of 3000 bytes.
- 1290 ' Although ZIPCOM will allow you to put a ZIP comment of more than 254
- 1300 'bytes, it works best if you limit your Zip comment to no more than 254
- 1310 'bytes. With a ZIP comment of more than 255 bytes, you WILL NOT be able
- 1320 'to rerun ZIPCOM on your zip file without screwing it up. This is because
- 1330 'ZIPCOM starts from the back of the .ZIP file and scans forward until it
- 1340 'sees a hex 00. By making your comment more than 254 bytes long, you make
- 1350 'the byte that ZIPCOM looks for a none hex 00 value, thus effectively
- 1360 'removing the key that ZIPCOM looks for.
- 1370 ' YOU CAN RUN ZIPCOM WITH A ZIP COMMENT OF MORE THAN 254 BYTES! BUT
- 1380 'REMEMBER! IF YOUR ZIP COMMENT IS OVER 255 BYTES LONG, RUNNING ZIPCOM
- 1390 'ON THE SAME FILE TWICE WILL SCREW IT UP! SO BE SURE YOU HAVE YOUR
- 1400 'ZIP COMMENT RIGHT THE FIRST TIME!
- 1410 ' IF YOU KEEP YOUR ZIP COMMENT UNDER 254 BYTES, THEN YOU CAN RUN ZIPCOM
- 1420 'ALL DAY LONG ON THE SAME .ZIP FILE.
- 1430 '
- 1440 ' The other limits I have found is the maximum comment size is around
- 1450 '3000 bytes, But, hey! That's not too bad! If you can't make your
- 1460 'LOGO in 3000 bytes, then you are better off just adding a read.me file...
- 1470 '
- 1480 ' The only other problem with ZIPCOM is that it can't truncate existing
- 1490 'ZIP comments. That is to say that if you have a 1000 byte comment, and
- 1500 'you change it to a 500 byte comment, ZIPCOM will tell ZIP that you have
- 1510 'a 500 byte comment (and subsequent UNZIPping will show only those 500
- 1520 'bytes), BUT, the trailing 500 bytes from the previous 1000 byte comment
- 1530 'will still be there! This will be transparant to you, but who needs the
- 1540 'extra 500 bytes? This is a problem I have not been able to clear up
- 1550 'using BASIC. So, the only fix for this is to ZIP the file with NO
- 1560 'comment, and then run ZIPCOM on it. You shouldn't have a problem with
- 1570 'this, but, I wanted to let you know so no one will come whining back
- 1580 'to me.
- 1590 '
- 1600 ' OK, so why am I bothering to go into so much details on this? Well,
- 1610 'I want the users of this program to understand what is happening so if
- 1620 'something doesn't work, they can understand why and recover.
- 1630 '
- 1640 ' IT IS VERY important for you to experiment on a copy of a .ZIP file
- 1650 'until you get the desired result! (That is, until you can UNZIP your
- 1660 'file successfully AND see your NEW ZIP comment!
- 1670 '
- 1680 ' All in all, ZIPCOM will give your BBS files a distinctive diference!
- 1690 '
- 1700 ' Now for the bucks blurb. If you use this program in any way and find
- 1710 'it useful, let me know how much you like it by sending a buck or two
- 1720 'to me at: 3813 Rolling Hill, Round Rock, Texas 78681
- 1730 '
- 1740 ' If this program gives a REAL programmer an idea for a more professional
- 1750 'program, well, I hope he remembers me!
- 1760 '
- 1770 ' On with the code....
- 1780 '*************************************************************************
- 1790 D$ = "c:\zipcom.txt" 'D$ = the path and name of the ZIPCOM comment file
- 1800 COLOR 10,0 : YY = CSRLIN 'set color and find current cursor location
- 1810 ON KEY(10) GOSUB 2040 : KEY(10) ON 'set function key 10 as abort key
- 1820 C$ = COMMAND$ : IF C$ = "" THEN INPUT "Enter File name "; C$ 'get .ZIP filename from the command line. if none, ask for one.
- 1830 OPEN C$ FOR RANDOM AS #1 LEN = 1 : FIELD #1, 1 AS A$ 'open .ZIP filename
- 1840 OPEN D$ FOR RANDOM AS #2 LEN = 1 : FIELD #2, 1 AS B$ 'open ZIPCOM comment
- 1850 L = LOF(2) : L2 = INT(L/255) : L1 = L-(L2*255) 'calculate the byte sizes for the ZIPCOM comment. L1 = remainder. L2 = 255 multiple
- 1860 LOCATE YY, 1 : PRINT "Searching for comment begin mark"; 'report status
- 1870 FOR HX = LOF(1) TO 1 STEP -1 'start loop that looks for the hex 00
- 1880 GET #1, HX 'get a byte
- 1890 IF A$ <> CHR$(0) THEN 1900 ELSE 1910 'compare it to hex 00. if not, loop again, else assign HX with the location, and break from loop
- 1900 NEXT
- 1910 PRINT ". Found"; 'report status
- 1920 LSET A$ = CHR$(L1) : PUT #1, HX - 1 'assign L1 to the location before where the hex 00 was found earlier
- 1930 LSET A$ = CHR$(L2) : PUT #1, HX 'assign L2 to the location where the hex 00 was found earlier
- 1940 LSET A$ = CHR$(13) : PUT #1, HX + 1 'add a carriage return...
- 1950 LSET A$ = CHR$(10) : PUT #1, HX + 2 'and a line feed to aid in prettying up the display
- 1960 PRINT ". Adding Comment"; 'report status
- 1970 FOR X = HX + 3 TO LOF(2) + HX + 2 'starting at an offset of 3, (to compensate for the above 5 lines) start adding the ZIP comment
- 1980 XX = XX + 1 'counter that advances through the ZIP comment
- 1990 GET #2, XX : BB$ = B$ 'get a byte from the ZIP comment
- 2000 LSET A$ = BB$ : PUT #1, X 'sequentially add the ZIP comment to the .ZIP file
- 2010 NEXT
- 2020 PRINT ". Done" 'report status
- 2030 CLOSE 'close all open files
- 2040 SYSTEM 'break to DOS
-