Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

shar (sort of) for VMS

33 views
Skip to first unread message

Michael Bednarek

unread,
Jun 9, 1987, 6:36:31 AM6/9/87
to
Hi netlanders,

There were several source postings recently.

To overcome mailing and other difficulties, especially with postings of
several files, the unix world has 'shar'.

Some VMS people have come up with 'shar's of various degrees of sophistication.

Here I give you my VMS_SHAR.COM, a procedure which creates self-unpacking
procedures.

Features:
o The resulting file gives the username of its creator and date/time
of creation. If the global symbol REAL_NAME exists, its content is
also displayed.
o The resulting file contains a list of all its files.
o At creation time, each line is preceded by character 'X' which is
removed at unpacking time. This is to preserve leading tabs/spaces
through various mailers.
o Some mailers disallow postings above a certain size. VMS_SHAR will check
that the resulting file will not exceed MAX_PART_SIZE which is currently
set to 31 blocks (our mailer disallows postings >16000 characters).
If more than 31 blocks are to be posted, VMS_SHAR will create multiple
files by appending a 'part number' to the output file name (In fact, it will
append a 'part number' even if it creates only one file).
If one single input file exceeds MAX_PART_SIZE the user will be notified,
and 'part number' will be incremented such that subsequent manual splitting
has free 'part numbers' available.
o At both creation and unpacking time, each file is CHECKSUMmed; the result
of the comparison of both values is displayed to the user.

Enjoy!

Michael Bednarek u3369429@{murdu.oz.au | xvax.dn.mu.oz.au} "POST NO BILLS."


