From:	CRDGW2::CRDGW2::MRGATE::"SMTP::IRUCCVAX.UCC.IE::CBSY8001" 29-NOV-1989 14:46
To:	MRGATE::"ARISIA::EVERHART"
Subj:	BRUREAD - 1 of 3

Message-Id:  <8911291932.AA18816@crdgw1.ge.com>
Received: from IRUCCIBM.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.2MX) with BSMTP id 6195; Wed, 29 Nov 89 14:22:50 EDT
Received: from IRUCCVAX.UCC.IE (CBSY8001) by IRUCCIBM.BITNET (Mailer R2.05)
 with BSMTP id 7660; Wed, 29 Nov 89 19:18:08 IST
Date: Wed, 29 Nov 89 19:17 GMT
From: JFM%IRUCCVAX.UCC.IE@CUNYVM.CUNY.EDU
Subject: BRUREAD - 1 of 3
Sender: CBSY8001%IRUCCVAX.UCC.IE@CUNYVM.CUNY.EDU
To: everhart@arisia.DECNET
X-Vms-To: IN%"everhart@arisia.dnet.ge.com"

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.1-004  3-AUG-1989
$!   On 15-NOV-1989 14:54:37.50   By user CBSY8001
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 3 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. BRUREAD.COM;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ if f$getsyi("version") .ges. "V4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete/nolog 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete/nolog 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");
buff:=CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(buff))
;LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(buff));g:=0;LOOP EXITIF MARK(NONE)=END_OF(buff);x:=
ERASE_CHARACTER(1);IF g = 0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x=
"V" THEN APPEND_LINE;MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;
IF x="+" THEN g:=1;ERASE_LINE;ENDIF;ELSE IF x="-" THEN g:=0;ENDIF;ERASE_LINE;
ENDIF;ENDLOOP;p:="`";POSITION(BEGINNING_OF(buff));LOOP r:=SEARCH(p,FORWARD);
EXITIF r=0;POSITION(r);ERASE(r);COPY_TEXT(ASCII(INT(ERASE_CHARACTER(3))));
ENDLOOP;o:=GET_INFO(COMMAND_LINE,"output_file");WRITE_FILE(buff,o);
ENDPROCEDURE;Unpacker;EXIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create/nolog 'f'
X$!
X$! Create BRUREAD
X$!
X$ Copy Sys$Input BRU.TXT
X
X BRU `091qualifiers`093 files(s)
X
X Qualifiers:
X
X /COPY`009(default) copy files to disk
X /LIST`091=filespec`093 makes listing of backup set, implies /NOCOPY
X /LOG
X /REWIND (default) rewind tape before operation
X /TOTAL  (default) lists/logs total number of files processed / total blocks
X /SELECT=(File`091,File`091,...`093`093)
X /EXCLUDE=(File`091,File`091,...`093`093)
X`009* and % wildcard allowed
X`009Specify directories with leading zeroes: `091002,005`093
X
X Parameter:
X
X File Specification of tape or TPC copy of tape
X Tape must be mounted /FOREIGN, specify only device name
X
X*** Note: BRUread automatically creates subdirectories for save-set name
X    and directory name.
X    Ex.:   `091.RSXMPL.001054`093
X
X    If the directories already exist, they should be empty. (At least,
X    the created files must not already exist. If the files exist, BRU
X    appends (!) to the files
X$ Copy Sys$Input BRU.CLD
XDEFINE VERB BRU
X`009IMAGE BRUREAD
X`009QUALIFIER COPY, DEFAULT
X`009QUALIFIER LOG
X`009QUALIFIER LIST, VALUE (TYPE=$FILE, DEFAULT=SYS$OUTPUT)
X`009QUALIFIER TOTAL, DEFAULT
X`009DISALLOW ANY2 (COPY,LIST)
X`009DISALLOW ANY2 (LOG,LIST)
X`009QUALIFIER SELECT, VALUE (REQUIRED, TYPE=$FILE, LIST)
X`009QUALIFIER EXCLUDE, VALUE (REQUIRED, TYPE=$FILE, LIST)
X`009QUALIFIER REWIND, DEFAULT
X
X`009PARAMETER P1, VALUE (REQUIRED,TYPE=$FILE,LIST),
X`009`009LABEL=TAPE, PROMPT="Tape"
X
X`009QUALIFIER DEBUG, SYNTAX=SDEBUG
X
XDEFINE SYNTAX SDEBUG
X`009IMAGE ADRIAN:`091util`093BRUREAD
X$ Copy Sys$Input BRUMSG.MSG
X`009.TITLE`009BRU Messages
X
X`009.FACILITY BRUREAD,1/PREFIX=BRUREAD$_
X
X`009.SEVERITY`009SUCCESS
X
X`009CREATED`009`009<!AS created (!UL blocks)>/FAO_COUNT=2
X`009FILEPURGED`009<!AS created and older version purged (!UL blocks)>/FAO_CO
VUNT=2
X
X`009.SEVERITY`009INFORMATIONAL
X
X`009UPDATED`009`009<!AS updated (!UL blocks)>/FAO_COUNT=2
X`009WORKING`009`009<Processing !AS>/FAO_COUNT=1
X`009TOTAL`009`009<!AS>/FAO_COUNT=1
X`009CREDIR`009`009<Created directory !AS>/FAO_COUNT=2
X
X`009.SEVERITY`009ERROR
X
X`009FNF`009`009<!AS not found>/FAO_COUNT=1
X
X`009.SEVERITY`009SEVERE
X
X`009IVDEV`009`009<Invalid device>
X`009NOTMOUNTED`009<Device not mounted>
X`009NOTFOREIGN`009<Magnetic tape must be mounted /FOREIGN>
X
X`009.END
X$ Copy Sys$Input BRUREAD.PAS
X`123+`125
X`123`009Program BRUREAD`009: read BRU files`009`125
X`123`009`009`009`009`009`009`125
X`123`009Written by Adrian Weiler 1986/87`009`125
X`123`009Non-commercial use is OK.`009`009`125
X`123`009Feel free to give this program to`009`125
X`123`009anybody that can use it, as long as`009`125
X`123`009you don't do that for profit. Please`009`125
X`123`009don't remove this heading.`009`009`125
X`123`009`009`009`009`009`009`125
X`123`009Sorry for the bad docs & for the lots`009`125
X`123`009of hacks in this code. I didn't write`009`125
X`123`009this program for profit either...`009`125
X`123`009`009`009`009`009`009`125
X`123`009BRUREAD consists of:`009`009`009`125
X`123`009BRUREAD.PAS `009( this file )`009`009`125
X`123`009BRU.CLD`009`009( Set Command BRU )`009`125
X`123`009BRUMSG.MSG`009( Message/OBJ )`009`009`125
X`123`009BRU.TXT`009`009( short doc )`009`009`125
X`123`009`009`009`009`009`009`125
X`123`009Link: Link BRUREAD,BRUMSG`009`009`125
X`123`009`009`009`009`009`009`125
X`123`009If anybody makes improvements, please`009`125
X`123`009let me know. My address (snail mail):`009`125
X`123`009Adrian Weiler`009`009`009`009`125
X`123`009Hennentalweg 12`009`009`009`009`125
X`123`0097400 Tuebingen`009`009`009`009`125
X`123`009W-Germany`009`009`009`009`125
X`123`009Phone (49)(7071) 45054`009`009`009`125
X`123`009Note: Decimal 45054 = Hex AFFE = Monkey`009`125
X`123`009BITNET: MIWE001@DTUZDV5A (until Mar'89)`009`125
X`123`009After Apr'89, I probably won't have`009`125
X`123`009that account anymore, so you could`009`125
X`123`009contact a friend: ZRKH001 (ZR?HK?)`009`125
X`123`009or CFKS001 @ the same node.`009`009`125
X`123-----------------------------------------------`125
X
X`091inherit ('SYS$LIBRARY:STARLET')`093
X`009program bruread (output,brudat,tfile,listfile);
XType
X  V5000 = Varying `0915000`093 of char;
X  ufile = `091unsafe`093 file of char;
X  Fname = packed array `0911..256`093 of char;
X  String = varying `09180`093 of char;
X  FabPointer = `094Fab$type;
X  RabPointer = `094Rab$type;
X  XabPointer = `094Xab$type;
X  NamPointer = `094Nam$type;
X  TPointer   = `094FName;
X  byte = `091byte`093 0..255;
X  word = `091word`093 0..65535;
X
X  item = packed record
X`009siz, typ : word;
X`009adr : integer;
X  end;
X
X`123 Map RSX-11M File Header `125
X`123 ----------------------- `125
X
X  RsxHeader = packed record
X`009idof,
X`009mpof : byte;
X`009fnum,
X`009fseq : word;
X`009flev,
X`009fstr : byte;
X`009uicmember,
X`009uicgroup : byte;
X`009prot : word;
X`009ucha,
X`009scha : byte;
X
X`009`123 Settable by ATR$C_RECATTR (7 Words) `125
X`009rtyp,
X`009ratt : byte;
X        rsiz : word;
X        hibh,
X        hibk : word;
X        efbh,
X        efbk : word;
X`009ffby : word;
X
X`009ufat : packed array `0911..9`093 of word;
X`009rest : packed array `0911..466`093 of byte;
X  end;
X
X  hda  = packed array `0911..512`093 of char;`009`009`123 Type cast for RsxH
Veader `125
X
X
X`123 Internal representation of File Header `125
X`123 -------------------------------------- `125
X
X  FileHeaderPointer = `094FileHeader;
X  FileHeader = `091unsafe`093 record
X`009bt : integer;`009`009`009`009`123 Total Blocks `125
X`009name : packed array `0911..5`093 of word;`009`123 File name in Rad50 `12
V5
X`009directory : packed array `0911..6`093 of char;
X`009attributes : record`009`009`009`123 User settable attributes `125
X`009`009artyp,
X`009`009aratt : byte;
X`009        arsiz : word;
X`009        ahibh,
X`009        ahibk : word;
X`009        aefbh,
X`009        aefbk : word;
X`009`009affby : word;
X`009end;
X`009dates : record`009`009`009`009`123 User settable dates `125
X`009`009arvno : word;`009`009`009`009`123 revision number `125
X`009`009arday : packed array `0911..2`093 of char;`009`123 Revision date `12
V5
X`009`009armon : packed array `0911..3`093 of char;
X`009`009aryea : packed array `0911..2`093 of char;
X`009`009arhou : packed array `0911..2`093 of char;
X`009`009armin : packed array `0911..2`093 of char;
X`009`009arsec : packed array `0911..2`093 of char;
X
X`009`009acday : packed array `0911..2`093 of char;`009`123 creation date `12
V5
X`009`009acmon : packed array `0911..3`093 of char;
X`009`009acyea : packed array `0911..2`093 of char;
X`009`009achou : packed array `0911..2`093 of char;
X`009`009acmin : packed array `0911..2`093 of char;
X`009`009acsec : packed array `0911..2`093 of char;
X`009end;
X`009aesqn : byte;`009`009`009`123 extension sequence number `125
X`009aefnu : word;`009`009`009`123 next extension file number `125
X`009back  : FileHeaderPointer;`009`123 Backpointer to file header
X`009`009`009  `009`009  whose extension the current one is `125
X`009ause : byte;`009`009`009`123 number of retrieval pointers in use `125
X`009artrv : packed array `0911..102`093 of packed record
X`009`009asize : byte;
X`009`009albn : integer;
X`009end;
X  end;
X
X  c3 = varying `0913`093 of char;
X
X
X  SigArr = Array `0910..9`093 of Integer;`009`123 Signal Array `125
X  MchArr = Array `0910..4`093 of Integer;`009`123 Mechanism Array `125
X
X
X  Lptr = `094ListItem;
X
X  ListItem = Record
X    Link : Lptr;
X    Name : Varying `09130`093 Of Char;
X  End;
X`012
Xvar
X
X  BRUREAD$_CREATED`009 : `091external,value`093 Integer;
X  BRUREAD$_FILEPURGED`009 : `091external,value`093 Integer;
X  BRUREAD$_UPDATED`009 : `091external,value`093 Integer;
X  BRUREAD$_WORKING`009 : `091external,value`093 Integer;
X  BRUREAD$_TOTAL`009 : `091external,value`093 Integer;
X  BRUREAD$_CREDIR`009 : `091external,value`093 Integer;
X  BRUREAD$_FNF`009`009 : `091external,value`093 Integer;
X  BRUREAD$_IVDEV`009 : `091external,value`093 Integer;
X  BRUREAD$_NOTMOUNTED`009 : `091external,value`093 Integer;
X  BRUREAD$_NOTFOREIGN`009 : `091external,value`093 Integer;
X
X  HeaderPointer : Array `0910..65535`093 Of FileHeaderPointer;
X
X  listfile : text;
X  tfile : `091unsafe`093 text;
X  fullname : string;
X  TapeChannel,
X  Channel : word;
X
X  St1, St2,
X  Context : integer := 0;
X  Listspec,
X  Resultspec,
X  Filespec : Varying `09180`093 of char;
X  Fab : FabPointer;
X  DevInfo : Dev$type;
X
X  FileOpen,
X  Tape,
X  FlagCopy,
X  FlagDebug,
X  FlagExclude,
X  FlagLog,
X  FlagList,
X  FlagSelect,
X  FlagTotal,
X  FlagRewind : Boolean := False;
X
X  Select,
X  Exclude : Lptr := Nil;
X
X  openstat,
X  stat: Integer;
X  iosb: Packed Array `0911..4`093 of word;
X
X  atrlist : record
X    att : packed array `0911..2`093 of item;
X    fin : integer
X  end := zero;
X
X  brudat : file of V5000;
X  CurrentFileHeader : FileHeaderPointer := nil;
X  buf : `091unsafe,aligned(1)`093 v5000;
X  backup_set : varying `09112`093 of char;
X
X  TotalFiles,
X  TotalBlocks,
X  curr_file,
X  b,
X  block_size,
X  bufpos,
X  pos,
X  l : integer := 0;
X
X  mode : (undefined,directory,header,data,end_of_file) := undefined;
X  dirbuf : `091unsafe`093 packed record
X`009fnum, fseq, fvol : word;
X`009fnam : packed array `0911..3`093 of word;
X`009ftyp, fver : word;
X  end;
X  dirspec : varying `0916`093 of char;
X
X  fnambuf : `091unsafe`093 packed record
X`009fnam : packed array `0911..3`093 of word;
X`009ftyp, fver : word;
X`009rvno : word;
X`009rday : packed array `0911..2`093 of char;
X`009rmon : packed array `0911..3`093 of char;
X`009ryea : packed array `0911..2`093 of char;
X`009rhou : packed array `0911..2`093 of char;
X`009rmin : packed array `0911..2`093 of char;
X`009rsec : packed array `0911..2`093 of char;
X
X`009cday : packed array `0911..2`093 of char;
X`009cmon : packed array `0911..3`093 of char;
X`009cyea : packed array `0911..2`093 of char;
X`009chou : packed array `0911..2`093 of char;
X`009cmin : packed array `0911..2`093 of char;
X`009csec : packed array `0911..2`093 of char;
X
X`009eday : packed array `0911..2`093 of char;
X`009emon : packed array `0911..3`093 of char;
X`009eyea : packed array `0911..2`093 of char;
X  end;
X  mapbuf : `091unsafe`093 packed record
X`009esqn,
X`009ervn : byte;
X`009efnu,
X`009efsq : word;
X`009ctsz,
X`009lbsz,
X`009use,
X`009map : byte;
X`009rtrv : packed array `0911..102`093 of packed record
X`009`009lbnh, Size : byte;
X`009`009lbnl : word;
X`009end;
X  end;
X
X  datbuf : `091unsafe`093 packed array `0911..8`093 of record
X`009fnum : Word;
X`009lbnh,Size : Byte;
X`009lbnl : word;
X  end;
X  Hdrbuf  : RsxHeader;
X  hdrflag : boolean := false;
X  eofflag : boolean := false;
X  rad50 : `091readonly`093 packed array `0911..40`093 of char :=
X`009 ' ABCDEFGHIJKLMNOPQRSTUVWXYZ$./0123456789';
X
X  line : varying`091132`093 of char;
X`012
X`091External(Lib$Signal)`093 Function $Signal
X      ( %Immed Cond : Integer;
X`009%Immed Arguments : `091List,Unsafe`093 Integer
X      ) : Integer; Extern;
X
X`091Asynchronous`093 Function Handler
X      ( Var SigArgs : SigArr;
X`009Var MchArgs : MchArr
X      ) : Integer;
X
XBegin
X  If SigArgs`0911`093 Div 65536 <> 0`009`009`123 Not a System Signal `125
X  Then SigArgs`0910`093 := SigArgs`0910`093-2;`009`123 Remove PC, PSL `125
X  if sigargs`0911`093 <> ss$_unwind then $Putmsg ( SigArgs );
X
X  Case SigArgs`0911`093 Mod 8 Of
X    0,  `123 Warning `125
X    1,  `123 Success `125
X    3 : `123 Information `125`009Handler := SS$_Continue;
X    2 : `123 Error `125`009Handler := SS$_Continue;
X    Otherwise Begin
X`009$Unwind ( MchArgs`0912`093+1 );`009`123 Fatal: Exit program `125
X    End;
X  End;
XEnd;
X
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-
