From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 17-MAY-1989 19:04
To:	MRGATE::"ARISIA::EVERHART"
Subj:	vms2tar documentation (VMS TAR Part 2 of 4)

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Wed, 17 MAY 89 07:40:17 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Wed, 17 May 89 07:36:44 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.36)
	id AA01624; Wed, 17 May 89 07:29:51 -0700
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: 16 May 89 14:04:23 GMT
From: att!alberta!calgary!.UCalgary.CA!cliff@ucbvax.Berkeley.EDU
Organization: U. of Calgary, Calgary, Alberta, Canada
Subject: vms2tar documentation (VMS TAR Part 2 of 4)
Message-Id: <1386@cs-spool.calgary.UUCP>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

VMS2TAR Documentation
 
Greetings:                                      May.25/87
 
        Here is the current version (1.11) of a program to write Tar
format tapes on a VMS system. Comments and reports on bugs will be much
appreciated. It has been tried with a SUN system, and files were read
successfully.
 
        Before compiling, separate the program, at the "*** CUT HERE ***"
line below.
 
        The file-spec in the command string can use the usual VMS wild cards,
in fact almost anything that you would use in a DIRECTORY command. Successive
file-specs must be separated by commas, WITHOUT BLANK SPACES, or the
command handler separates them as separate arguments, and only the data
ahead of the blanks is used.
 
Example:   vms2tar cv [john.new...]*.c   will copy all of the .c files in
the subdirectories to the Tar file.
 
        Directory specifications are propagated to successive file
specifications, if there is no explicit directory specification. A
test with the "t" (list) option will help to show how it works.
 
        Note that UNIX does not permit two files of the same name in
the same directory, so the program does not assume the wild card for
the version number, and you should not use it in the input spec, or
only the last version written on the tape (the oldest) will survive
when extracted on the UNIX system. The program as written copies the
highest version number by default. The version number is NOT included
in the file name on the Tar tape.
 
        If you wish to output different version numbers to Tar, then
the code would be modified something like this in scan_name:
If there is a ";*" string in the searchname[] string, then convert
the ';' in the fname[] into an appropriate UNIX symbol, e.g. '.',,
so it will come out as "fname.c.34" , for example.
 
        Incidentally, .EXE programs from vms can be moved around on a tar tape,
and when re-extracted with the Tar reader, they run on vms again. (Note that
the file attributes are wrong, but the binary is correct...).
 
        The present program does not copy indexed files.They should be
copied as fixed-format files, but so far the byte counts returned by the
read() in out_file don't make sense.
 
        The "t" option lists the files that will be outputted to the Tar
file, but reports the size of the VMS version in bytes. When the "c" operation
is actually done, the files are converted to stream format byte by byte,
and the actual UNIX byte count is done then. Thus, directories will appear
to have a byte count, whereas when they are written to the Tar file, they
contain 0 bytes.
 
Sid Penstone,
VLSI Group,
Dept. of Electrical Engineering,
Queen's University,
Kingston, Ontario, Canada K7L 3N6
 
 Usage:
-------------------------------------------------------------------------
 
    -Define the logical variable "TAPE" to be the desired tape
     unit, or the output file.
 
    -Mount the tape /FOREIGN/BLOCK=10240/RECORD=512
     Existing data on the tape will be written over, unless the
     tape is moved to an end-of-file with the SET MAGTAPE/ commands.
 
    -Set the default directory to the top of the tree (if applicable).
     This gives pathnames on the tape that start at the current
     default. i.e. if your default is [MYDIRE.MAIN], the file
     [MYDIRE.MAIN]START.C will be copied as "start.c" ; the file
     [MYDIRE.MAIN.TESTS]RUNIT.C will be copied as "tests/runit.c" .
     Files that are not in the current default tree will be copied
     with a full pathname; e.g. "mydire/main/tests/runit.c"
 
   -Then run VMS2TAR: (either by RUN or as a command)
     if you use RUN, the operation is "(create, verbose) [...]*.*"
     As a command:
