Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!inuxc!iuvax!pur-ee!j.cc.purdue.edu!i.cc.purdue.edu!purdue!gatech!mcnc!decvax!decwrl!thundr.dec.com!minow From: minow@thundr.dec.com (Martin Minow THUNDR::MINOW ML3-5/U26 223-9922) Newsgroups: comp.os.vms Subject: re: VMS_SHAR Message-ID: <8801091738.AA29108@decwrl.dec.com> Date: 9 Jan 88 20:24:00 GMT Organization: Digital Equipment Corporation Lines: 112 A recent posting includes: >bryce@hoser.berkeley.EDU (Bryce Nesbitt) writes in RISKS 6.2 : > >>Subject: Viral VAXination? (Re: RISKS-6.1) >> >>> (Martin Minow THUNDR::MINOW ML3-5/U26 223-9922) writes: >>> To set the record straight, I didn't write the message, but had forwarded it to Risks. Instead of using a self-executing command file to distribute software, I've been using a variant of Kernighan and Plauger's "text archive" utility (from Software Tools). Essentially, there are two programs: one takes a wildcard list of files and writes them to a container file, preceeding each file by a header record of the format: -h- file.name The archive builder also quotes all lines beginning with '-' so archives can include other archives. The format is very simple and has proven very effective. It is slightly deficient in that a trailer record (with word/byte counts and a checksum) might prevent transmission errors. While I usually use C programs to pack and unpack archives, I have also written (and briefly tested) a command file to do the unpacking, which is enclosed in the hopes that it might prove useful. An archive builder shouldn't require more than a few hours to write. (Or, you can use your favorite editor.) Martin Minow minow%thundr.dec@decwrl.dec.com decvax!decwrl!dec-rhea!dec-thundr!minow $! archx.com written (quickly) in DCL $! Martin Minow (minow%thundr.dec@decwrl.dec.com) $! This software is in the public domain. It is offered without $! maintenence or warranty of any kind. $ was_verify = 'f$verify(0) + f$verify(0'archx_verify' .gt. 0) $ on control_y then goto abnormal_exit $ on warning then goto abnormal_exit $! Hack command argument $ source = p1 $ if source .eqs. "" then - read/end=abnormal_exit/prompt="Archive source file: " - sys$command source $ outname = "" $ if f$parse(source,,,, "SYNTAX_ONLY") .eqs. "" then goto noinput $ source = f$parse(source, ".ARC") $ open/read/error=noinput input 'source' $ read: $ read/end=endfile/error=abnormal_exit input line $ if f$extract(0, 3, line) .eqs. "-h-" then goto gotheader $ if f$extract(0, 1, line) .nes. "-" then goto dowrite $ line = f$extract(1, f$length(line), line) $ dowrite: $ if outname .nes. "" then goto write $ write sys$output "No output file, skipping ""''line""" $ goto read $ write: $ count = count + 1 $ write output line $ goto read $! $ gotheader: $ if outname .nes. "" then close output $ if outname .nes. "" then - $ write sys$output " Closed ""''outname'"", wrote ''count' records." $ outname = f$element(1, " ", line) ! Note: "" $ i = f$locate(" ", outname) ! Note: "" $ outname = f$extract(0, i, outname) ! Might get whole string $ docreate: $ if f$parse(outname,,,, "SYNTAX_ONLY") .eqs. "" then goto nocreate $ outname = f$parse(outname,".") $ open/write/error=nocreate output 'outname' $ write sys$output "Creating ""''outname'""" $ count = 0 $ goto read $! $ noinput: $ write sys$error "Can't open ""''source'""" $ if .not. $status then write sys$error f$message($status) $ goto abnormal_exit $! $ nocreate: $ write sys$error "Can't create ""''outname'""" $ if .not. $status then write sys$error f$message($status) $ if f$mode() .eqs. "INTERACTIVE" then goto askforoutput $ write sys$error " ... Skipping this file" $ outname = "NL:" $ goto docreate $! $ askforoutput: $ read/end=abnormal_exit/prompt="Output for ""''line'"": " - sys$command outname $ goto docreate $! $ endfile: $ close input $ if outname .nes. "" then close output $ if outname .nes. "" then - $ write sys$output " Closed ""''outname'"", wrote ''count' records." $ $status = 1 ! SS$_NORMAL (How do right?) $ goto normal_exit $! $ abnormal_exit: $ status = $status !save failure status $ if status then status = "%x08000002" !force error if neccessary $ set noon $ goto exit $ normal_exit: $ status = $status !save success status $ exit: $ exit ('status' .or. %x10000000) + f$verify(was_verify) * 0 $! End of archx.com