2 rem "shar" sequential files program 4 : 6 : 8 rem "BUGS : The directory read routine should be in machine code. 9 rem " : This program should be compiled, alternately. 10 rem " : All files to be archived have to be online and available 12 rem " at the same time. 13 rem " : Output is in PETSCII, Kermit or other protocol is expected 14 rem " to perform any needed ASCII translation. 15 rem " : The archive produced does not check for correct size nor does 16 rem " it set the file permissions to sane settings. 18 rem " : There may be problems on a single 1541/1571 with opening a 20 rem " write file and opening/closing several sequential files during 22 rem " the course of creating the archive. This is a DOS problem. 24 rem " : DOS errors are either ignored or handled ungracefully. 26 rem " : This program only will shar SEQuential files. 28 rem " : This program is longer than it needs to be. 30 : 32 : 34 printchr$(14)"This program takes multiple ASCII" 36 print"sequential files and produces a UNIX" 38 print"style 'shell archive' (shar). It can" 40 print"take files from several different" 42 print"devices/drives provided all are online" 44 print"at the same time." 46 printchr$(17)"Created by Joe Greco " 48 print"Please E-mail bug reports, etc. to me." 50 print:print"Joe Greco":print"9905 W. Montana Ave." 52 print"West Allis, WI 53227-3329" 54 me$="The Unknown C64 User": rem unix user's name/e-mail address 56 printchr$(17)"loading shar.obj"chr$(17):ml=49152 58 a=ml 60 read x:ifx<>-1thenpokea,x:a=a+1:goto60 62 dim f$(1000),f1$(1000),u(1000),d$(1000):fp=0 64 print chr$(17)"Input file pattern ä*å";:f2$="*":input f2$ 66 : 68 printchr$(17)"Input device/unit # ä8å";:u2=8:input u2 70 ifu2<8oru2>31thenprint"Invalid! 8-31 only please":goto68 72 : 74 printchr$(17)"Input drive # ä0å";:d2$="0":input d2$ 76 ifd2$<>"0"andd2$<>"1"thenprint"Invalid! 0 or 1 only please":goto74 78 : 80 printchr$(17)"Do you wish to strip a filename prefix?" 82 print"If so, enter it at this time (or just" 84 print"press RETURN):";:sr$="*":input sr$ 86 : 88 close15:open15,u2,15,"i"+d2$:cm=0 90 close4:open4,u2,.,"$"+d2$+":"+f2$ 92 get#4,a$,b$,a$,b$,a$,b$ 94 get#4,a$:ifa$>""then94 96 get#4,a$,b$:ifa$=""andb$=""thenclose4:goto138 98 get#4,a$,b$:printasc(a$+chr$(.))+256*asc(b$+chr$(.)); 100 get#4,a$:printa$;:ifa$<>chr$(34)anda$>""then100 102 ifa$=""thenclose4:goto138 104 f$="" 106 get#4,a$:printa$;:ifa$<>chr$(34)thenf$=f$+a$:goto106 108 get#4,t$:printt$;:ift$=" "then108 110 get#4,a$:printa$;:ifa$>""then110 112 if t$<>"s"thenprint:goto96 114 ifcmthenprinttab(40)"#"fp+1" - Add":goto130 116 printtab(40)"#"fp+1"Add?(Y/N/A/Q)"; 118 geta$:ifa$=""then118 120 ifa$="n"thenprint"N":goto136 122 ifa$="y"thenprint"Y":goto130 124 ifa$="q"thenprint"Q":goto138 126 ifa$<>"a"thenprint:print"Y/N/A/Q only please";:goto116 128 print"A":cm=1 130 fp=fp+1:f$(fp)=f$:u(fp)=u2:d$(fp)=d2$ 132 f1$(fp)=f$:ifleft$(f$,len(sr$))=sr$thenf1$(fp)=mid$(f$,len(sr$)+1) 134 iffp>999thenprint"Too many files.":goto150 136 goto96 138 print:print"End of input file list on "u2"/"d2$".":close4:close15 140 print"Do you have more files on another drive" 142 print"or perhaps more on this one with a" 144 print"different pattern? (y/n) ";:input a$ 146 ifa$="y"then64 148 ifa$<>"n"thenprintchr$(17)"'y' or 'n' only, please."chr$(17):goto140 150 print "End of file list.":iffp=0thenprint"No files selected.":stop 152 print chr$(17)"Output file name äarchive.sharå";:f3$="archive.shar":input f3$ 154 : 156 printchr$(17)"Output device/unit # ä8å";:u3=8:input u3 158 ifu3<3oru3>31thenprint"Invalid! 8-31 only please":goto156 160 : 162 printchr$(17)"Output drive # ä0å";:d3$="0":input d3$ 164 ifd3$<>"0"andd3$<>"1"thenprint"Invalid! 0 or 1 only please":goto162 166 : 168 open14,u3,15,"i"+d3$:open 3,u3,3,d3$+":"+f3$+",s,w" 170 input#14,a$,b$,c$,d$:ifval(a$)=0then186 172 close3:ifa$<>"63"then182 174 printchr$(17)"Output file already exists! Overwrite?" 176 print"(Y/N) ";:input a$:ifa$="n"thengoto184 178 ifa$<>"y"thenprintchr$(17)"Y or N only please.":goto174 180 print#14,"s"+d3$+":"+f3$:close14:goto168 182 print"Output file error: "a$","b$","c$","d$ 184 close2:close14:stop 186 print#3,"#! /bin/sh":print#3,"#" 188 print#3,"# This is a pseudo shell archive. To unpack this shar, use" 190 print#3,"# 'sh file.shar' or 'sh < file.shar'.":fl$="" 192 print#3,"# Contents: ";:fora=1 to fp 194 iflen(f1$(a)+fl$)<60thenfl$=fl$+f1$(a)+" ":goto200 196 print#3,fl$:print#3,"# "; 198 fl$="" 200 next:print#3,fl$ 202 print#3,"# Wrapped by: "me$:print#3,"#" 204 print#3,"# C64 SHAR by Joe Greco " 206 print#3,"# 9905 W. Montana Ave. Please send bug reports, money," 208 print#3,"# West Allis, WI 53227-3329 etc. :-)":print#3,"#" 210 print#3,"PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin ; export PATH" 212 for a=1 to fp:f$=f$(a):u2=u(a):d2$=d$(a):f1$=f1$(a):gosub222:next 214 print#3,"# Done." 216 print#3,"echo shar: End of shell archive." 218 print#3,"exit 0" 220 close3:end 222 print" "chr$(145) 224 print "Doing "f$chr$(145) 226 print#3,"echo shar: Extracting ö"chr$(34)"'"f1$"'ö"chr$(34) 228 print#3,"sed "chr$(34)"s/↑X//"chr$(34)" >'"f1$"' <<'END▁OF▁FILE'" 230 open2,u2,2,d2$+":"+f$ 232 sys ml 234 close2 236 print#3,"END▁OF▁FILE" 238 return 240 data76,3,192,169,13 242 data141,101,192,32,204 244 data255,162,2,32,198 246 data255,160,0,32,228 248 data255,153,0,196,165 250 data144,41,64,208,32 252 data200,192,254,208,239 254 data32,204,255,162,3 256 data32,201,255,160,0 258 data185,0,196,32,102 260 data192,200,192,254,208 262 data245,32,204,255,76 264 data8,192,32,204,255 266 data162,3,32,201,255 268 data200,132,97,160,0 270 data185,0,196,32,102 272 data192,200,196,97,208 274 data245,173,101,192,201 276 data13,240,5,169,13 278 data32,210,255,76,204 280 data255,0,72,173,101 282 data192,201,13,208,5 284 data169,216,32,210,255 286 data104,141,101,192,76 288 data210,255,-1 ;CBM4-2 ARC �jsSHAR BAS jeILEBASECOM F?M