From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 12-DEC-1989 01:13
To:	MRGATE::"ARISIA::EVERHART"
Subj:	VMS TAR v1.1 patch 1

Received: From UCBVAX.BERKELEY.EDU by GIZMO.SRI.COM with TCP; Mon, 11 DEC 89 19:42:01 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.40)
	id AA14135; Mon, 11 Dec 89 19:30:19 -0800
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 12 Dec 89 18:48:33 GMT
From: zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!murtoa.cs.mu.oz.au!viccol!timcc@tut.cis.ohio-state.edu  (Tim Cook)
Organization: Computer Services, Victoria College, Melbourne
Subject: VMS TAR v1.1 patch 1
Message-Id: <3525@csv.viccol.edu.au>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Contained herein is a VMS SHARE archive containing a DCL command procedure
to patch VMS TAR version 1.1.  This will give you version 1.1-1.

APPLY THIS PATCH (by executing the DCL command procedure) TO ORIGINAL,
UNCHANGED VERSION 1.1 SOURCES (as posted).

Then you will have to recompile (at least TAR.PAS, TAR_EXTRACT.PAS,
TAR_WRITE.PAS and TARMSG.MSG), re-link and redefine the DCL command ($ SET
COMMAND TAR).  See the instructions from version 1.1 for more details.

Bug fixes and new features in VMS TAR v1.1-1 include:

   1. Correct handling of './' directory.

   2. Support for jokers running VMS versions older than V5. (Really.  I
      know I forgot one thing in v1.1, but this time it really should work.
      You may have to take out the declaration of LIB$CVT_VECTIM in
      VCDEFS.PAS, but it shouldn't be necessary).

   3. Support for multiple versions of VMS files.  There is a new /VERSION
      qualifier that tells TAR to WRITE or APPEND all specified versions of
      a file, and to retain the semi-colon and the version number when
      converting the filename.  No re-conversion on EXTRACT though (you
      can always write a .COM to do it).

I must apologize to several people who were told by me that this would be
forthcoming in the next 2-3 weeks (claimed about 2 months ago).  I got a
flat tyre ;-)

Hopefully this will be the last effort I put into VMS TAR.  I can't see any
more bugs, and I haven't heard many requests for added features.  I will
continue to listen to bug reports, and if convinced strongly enough, I may
make other changes, but I think the job is done.

Enjoy,

Tim Cook
Systems Administrator,
Victoria College Computer Services