vms2tar [options] [file-spec,file-spec,,,]
     where the options are:
            "t" (listing of the files that will be copied (no copy done))
            "c" (create copies of the files on the output tape, starting
                        at the current position on the tape.)
            "v" (verbose: report activities on stdout)
            "w" (wait)  wait for 'y' or 'n' for action
            "d" (dot) Keep a trailing period in a file name
            "p" (prefix) (only if code is assembled) insert "./" in pathname
 
    -To use the options:
     the program must be executed using the foreign command
     feature of VMS by defining a command:
command :== $path:vms2tar      !where path= full location of vms2tar.exe
 
     - if no file-spec is given, the highest version number of all of
     the files in the current default directory and its subdirectories
     will be written out.
 
ERRORS:
    - "couldn't open Tar file":  likely forgot to MOUNT the tape
    - "error getting status" :  protection error
 
--------------------------------------------------------------------------
Important assumptions for this version:
 
    The defaults are (no options):
    -Extract the highest numbered version of all of the files in the
     current directory tree,reporting  as each file is created.
     Pathnames on the tape start below the current default directory; for
     example, if you are in [SID.MAIN], the files in [SID.MAIN.SUB]
     will be written as sub/filename .
 
    -Write to a tape, mounted foreign, with block size of 10240
     bytes, or a file of fixed record length. If a different block
     size is desired, change the  definition of BLKSIZE.
 
    -Close with the special (blank header) block written by UNIX.
     It will be followed by an end-of-file or end-of tape.
 
    -All files with record attributes are assumed to be text files
     and are converted into  UNIX stream files. This includes regular
     VMS text files, printer files, stream files, or Fortran output.
 
    -Files with fixed record length and no record attributes are
     copied in fixed block format. This includes .EXE files, and
     other specials, but not .OBJ files.
 
    -Does not copy files with variable-length, no record attributes;
     ex. .OBJ files. They are reported as not copied.
 
    -Does not copy savesets correctly.
 
 
 This version converts the directory names to UNIX format before creating
 the files. Some special cases:
 (1) Directories are written with a trailing "/".
 (2) Directories are created in  the order that they are encountered
        by the F$SEARCH() operation of VMS
 
--------------------------------------------------------------------------
Known Bugs:
    (1) Writes extra empty trailer blocks into a file as though it
     were a tape.Could be fixed by finding out if the output is a file.
    (2) The method used to remove the higher level directory spec.
     from the pathname may be a little flaky. Watch to see if any files
     end up in the wrong tree.
    (3) Can't change the default directory within the same run.
    (4) Cannot emulate the "r" or "u" functions of UNIX Tar. Separate
     files must be used.
    (5) There is a problem with indexed files (e.g .MAI files) that
        will be looked at later.
    (6) Files with no file extension will be written on the TAR file
        without a trailing "." ,unless the "d" option is set. This is
        to avoid having some files apparently vanish on the UNIX system
        that reads the tape, since "makefile" would otherwise be called
        "makefile.", etc. since VMS always includes the '.' in filenames.
    (7) There are similar problems with files that were copied from a
        UNIX Tar tape that had extra "." or "," in the file name; these will
        have been translated to "_" if my Tar-to-VMS reader was used, and
        will be written out with the '_', so the name will not be the
        original UNIX name. I do not have a cure for this. Maybe VMS
        version 5 will be more forgiving...
    (8) Version 1.11 will copy stream_lf files directly to the output
        file, without making the temporary version to count the bytes..
        much faster if you are moving stream_lf files anyhow.
 
Cliff Marcellus                UUCP     : {any backbone}!calgary!ssg-vax-a!cliff
Institute for Space Research   DOMAIN   : cliff@ssg-vax-a.phys.UCalgary.CA
Dept of Physics and Astronomy  SPAN     : CANCAL::CLIFF
The University of Calgary                 "If it's not fun, don't do it!"