......................... Cut between dotted lines and save ....................
$!..............................................................................
$!
$! VAX/VMS archive file created by VMS_SHAR Version:'09-Jun-1987'
$! Copyright (c) 1987, by Michael Bednarek
$! To unpack, simply execute (@) the file.
$! This archive was created by U3369429 (Michael Bednarek)
$! on Tuesday 9-JUN-1987 20:13:46.19
$! It contains the following file(s):
$! VMS_SHAR.COM
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1:Open/Write Out 'File_is
$ Open/Read In VMS_SHAR_DUMMY.DUMMY
$Next_Record: Read/End_Of_File=EOF In Record
$ Write Out F$Extract(1,255,Record)
$ Goto Next_Record
$EOF: Close Out
$ Close In
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2:Return
$Start:
$ File_is="VMS_SHAR.COM"
$ Check_Sum_is=957769911
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$! VMS_SHAR.COM
X$! 09-Jun-1987 Michael Bednarek (u336...@murdu.oz.au)
X$! Copyright (c) 1987, by Michael Bednarek
X$! The distribution of this file is unrestricted as long as this notice
X$! remains intact.
X$!
X$! Usage: @VMS_SHAR file[,file...] sharfile
X$! where file spec can include wild-cards. File names are separated by commas.
X$!
X$ BEL[0,7]=7
X$ nPart="01"
X$ MAX_PART_SIZE=31 ! 31 blocks will keep us below 16000 bytes
X$! As this procedure adds a 'X' in the first position of every line, the
X$! resulting file can still become larger than MAX_PART_SIZE
X$ File_List=P1
X$ Shar_File=P2
X$ If File_List.eqs."" then Inquire File_List "_File(s)"
X$ If File_List.eqs."" then Exit
X$ If Shar_File.eqs."" then Inquire Shar_File "_Output"
X$ If Shar_File.eqs."" then Exit
X$!
X$ User=F$Edit(F$GetJPI("","USERNAME"),"COLLAPSE")
X$ If F$Type(Real_Name).nes."" then User=User+" ("+Real_Name+")"
X$ Set Symbol/Scope=(NoLocal,NoGlobal)
X$ Time=F$CVTime(,"Absolute","DateTime")
X$ Time=F$CVTime(Time,,"Weekday")+" "+Time
X$!
X$ On Control_Y then goto Abort
X$ On Error then Continue
X$!
X$ Copy SYS$Input 'Shar_File''nPart
X$ Deck/Dollars="INTRO_EOF"
X......................... Cut between dotted lines and save ....................
X$!..............................................................................
X$!
X$! VAX/VMS archive file created by VMS_SHAR Version:'09-Jun-1987'
X$! Copyright (c) 1987, by Michael Bednarek
X$! To unpack, simply execute (@) the file.
XINTRO_EOF
X$ Part_Size=0
X$ nParts=1
X$ Files=""
X$ Open/Append Out 'Shar_File''nPart
X$ Write Out "$! This archive was created by ''User'"
X$ Write Out "$! on ''Time'"
X$ Write Out "$! It contains the following file(s):"
X$ nE=-1
X$ nF=1
X$Next_Element:
X$ nF=nF-1
X$ nE=nE+1
X$ Element=F$Element(nE,",",File_List)
X$ If Element.eqs."," then goto Elements_Done
X$ Previous_File=""
X$!
X$Next_File:
X$ nF=nF+1
X$ File=F$Search(Element)
X$ If File.eqs."" .or. File.eqs.Previous_File then goto Next_Element
X$ Previous_File=File
X$ File'nF=F$Parse(File,,,"NAME")+F$Parse(File,,,"TYPE")
X$ Name=File'nF
X$ Write SYS$Output "looking at ",Name
X$ Size'nF=F$File_Attributes(Name,"EOF")
X$ Part_Size=Part_Size+Size'nF
X$ If Part_Size.le.MAX_PART_SIZE then goto Same_Part0
X$ nParts=nParts+1
X$ Part_Size=0
X$Same_Part0:
X$ If F$Length(Files)+F$Length(Name).le.77 then goto Same_Line
X$ Write Out "$!",Files
X$ Files=""
X$Same_Line:
X$ Files=Files+" "+Name
X$ Goto Next_File
X$!
X$Elements_Done:
X$ If Files.nes."" then Write Out "$!",Files
X$ If nParts.eq.1 then goto Only_One
X$ Write Out F$FAO("$!!!78*=")
X$ Write Out "$! ATTENTION: To keep each article below ", -
X F$Integer(MAX_PART_SIZE*512)," bytes, this program"
X$ Write Out "$! has been transmitted in several parts."
X$ Write Out "$! You should concatenate ALL parts to ONE file and execute ", -
X "(@) that file."
X$Only_One:
X$ Close Out
X$ Append SYS$Input 'Shar_File''nPart
X$ Deck/Dollars="SUBROUTINE_EOF"
X$!==============================================================================
X$ Set Symbol/Scope=(NoLocal,NoGlobal)
X$ CR[0,8]=13
X$ Pass_or_Failed="failed!,passed."
X$ Goto Start
X$Convert_File:
X$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
X$No_Error1:Open/Write Out 'File_is
X$ Open/Read In VMS_SHAR_DUMMY.DUMMY
X$Next_Record: Read/End_Of_File=EOF In Record
X$ Write Out F$Extract(1,255,Record)
X$ Goto Next_Record
X$EOF: Close Out
X$ Close In
X$ Delete VMS_SHAR_DUMMY.DUMMY;*
X$ Checksum 'File_is
X$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
X$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
X$No_Error2:Return
X$Start:
XSUBROUTINE_EOF
X$!
X$ n=0
X$Extract_Next:
X$ n=n+1
X$ Name=File'n
X$ Part_Size=F$File_Attributes("''Shar_File'''nPart'","EOF")+Size'n
X$ If Part_Size.le.MAX_PART_SIZE then goto Same_Part1
X$ nPart=F$FAO("!2ZL",F$Integer(nPart)+1)
X$ If Size'n.le.MAX_PART_SIZE then goto Fits
X$ Write SYS$Output BEL
X$ Write SYS$Output "The file ",Name," is ",F$Integer(Size'n-MAX_PART_SIZE),-
X " blocks larger than MAX_PART_SIZE."
X$ Write SYS$Output "You will have to carve up that file manually."
X$ Write SYS$Output "I'll attempt to increment the part number appropriately"
X$ Current_Part=F$Integer(nPart)
X$ nPart=F$FAO("!2ZL",F$Integer(Size'n/MAX_PART_SIZE)+Current_Part)
X$ Current_Part=F$FAO("!2ZL",Current_Part)
X$ Write SYS$Output "The file ''Shar_File'''nPart' should be split into"
X$ Write SYS$Output "''Shar_File'''Current_Part' to ''Shar_File'''nPart'."
X$ Write SYS$Output BEL
X$Fits:
X$ Write SYS$Output "Now writing to ''Shar_File'''nPart'"
X$ Copy NL: 'Shar_File''nPart
X$Same_Part1:
X$ Write SYS$Output "appending ",Name
X$ Open/Append Out 'Shar_File''nPart
X$ Write Out "$ File_is=""''Name'"""
X$ Checksum 'Name
X$ Write Out "$ Check_Sum_is=''CHECKSUM$CHECKSUM'"
X$ Write Out "$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY"
X$ Open/Read In 'Name
X$Next_Record:
X$ Read/End_Of_File=EOF In Record
X$ Write Out "X",Record
X$ Goto Next_Record
X$EOF:
X$ Close In
X$ Write Out "$ GoSub Convert_File"
X$ Close Out
X$ If n.lt.nF then goto Extract_Next
X$ Write SYS$Output -
X F$FAO("SHAR-file was written in !SL part!%S",F$Integer(nPart))
X$ Exit
X$!
X$Abort:
X$ Close/Error=Anyway Out
X$Anyway:
X$ Exit
$ GoSub stiorimerimer

0 new messages