[comp.os.vms] tar.2_of_2

IUS@DACTH51.BITNET (Eberhard W. Lisse) (01/11/88)

Here is the second part of the public domaine tar for VMS.

regards, el


$Part2:
$ File_is="VMS2TAR.DOC"
$ Check_Sum_is=1412616241
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
XGreetings:                                      Nov.3,1986
X        Here is the current version of a program to write Tar format tapes on
Xa VMS system. Comments and reports on bugs will be much appreciated. It
Xhas been tried with a SUN system, and files were read successfully.
X        Before compiling, separate the program, at the "*** CUT HERE ***"
Xline below.
X        Incidentally, .EXE programs from vms can be moved around on a tar tape,
Xand when re-extracted with the Tar reader, they run on vms again. (Note that
Xthe file attributes are wrong).
X        The file-spec in the command string can use the usual VMS wild cards,
Xin fact anything that you would use in a DIRECTORY command. Successive
Xfile-specs must be separated by commas, without blank spaces, or the
Xcommand handler separates them as separate arguments, and only the data
Xahead of the blanks is used.
XExample:   vms2tar cv [john.new...]*.c   will copy all of the .c files in
Xthe subdirectories to the Tar file.
X        Directory specifications are propagated to successive file
Xspecifications, if there is no explicit directory specification. A
Xtest with the "t" (list) option will help to show how it works.
X        Note that UNIX does not permit two files of the same name in
Xthe same directory, so the program does not assume the wild card for
Xthe version number, and you should not use it in the input spec, or
Xonly the last version written on the tape (the oldest) will survive
Xwhen extracted on the UNIX system. The program as written copies the
Xhighest version number by default. The version number is NOT included
Xin the file name on the Tar tape.
X        If you wish to output different version numbers to Tar, then
Xthe code would be modified something like this in scan_name:
XIf there is a ";*" string in the searchname[] string, then convert
Xthe ';' in the fname[] into an appropriate UNIX symbol, e.g. '.',,
Xso it will come out as "fname.c.34" , for example.
X
X
XSid Penstone,
XVLSI Group,
XDept. of Electrical Engineering,
XQueen's University,
XKingston, Ontario, Canada K7L 3N6
X
X Usage:
X-------------------------------------------------------------------------
X
X    -Define the logical variable "TAPE" to be the desired tape
X     unit, or the output file.
X
X    -Mount the tape /FOREIGN/BLOCK=10240/RECORD=512
X     Existing data on the tape will be written over, unless the
X     tape is moved to an end-of-file with the SET MAGTAPE/ commands.
X
X    -Set the default directory to the top of the tree (if applicable).
X     This gives pathnames on the tape that start at the current
X     default. i.e. if your default is [MYDIRE.MAIN], the file
X     [MYDIRE.MAIN]START.C will be copied as "start.c" ; the file
X     [MYDIRE.MAIN.TESTS]RUNIT.C will be copied as "tests/runit.c" .
X     Files that are not in the current default tree will be copied
X     with a full pathname; e.g. "mydire/main/tests/runit.c"
X
X   -Then run VMS2TAR: (either by RUN or as a command)
X     if you use RUN, the operation is "(create, verbose) [...]*.*"
X     As a command:
Xvms2tar [options] [file-spec,file-spec,,,]
X     where the options are:
X            "t" (listing of the files that will be copied (no copy done))
X            "c" (create copies of the files on the output tape, starting
X                        at the current position on the tape.)
X            "v" (verbose: report activities on stdout)
X            "w" (wait)  not implemented
X    -To use the options:
X     the program must be executed using the foreign command
X     feature of VMS by defining a command:
Xcommand :== $path:vms2tar      !where path= full location of vms2tar.exe
X
X     - if no file-spec is given, the highest version number of all of
X     the files in the current default directory and its subdirectories
X     will be written out.
X
XERRORS:
X    - "couldn't open Tar file":  likely forgot to MOUNT the tape
X    - "error getting status" :  protection error
X
X--------------------------------------------------------------------------
XImportant assumptions for this version:
X
X    The defaults are (no options):
X    -Extract the highest numbered version of all of the files in the
X     current directory tree,reporting  as each file is created.
X     Pathnames on the tape start below the current default directory; for
X     example, if you are in [SID.MAIN], the files in [SID.MAIN.SUB]
X     will be written as sub/filename .
X
X    -Write to a tape, mounted foreign, with block size of 10240
X     bytes, or a file of fixed record length. If a different block
X     size is desired, change the  definition of BLKSIZE.
X
X    -Close with the special (blank header) block written by UNIX.
X     It will be followed by an end-of-file or end-of tape.
X
X    -All files with record attributes are assumed to be text files
X     and are converted into  UNIX stream files. This includes regular
X     VMS text files, printer files, stream files, or Fortran output.
X
X    -Files with fixed record length and no record attributes are
X     copied in fixed block format. This includes .EXE files, and
X     other specials, but not .OBJ files.
X
X    -Does not copy files with variable-length, no record attributes;
X     ex. .OBJ files. They are reported as not copied.
X
X    -Does not copy savesets correctly.
X
X
X This version converts the directory names to UNIX format before creating
X the files. Some special cases:
X (1) Directories are written with a trailing "/".
X (2) Directories are created in  the order that they are encountered
X        by the F$SEARCH() operation of VMS
X
X--------------------------------------------------------------------------
XKnown Bugs:
X    (1) Writes extra empty trailer blocks into a file as though it
X     were a tape.Could be fixed by finding out if the output is a file.
X    (2) The method used to remove the higher level directory spec.
X     from the pathname may be a little flaky. Watch to see if any files
X     end up in the wrong tree.
X    (3) Can't change the default directory within the same run.
X    (4) Cannot emulate the "r" or "u" functions of UNIX Tar. Separate
X     files must be used.
X    (5) There is a problem with indexed files (e.g .MAI files) that
X        will be looked at shortly.
X    (6) Files with no file extension will be written on the TAR file
X        with a trailing "." . This can cause some files to apparently
X        vanish on the UNIX system that reads it, since "makefile" is
X        now called "makefile." , etc. So they will have to be renamed
X        on the UNIX system back to the correct name.
X        There are similar problems with files that were copied from
X        UNIX that had extra "." or "," in the file name; these will
X        have been translated to "_", and written back out.
$ GoSub Convert_File
$ Exit