P.S.  Looks like I got my wish for a VMS sources newsgroup :-)

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.1-004  3-AUG-1989
$!   On 12-DEC-1989 13:20:49.42   By timcc@viccol.edu.au (Tim Cook)
$!
$! This VMS_SHARE Written by Andy Harper, Kings College London UK
$!
$! TO UNPACK THIS SHARE FILE, REMOVE LINES ABOVE "CUT HERE"
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. TAR-1_1-PATCH1.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$ SET COMMAND SYS$INPUT:
Xdefine verb SUMSLP`009! Equivalent to a properly defined EDIT/SUM
X   image SUMSLP
X   parameter p1, label=INPUT
X   qualifier LISTING
X      value (type=$outfile)
X   qualifier OUTPUT
X      default
X      value (type=$outfile)
X   qualifier HEADER
X   qualifier UPDATE
X      placement=positional
X      value (list, type=$infile)
X$ SUMSLP TAR.CLD/UPDATE=SYS$INPUT:
X-   20
X   QUALIFIER`009version
X-   30
X   QUALIFIER  `009version
X/
X$ SUMSLP TAR.HLP/UPDATE=SYS$INPUT:
X-   55,   62
X`009$ TAR EXTRACT "*.c", "*.h" /CONFIRM
X`009Extract alloc.c ? (Y/N) `091Y`093: n
X`009Extract main.c ? (Y/N) `091Y`093: <Return>
X`009%TAR-S-CREATED, created DISK:`091USER`093MAIN.C;1 (2573 records)
X`009Extract misc.c ? (Y/N) `091Y`093: <Return>
X`009%TAR-S-CREATED, created DISK:`091USER`093MISC.C;1 (523 records)
X`009Extract misc.h ? (Y/N) `091Y`093: Yes
X`009%TAR-S-CREATED, created DISK:`091USER`093MISC.H;1 (28 records)
X-  259
X
X</VERSION
X
X  Instructs TAR to include the version number at the end of each file
X  name (excluding directories) and to write all versions of a file when
X  writing to an archive.  Version numbers are usually excluded because
X  Unix does not have a file version mechanism, and the semi-colon (;),
X  used by VMS to denote a following version number, is interpreted by
X  Unix shells as a command separator.
X-  365
X
X</VERSION
X
X  Instructs TAR to include the version number at the end of each file
X  name (excluding directories) and to write all versions of a file when
X  writing to an archive.  Version numbers are usually excluded because
X  Unix does not have a file version mechanism, and the semi-colon (;),
X  used by VMS to denote a following version number, is interpreted by
X  Unix shells as a command separator.
X/
X$ SUMSLP TAR.PAS/UPDATE=SYS$INPUT:
X-   14,   14
X! Release:`009Version 1.1-1
X-   38,   40
X      dot_slash = dot + slash ;
X
X      tar_archive_kt = 'TAR_ARCHIVE' ;
X-   54,   54
X      version_kt = 'VERSION' ;
X      scan_kt = 'SCAN' ;
X
X      power_32_quad = 4294967296q0 ;               `123 2`09432 `125
X      UNIX_epoch_quad = 35067168q9 ;    `123 1-JAN-1970 in VMS time `125
X-   64,   64
X      tar__writdir,
X      tar__appended,
X      tar__appendir,
X-  500
X   FUNCTION UNIX_to_VMS_time (
X      VAR UNIX_time : unsigned ;
X      delta_seconds : integer := 0) : lib_date_type ;
X
X      VAR
X         h_time : quadruple ;
X         return_time : lib_date_type ;
X
X      BEGIN
X         h_time := UNIX_time * 1q7 ;
X         h_time := h_time + UNIX_epoch_quad ;
X         `123 Convert to local time `125
X         h_time := h_time + delta_seconds * 1q7 ;
X         return_time.hi := trunc (h_time / power_32_quad) ;
X         h_time := h_time - return_time.hi * power_32_quad ;
X         return_time.lo := utrunc (h_time) ;
X         UNIX_to_VMS_time := return_time ;
X         END ;
X           `032
X
X-  517,  520
X                  VMS_rel_UNIX_epoch.hi * power_32_quad ;
X               h_time := h_time + quad (VMS_rel_UNIX_epoch.lo) ;
X               h_time := h_time / 1q7 ;    `123 convert to seconds `125
X               h_time := h_time - delta_seconds ; `123 convert to GMT `125
X-  524,  525
X                  IF h_time > (power_32_quad - 1) THEN
X                     VMS_to_UNIX_time := %xFFFFFFFF  `123 2`09432 - 1 `125
X-  587
X         UNIX_filespec_l : filespec_type ;
X-  596,  597
X            UNIX_dir := '' END
X         ELSE BEGIN
X            UNIX_filespec_l := UNIX_filespec ;
X            IF i > 1 THEN
X               IF substr (UNIX_filespec, 1, 2) = './' `123 redundant noise `
V125
X               THEN BEGIN
X                  UNIX_filespec_l := substr (UNIX_filespec_l, 3,
X                     UNIX_filespec_l.length - 2) ;
X                  i := i - 2 END ;
X-  601,  601
X                  IF UNIX_filespec_l`091i`093 <> slash THEN
X-  607,  609
X            name :=
X               substr (UNIX_filespec_l, i + 1, UNIX_filespec_l.length - i) ;
X            IF i > 1 THEN
X               UNIX_dir := substr (UNIX_filespec_l, 1, i - 1)
X-  630,  631
X- 1010, 1010
X      appending : boolean := false ;
X      retain_version : boolean := false) ; external ;
X- 1016, 1016
X      map_mode : map_mode_type ;
X      retain_version : boolean := false) ; external ;
X- 1046, 1049
X               cli_present (scan_kt), get_map_mode,, cli_present (version_kt
V)) ;
X         'A' :
X            tar_append (archive_filespec, cli_present (confirm_kt),
X               cli_present (scan_kt), get_map_mode, cli_present (version_kt)
V) ;
X/
X$ SUMSLP TARMSG.MSG/UPDATE=SYS$INPUT:
X-   11,   11
XWRITDIR`009`009<written directory !AS> /FAO=1
XAPPENDED`009<appended !AS (!SL byte!%S)> /FAO=2
XAPPENDIR`009<appended directory !AS> /FAO=1
X/
X$ SUMSLP TAR_EXTRACT.PAS/UPDATE=SYS$INPUT:
X-  114,  114
X-  126,  131
X         out_xabrdt.XAB$Q_RDT := UNIX_to_VMS_time (file_mtime, delta_seconds
V) ;
X-  178,  178
X         file_scanned, warned_of_wrap : boolean ;
X-  317,  317
X            file_scanned := false ;
X-  326,  333
X                        IF NOT confirm AND (file_spec <> dot_slash) THEN BEG
VIN
X                           make_directory (file_spec, file_mode) ;
X                           files_created := files_created + 1 END
X                        ELSE
X                           `123 do nothing `125
X                     ELSE BEGIN
X                        extract_file (archive`094, file_spec, file_size,
X                           file_mtime, file_mode) ;
X                        files_created := files_created + 1 END ;
X                     file_scanned := true END
X-  340,  340
X            IF file_scanned THEN
X/
X$ SUMSLP TAR_WRITE.PAS/UPDATE=SYS$INPUT:
X-   18
X      input_filespec_default : filespec_type ;
X-   75,   75
X      VAR prefix : filespec_type ;
X      retain_version : boolean := false) ;
X-   88,   88
X            selection := UNIX_filespec (selection, absolute_mode,,
X               retain_version) ;
X-  274,  274
X      directory : boolean := false ;
X      retain_version : boolean := false) ;
X-  293,  293
X            prefix_length, retain_version) ;
X-  349,  349
X      appending : boolean := false ;
X      retain_version : boolean := false) ;
X-  358,  358
X         write_message, write_dir_message : sts_type ;
X-  384,  384
X               modification_date, protection, length (prefix),,
X               retain_version) ;
X-  410,  410
X               modification_date, protection, length (prefix),,
X               retain_version) ;
X-  453,  453
X               modification_date, protection, length (prefix),,
X               retain_version) ;
X-  475,  475
X               put (archive) ;
X               LIB$SIGNAL (write_dir_message, 1, %STDESCR (temp_string)) END
X-  487,  490
X            write_message := tar__written ;
X            write_dir_message := tar__writdir END
X         ELSE BEGIN
X            truncate (archive) ;
X            write_message := tar__appended ;
X            write_dir_message := tar__appendir END ;
X-  498,  499
X               collect_filespecs (prefix, retain_version) ;
X               filespecs_in_storage := true END ;
X         IF retain_version THEN
X            input_filespec_default := '*.*;*'
X         ELSE
X            input_filespec_default := '*.*;' ;
X-  557,  557
X      map_mode : map_mode_type ;
X      retain_version : boolean := false) ;
X-  588,  588
X            tar_write ('', confirm, scan, map_mode, true, retain_version)
X/
X$ WRITE SYS$OUTPUT "VMS TAR V1.1-1 ready to compile"
$ CALL UNPACK TAR-1_1-PATCH1.COM;1 1749678983
$ WRITE SYS$OUTPUT "Enter @TAR-1_1-PATCH1 in source directory to apply patch"
$ v=f$verify(v)
$ EXIT

