home *** CD-ROM | disk | FTP | other *** search
- From: dhesi@bsu-cs.bsu.edu (Rahul Dhesi)
- Newsgroups: alt.sources
- Subject: zoo 2.1 source part 09/15
- Message-ID: <12776@bsu-cs.bsu.edu>
- Date: 10 Jul 91 10:34:45 GMT
-
- Checksum: 251396339 (verify with "brik -cv")
- Submitted-by: dhesi@bsu-cs.bsu.edu
- Archive-name: zoo210/part09
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # This is part 09 of zoo210
- # ============= vmsbugs.doc ==============
- if test -f 'vmsbugs.doc' -a X"$1" != X"-c"; then
- echo 'x - skipping vmsbugs.doc (File already exists)'
- else
- echo 'x - extracting vmsbugs.doc (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'vmsbugs.doc' &&
- X
- X
- X Zoo 2.0 on VAX/VMS
- X by
- X Rahul Dhesi
- X
- X
- The zoo archiver is used to create and maintain archives containing mul-
- tiple files that may be stored in compressed format. Consult the zoo
- manual for more details. This document describes those features of
- VAX/VMS zoo that are specific to the VAX/VMS implementation.
- X
- X
- X INSTALLATION
- X
- The file "descrip.mms" is a makefile suitable for use with DEC's imple-
- mentation of make, called MMS. To avoid any confusion, delete the file
- called "makefile" as that is not for VAX/VMS systems and it might con-
- fuse MMS. With all source files in the current directory, simply type
- MMS and wait while all files get compiled and linked. Then give the
- command "mms fiz" to build "fiz.exe", and "mms blif" to build "bilf.exe".
- X
- If your system does not have MMS, execute the "vmsbuild.com" script.
- X
- The result should be the executable program, "zoo.exe", "fiz.exe",
- and "bilf.exe".
- X
- Optionally, the command "mms zoobig.exe" will create a version of the
- executable that is linked without the shareable library. This may be
- more portable if you intend to transfer it to an VMS system that does
- not have its own C compiler. But "zoobig.exe" will be about twice the
- size of "zoo.exe".
- X
- To run zoo, bilf, and fiz, you will need to set up symbols by giving
- commands similar to the following, either by typing them at the system
- prompt or by putting them in your "login.com" file.
- X
- X $ zoo :== $ user$disk:[userdir]zoo.exe
- X $ fiz :== $ user$disk:[userfir]fiz.exe
- X $ bilf :== $ user$disk:[userdir]bilf.exe
- X
- In place of "user$disk" use the name of the device on which
- your login directory is located, and instead of "userdir" use
- the name of the directory in which you have placed the executable
- programs "zoo.exe" and "fiz.exe".
- X
- X
- X WARNING -- VMS BUGS
- X
- VAX/VMS peculiarities cause unusual bahavior.
- X
- X - VMS C does not preserve uppercase characters in a command line. To
- X specify a command containing an uppercase character, enclose the
- X command in double quotes. For example, the command
- X
- X zoo aM stuff *
- X
- X will not work under VMS. To make this command work under VMS, use
- X double quotes like this:
- X
- X zoo "aM" stuff *
- X
- X - For most text files that are not in stream-LF format, VMS returns
- X an incorrect file size to zoo. This will be evident if you use the
- X "f" modifier to tell zoo to archive files without compression.
- X Files that were in stream-LF format will be stored with the correct
- X size; other text files will be stored with an incorrect value for
- X the original size of the file.
- X
- X When such files are extracted, however, they are extracted in
- X stream-LF format, which is the only file format that VMS seems to
- X handle correctly. Thus, so far as I can determine, no file con-
- X tents are actually lost, and the only evidence of the problem is
- X that in archive listings, files stored without compression may
- X still appear to be compressed by about 1 to 5 percent, or occasion-
- X ally by some meaningless value.
- X
- X - VAX/VMS uses many different types of file structures. Zoo creates
- X archives in stream-LF format, and all archives used by zoo in any
- X way must be in this format. It is dangerous to use zoo on an
- X archive that is in any other format, because it may permanently
- X corrupt the archive contents. Thus, if you have uploaded an
- X archive to a VMS system using Kermit, do not try to manipulate it
- X with zoo until you have converted it to stream-LF format. File
- X conversion instructions are given later in this document.
- X
- X - The VAX/VMS batch system causes the C statement
- X
- X fflush(stdout);
- X
- X to become equivalent to:
- X
- X printf("\n");
- X
- X The result is that if files are added to a zoo archive from a batch
- X run, the batch log will look very strange and contain spurious new-
- X lines.
- X
- X
- X ARCHIVING SELECTED FILES
- X
- Zoo can read filenames from standard input. This allows you to use an
- external program to generate a list of files to be archived. When this
- list is fed to zoo, it will archive only the selected files.
- X
- For this example, assume that files are to be archived in an archive
- called "backups.zoo".
- X
- To achieve redirection of input under VAX/VMS, the following steps are
- necessary:
- X
- X 1. Create a file containing the filenames to be archived. Suppose
- X this file is called "names.lis".
- X
- X 2. Redirect zoo's standard input thus:
- X
- X $ define /user_mode SYS$INPUT names.lis
- X
- X
- X 3. Invoke zoo thus:
- X
- X $ zoo "aI" backups
- X
- X This command line will cause zoo to read a list of filenames from
- X its standard input, and archive them into "backups.zoo". Since the
- X logical name SYS$INPUT was changed to refer to the file
- X "names.lis", zoo will read filenames from that file.
- X
- A good way of creating a list of files to be archived is to use the vms
- "directory" command. Include at least the switches shown:
- X
- X $ directory /noheading /notrailing /column=1 /output=names.lis
- X
- This tells VMS to produce a list of filenames, one per line, and to
- store the resulting output in the file "names.lis". You can also add
- additional selection options. For example, to select all files that
- have been modified in the last 12 hours:
- X
- X $ dir/nohead/notrail/col=1/out=names.lis/since=-12:00/modified
- X
- A good way to decrease the effort is to create a symbol as follows:
- X
- X $ select:=="dir/nohead/notrail/col=1/out=names.lis/modified/since="
- X
- Now you can archive all *.c files modified in the last 60 minutes by
- giving the following commands:
- X
- X $ select -1:00:00 *.c
- X $ define/user sys$input names.lis
- X $ zoo "aI" backups
- X
- X
- X FILE TRANSFERS WITH KERMIT
- X
- Zoo archives can be uploaded to a VAX/VMS system and downloaded from it
- using Kermit. Due to VMS limitations, some file conversions must be
- done to avoid a corrupted zoo archive.
- X
- Zoo always expects zoo archives to be in stream-LF format. However, the
- standard VAX/VMS Kermit does not create stream-LF files, and treats them
- as text files when it reads them, resulting in corrupted downloads.
- Thus you must handle Kermit transfers with care. The following discus-
- sions refers solely to the standard Kermit-32, which I believe is from
- the Stevens Institute of Technology. If the following instructions are
- carefully followed, you should be able to transfer zoo archives between
- a VAX/VMS system and a microcomputer running Kermit.
- X
- KERMIT UPLOADS: To transfer a zoo archive from a microcomputer to a
- VAX/VMS system, do the following.
- X
- X 1. Invoke VAX/VMS Kermit as shown below. It will prompt you with the
- X string "Kermit-32>". Give it a command as shown to tell it to
- X receive a binary file:
- X
- X $ kermit
- X Kermit-32> set file type binary
- X Kermit-32> set block-check 3
- X Kermit-32> receive
- X
- X Note: Do not use the command "set file type fixed". In most cases
- X it will not work.
- X
- X The command to set the block-check is optional, but tells Kermit to
- X use a 16-bit CRC, which is much more reliable than the default 6-
- X bit CRC. Use this command if your version of Kermit does not use a
- X 16-bit CRC by default.
- X
- X 2. At this point, VAX/VMS Kermit is waiting for you to send it a file.
- X Now tell your local Kermit to send the file. On an MS-DOS system,
- X using MS-Kermit, you would do this by first typing the local escape
- X sequence to get to the local mode, where the prompt is "MS-
- X Kermit>", then telling your local Kermit to send the zoo archive as
- X a binary file. A typical sequence of commands is:
- X
- X (type escape sequence to get back to local mode)
- X MS-Kermit> set eof noctrl-z
- X MS-Kermit> send stuff.zoo
- X
- X It is important that your local Kermit send the zoo archive as a
- X binary file, not a text file. How you do this depends on your sys-
- X tem; on MS-DOS systems it suffices to give say "set eof noctrl-z".
- X
- X 3. Wait until the Kermit upload is complete. Then tell your local
- X Kermit to go into terminal mode (usually by giving the command CON-
- X NECT), and exit from VAX/VMS Kermit with the command EXIT. A typi-
- X cal sequence is:
- X
- X MS-Kermit> connect
- X (stuff from MS-Kermit printed...)
- X (hit carriage return if necessary to get the next prompt)
- X Kermit-32> exit
- X $
- X
- X Now you are back at the VAX/VMS prompt. At this point, you must
- X convert the uploaded zoo archive, which is currently in binary for-
- X mat, to stream-LF format so that it can be used by VAX/VMS zoo.
- X You do this by using the Bilf utility, which can convert files
- X between binary and stream-LF formats. Give the command:
- X
- X $ bilf l stuff.zoo
- X
- X 4. After Bilf has done the conversion, you will have a new generation
- X of stuff.zoo that is in stream-LF format. Now you can manipulate
- X it normally with VAX/VMS zoo.
- X
- DON'T TRY TO USE ZOO TO MANIPULATE AN UPLOADED ARCHIVE WITHOUT PERFORM-
- ING THE CONVERSION TO STREAM-LF FORMAT, ELSE YOU MAY PERMANENTLY DESTROY
- ARCHIVE CONTENTS.
- X
- KERMIT DOWNLOADS: Before downloading a zoo archive from VAX/VMS to a
- microcomputer, you must convert it to binary format. Then use VMS
- Kermit normally. A sample sequence is shown.
- X
- X 1. Convert the zoo archive to binary format.
- X
- X $ bilf b stuff.zoo
- X
- X 2. Invoke VMS Kermit and tell it to send the file.
- X
- X $ kermit
- X Kermit-32> set block-check 3
- X Kermit-32> send stuff.zoo
- X
- X 3. Get back to your local Kermit and tell it to receive a binary file.
- X
- X (type escape sequence to get into local mode)
- X MS-Kermit> set eof noctrl-z
- X MS-Kermit> receive
- X (transfer takes place)
- X
- X
- X FILE TRANSFER SUMMARY
- X
- Here are pictorial summaries of the steps involved in performing file
- transfers of zoo archives using Kermit.
- X
- ======================================================================
- X
- DOWNLOADS:
- X files on a VMS
- X system to be archived
- X using zoo
- X |
- X archive created |
- X using zoo.exe |
- X or zoobig.exe |
- X on a VMS system |
- X v
- X
- zoo archive on VMS bilf b zoo archive on VMS, in
- in fixed-length <---------------- in stream-LF format
- binary format
- X |
- X |
- X | archive transferred
- X | from VMS to microcomputer
- X | using Kermit; receiving
- X | Kermit must be told this
- X | is a binary file; sending
- X | Kermit may need to be told too
- X |
- X v
- zoo archive
- on microcomputer
- system
- X
- ======================================================================
- X
- UPLOADS:
- X
- zoo archive
- on microcomputer
- system
- X |
- X |
- X | archive uploaded to VMS using Kermit;
- X | receiving Kermit on VMS must be given
- X | command "set file type binary"
- X | (NOTE: "set file type fixed" will
- X | usually not work); sending Kermit
- X | must be told this is a binary file
- X |
- X v
- zoo archive on VMS, bilf l zoo archive on VMS, in
- in variable-length ----------------> in stream-LF format
- binary format |
- X | extract
- X | normally using
- X | zoo on VMS
- X |
- X v
- X files extracted from zoo
- X archive on a VMS system
- X
- ======================================================================
- X
- X
- X ENSURING ARCHIVE INTEGRITY
- X
- After performing a transfer of a zoo archive using Kermit (and perform-
- ing any file conversion necessary for VMS), make it a habit to immedi-
- ately test the integrity of the transferred archive with the -test com-
- mand of zoo, illustrated for VMS:
- X
- X $ zoo -test stuff
- X
- In addition, also get a listing of the archive contents:
- X
- X $ zoo -list stuff
- X
- If neither command reports an error, it is reasonable to assume that
- archive integrity was not harmed by the Kermit transfer.
- X
- The -test command tests the integrity of each stored file. The -list
- command tests the integrity of the internal archive structure. Both are
- checked using separate cyclic redundancy codes, one for each archived
- file, and one for each directory entry in the archived. (Actually, the
- -list command ignores deleted entries, so if the archive contains any,
- use the "ld" command instead.)
- X
- X
- X WILDCARDS
- X
- All implementations of zoo on all systems use the same wildcard charac-
- ters: "*" matches any sequence of zero or more characters, and "?"
- matches any one character.
- X
- ADDING FILES: For specifying directory names when adding files, use the
- usual VAX/VMS syntax. Thus, to recursively archive all files in the
- current directory and all its subdirectories, the command syntax is:
- X
- X $ zoo a stuff [...]*
- X
- X The character range wildcard of the form "c-c" is also available, which
- X will select all files beginning with the specified character range.
- X For example,
- X
- X $ zoo a stuff [...]a-d [...]x-z
- X
- X will archive all files beginning with the characters a through d, and
- X with the characters x through z, in the current directory and all its
- X subdirectories. A side-effect of this is that during addition to
- X archives, dots in filenames must be explicitly matched. Thus to add
- X all files with an extension of DOC, you would type:
- X
- X $ zoo a stuff *.doc
- X
- X and "*doc" will not work. As a special case, a trailing "*.*" in any
- X filename you specify can always be replaced by just a trailing "*".
- X The safest rule to follow when adding files is to always specify the
- X dot in each filename.
- X
- X EXTRACTING FILES: During extraction, both the directory name and the
- X filename must be specified according to zoo syntax. Thus you could say
- X
- X $ zoo x stuff [*xyz*]*.doc
- X
- X to extract all archived files with filenames that match "*.doc" and
- X that contain the string "xyz" in the directory name. Note that VMS
- X syntax for selecting directories won't work here:
- X
- X $ zoo x stuff [...]*.doc ! won't work for extraction
- X
- X If you do not specify the directory name at all, zoo will only perform
- X the match against filenames; thus
- X
- X $ zoo x stuff *.doc
- X
- X will extract all files matching *.doc regardless of the directory name.
- X
- X Also note that if you specify extraction of "*.*", as in
- X
- X $ zoo x stuff *.*
- X
- X it will result in the extraction of files whose filename contains at
- X least one dot. Similarly, the command
- X
- X $ zoo x stuff *_*
- X
- X will select all filename containing at least one underscore.
- X
- X To extract all files, specify no filename, e.g.
- X
- X $ zoo x stuff
- X
- X or use "*" rather than "*.*".
- X
- X SAFEST RULE OF THUMB: WHEN SELECTING FILES ON DISK, SPECIFY THE DOT IN
- X EACH FILENAME; WHEN SELECTING FILES INSIDE A ZOO ARCHIVE, SPECIFY A
- X DOT ONLY IF YOU NEED ONE. But to select all files, you can always just
- X use "*".
- X
- X
- X FILE GENERATIONS
- X
- X When a file is added to an archive, the generation number (if any) that
- X it is given in the archive is not related to the generation number it
- X had in the VAX/VMS filesystem. At extraction time a new version is
- X always created for an extracted file. The overwrite option ("O") does
- X not cause overwriting, but simply suppresses the warning message that
- X zoo normally gives when it finds that a file about to be extracted
- X already exists.
- X
- X
- X FILE STRUCTURES
- X
- X At extraction time, zoo preserves all data bytes in binary files, and
- X stores all text files as lines of text terminated with linefeeds. The
- X internal file structure maintained by DEC's RMS is not currently
- X preserved. (Support for this is planned for the distant future.)
- X Thus, the following two types of files can be safely archived and
- X restored:
- X
- X - All text files are extracted in stream-LF format. Most VMS utili-
- X ties that accept text files will accept such files. The EDT edi-
- X tor may complain, but will still work.
- X
- X - VMS executable files, when stored and then extracted, are
- X extracted in stream-LF format. Such files can be restored to
- X their original state using Bilf with the "b" option. (However,
- X current versions of VAX/VMS seem to be able to load and execute
- X stream-LF files, so conversion may not be necessary.)
- X
- X HANDLING VMS EXECUTABLE FILES. You can archive an executable program
- X called "xyz.exe":
- X
- X $ zoo a stuff xyz.exe
- X $ delete xyz.exe;*
- X
- X Now the only copy of xyz.exe is in the archive "stuff.zoo". Extract
- X it:
- X
- X $ zoo x stuff xyz.exe
- X
- X The extracted copy of "xyz.exe" is in stream-LF format and VMS may or
- X may not execute it. Now we convert it back to fixed-length record for-
- X mat thus:
- X
- X $ bilf b xyz.exe
- X $ purge xyz.exe
- X
- X Now "xyz.exe" has been converted to binary format and can be executed.
- X It should be identical to the original copy of "xyz.exe" that was
- X archived.
- X
- X TEXT FILES FROM OTHER SYSTEMS. A text file archived on a different
- X computer system will use either linefeeds, or carriage returns plus
- X linefeeds, as line terminators. Text files with linfeeds only can be
- X be extracted and used exactly as if they had been archived on a VAX/VMS
- X system. Text files containing carriage returns plus linefeeds will,
- X when extracted, contain a spurious carriage return at the end of each
- X line. This extra carriage return can be removed using EDT's "substi-
- X tute" command while in screen mode. Simply replace all carriage returns
- X with nothing. The VMS C compiler currently appears to accept trailing
- X carriage returns in files without any trouble.
- X
- X Text files trasnferred from MS-DOS or CP/M or similar systems may con-
- X tain a trailing control Z character. This may cause problems on VMS
- X and should be edited out with a text editor.
- X
- X -- Rahul Dhesi 1988/02/04
- X Revised 1991/07/07
- SHAR_EOF
- chmod 0644 vmsbugs.doc ||
- echo 'restore of vmsbugs.doc failed'
- Wc_c="`wc -c < 'vmsbugs.doc'`"
- test 18584 -eq "$Wc_c" ||
- echo 'vmsbugs.doc: original size 18584, current size' "$Wc_c"
- fi
- # ============= vmsbuild.com ==============
- if test -f 'vmsbuild.com' -a X"$1" != X"-c"; then
- echo 'x - skipping vmsbuild.com (File already exists)'
- else
- echo 'x - extracting vmsbuild.com (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'vmsbuild.com' &&
- $! VMSBUILD.COM for ZOO 2.10
- $!
- $! Adapted from similar script for zoo 2.01 that was contributed by
- $! Steve Roseman
- $! Lehigh University Computing Center
- $! LUSGR@VAX1.CC.Lehigh.EDU
- $!
- $ write sys$output "Compiling zoo..."
- $ write sys$output "$ cc addbfcrc.c"
- $ cc/nolist addbfcrc.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc addfname.c"
- $ cc/nolist addfname.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc basename.c"
- $ cc/nolist basename.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc comment.c"
- $ cc/nolist comment.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc crcdefs.c"
- $ cc/nolist crcdefs.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc decode.c"
- $ cc/nolist decode.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc encode.c"
- $ cc/nolist encode.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc getfile.c"
- $ cc/nolist getfile.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc huf.c"
- $ cc/nolist huf.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc io.c"
- $ cc/nolist io.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc lzc.c"
- $ cc/nolist lzc.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc lzd.c"
- $ cc/nolist lzd.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc lzh.c"
- $ cc/nolist lzh.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc machine.c"
- $ cc/nolist machine.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc makelist.c"
- $ cc/nolist makelist.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc maketbl.c"
- $ cc/nolist maketbl.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc maketree.c"
- $ cc/nolist maketree.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc misc.c"
- $ cc/nolist misc.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc misc2.c"
- $ cc/nolist misc2.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc needed.c"
- $ cc/nolist needed.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc nextfile.c"
- $ cc/nolist nextfile.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc options.c"
- $ cc/nolist options.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc parse.c"
- $ cc/nolist parse.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc portable.c"
- $ cc/nolist portable.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc prterror.c"
- $ cc/nolist prterror.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc version.c"
- $ cc/nolist version.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc vmstime.c"
- $ cc/nolist vmstime.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zoo.c"
- $ cc/nolist zoo.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zooadd.c"
- $ cc/nolist zooadd.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zooadd2.c"
- $ cc/nolist zooadd2.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zoodel.c"
- $ cc/nolist zoodel.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zooext.c"
- $ cc/nolist zooext.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zoolist.c"
- $ cc/nolist zoolist.c/define=(BIG_MEM,NDEBUG,VMS)
- $ write sys$output "$ cc zoopack.c"
- $ cc/nolist zoopack.c/define=(BIG_MEM,NDEBUG,VMS)
- $
- $
- $ write sys$output "Linking zoo..."
- $ link /executable=zoo.exe -
- X addbfcrc.obj, addfname.obj, basename.obj, comment.obj, -
- X crcdefs.obj, decode.obj, encode.obj, getfile.obj, huf.obj, -
- X io.obj, lzc.obj, lzd.obj, lzh.obj, machine.obj, makelist.obj, -
- X maketbl.obj, maketree.obj, misc.obj, misc2.obj, needed.obj, -
- X nextfile.obj, options.obj, parse.obj, portable.obj, prterror.obj, -
- X version.obj, vmstime.obj, zoo.obj, zooadd.obj, zooadd2.obj, -
- X zoodel.obj, zooext.obj, zoolist.obj, zoopack.obj, -
- X options/opt
- $
- $ write sys$output "Building fiz..."
- $ cc/nolist fiz.c
- $ link /executable=fiz.exe fiz.obj, addbfcrc.obj, portable.obj, -
- X crcdefs.obj, options/opt
- $ write sys$output "Building bilf..."
- $ cc/nolist bilf.c
- $ link /executable=bilf.exe bilf.obj, options/opt
- $
- $! delete *.obj.*
- SHAR_EOF
- chmod 0644 vmsbuild.com ||
- echo 'restore of vmsbuild.com failed'
- Wc_c="`wc -c < 'vmsbuild.com'`"
- test 3909 -eq "$Wc_c" ||
- echo 'vmsbuild.com: original size 3909, current size' "$Wc_c"
- fi
- # ============= vmstime.c ==============
- if test -f 'vmstime.c' -a X"$1" != X"-c"; then
- echo 'x - skipping vmstime.c (File already exists)'
- else
- echo 'x - extracting vmstime.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'vmstime.c' &&
- /* vmstime.c */
- #ifndef LINT
- static char sccsid[]="$Source: /usr/home/dhesi/zoo/RCS/vmstime.c,v $\n\
- $Id: vmstime.c,v 1.6 91/07/06 12:20:26 dhesi Exp $";
- #endif
- /*
- This file was graciously supplied by Randal Barnes to support preservation
- of file timestamps under VAX/VMS. I claim no copyright on the contents of
- this file. I assume that neither do its authors. However, if you adapt
- this code for your own use, I recommend preserving author attributions.
- X
- X -- Rahul Dhesi 1991/07/04
- */
- X
- /*
- * This module sets a VAX/VMS file's creation and revision date/time to a
- * specified date/time.
- *
- * Inputs Type Description
- * ------ ---- -----------
- * path char * Name of file to be modified
- * date int Binary formatted date to be applied to the file
- * time int Binary formatted time to be applied to the file
- *
- * Outputs Type Description
- * ------- ---- -----------
- * Modified file
- *
- * Randy Magnuson - (612) 542-5052
- * Randal Barnes - (612) 542-5021
- * Honeywell Inc. - Military Avionics Division
- * April 12, 1990
- */
- X
- #include <stdio.h>
- #include <rms.h>
- #include <fibdef.h>
- #include <atrdef.h>
- #include <descrip.h>
- #include <iodef.h>
- #include <libdtdef.h>
- X
- int setutime (char *path, unsigned int date, unsigned int time)
- {
- X char EName [NAM$C_MAXRSS], /* Expanded String Area */
- X RName [NAM$C_MAXRSS], /* Resultant String Area */
- X date_str [50]; /* Holds intermediate ASCII date/time */
- X
- X short iosb [4]; /* I/O status block for sys calls */
- X
- X int status, /* Condition code for sys calls, etc. */
- X i, /* Temp index for looping thru arrays */
- X chan, /* Channel to device containing file */
- X Cdate [2], /* VMS binary time - creation date */
- X Rdate [2], /* VMS binary time - revision date */
- X datetimecontext = 0, /* Context for time conv. lib calls */
- X intime = LIB$K_INPUT_FORMAT, /* Constant for time lib calls */
- X intdate [2]; /* VMS binary time - temp */
- X
- X struct FAB Fab; /* RMS File Access Block */
- X struct NAM Nam; /* RMS Name Block */
- X static struct fibdef Fib; /* RMS File Information Block */
- X struct atrdef Atr [] = /* File attribute struct */
- X {
- X { sizeof (Cdate), ATR$C_CREDATE, &Cdate [0] }, /* Creation date */
- X { sizeof (Rdate), ATR$C_REVDATE, &Rdate [0] }, /* Revision date */
- X { 0, 0, 0 }
- X };
- X struct dsc$descriptor devnam = /* Device name descriptor */
- X { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &Nam.nam$t_dvi [1] };
- X struct dsc$descriptor FibDesc = /* File ID descriptor */
- X { sizeof (Fib), 0, 0, &Fib };
- X struct dsc$descriptor_s FileName = /* File name descriptor */
- X { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };
- X
- X /* Time conversion format specification */
- X $DESCRIPTOR (datetimeformat, "|!Y4!MN0!D0|!H04!M0!S0!C2|");
- X
- X /* String descriptor for intermediate date/time string */
- X $DESCRIPTOR (date_desc, date_str);
- X
- X
- /*
- * Fill out our File Access Block, Name Block, and Extended Attribute Block so
- * we can parse the file name.
- */
- X Fab = cc$rms_fab;
- X Nam = cc$rms_nam;
- X
- X Fab.fab$l_fna = path;
- X Fab.fab$b_fns = strlen (path);
- X Fab.fab$l_nam = &Nam;
- X
- X Nam.nam$l_esa = &EName;
- X Nam.nam$b_ess = sizeof (EName);
- X Nam.nam$l_rsa = &RName;
- X Nam.nam$b_rss = sizeof (RName);
- X
- X
- /*
- * Do a parse and search to fill out the NAM block.
- */
- X status = sys$parse(&Fab);
- X if (!(status & 1))
- X return 0;
- X status = sys$search(&Fab);
- X if (!(status & 1))
- X return 0;
- X
- X
- /*
- * Open a channel to the device that the file resides on.
- */
- X devnam.dsc$w_length = Nam.nam$t_dvi [0];
- X status = SYS$ASSIGN (&devnam, &chan, 0, 0);
- X if (!(status & 1))
- X return 0;
- X
- X
- /*
- * Initialize the FIB
- */
- X Fib.fib$r_acctl_overlay.fib$l_acctl = FIB$M_NORECORD;
- X for (i = 0; i < 3; i++)
- X {
- X Fib.fib$r_fid_overlay.fib$w_fid [i] = Nam.nam$w_fid [i];
- X Fib.fib$r_did_overlay.fib$w_did [i] = Nam.nam$w_did [i];
- X }
- X
- X
- /*
- * Set up the file name descriptor for the QIO
- */
- X FileName.dsc$a_pointer = Nam.nam$l_name;
- X FileName.dsc$w_length = Nam.nam$b_name + Nam.nam$b_type + Nam.nam$b_ver;
- X
- X
- /*
- * Use the IO$_ACCESS function to return info about the file.
- */
- X status = SYS$QIOW (0, chan, IO$_ACCESS, &iosb, 0, 0,
- X &FibDesc, &FileName, 0, 0, 0, 0);
- X if (!(status & 1))
- X return 0;
- X status = iosb [0];
- X if (!(status & 1))
- X return 0;
- X
- X
- /*
- * Set up a date/time format that we can easily convert to - "YYMMDD HHMMSS"
- */
- X status = LIB$INIT_DATE_TIME_CONTEXT (&datetimecontext, &intime,
- X &datetimeformat);
- X if (!(status & 1))
- X return 0;
- X
- X
- /*
- * Convert the MS-DOS time ints to our ASCII format.
- */
- X date_desc.dsc$w_length = sprintf (date_str, "%04d%02d%02d %02d%02d%02d00",
- X ((date >> 9) & 0x7f) + 1980, /* year */
- X (date >> 5) & 0x0f, /* month */
- X date & 0x1f, /* day */
- X (time >> 11)& 0x1f, /* hour */
- X (time >> 5) & 0x3f, /* min */
- X (time & 0x1f) * 2); /* sec */
- X
- X
- /*
- * Convert our ASCII formatted date/time to VMS internal time format
- */
- X status = LIB$CONVERT_DATE_STRING (&date_desc, &intdate, &datetimecontext);
- X if (!(status & 1))
- X return 0;
- X
- X
- /*
- * Fill in the creation date and revision date fields in the Extended Attribute
- * Block with the date and time from the zoo file.
- */
- X Cdate [0] = Rdate [0] = intdate [0];
- X Cdate [1] = Rdate [1] = intdate [1];
- X
- /*
- * Modify the file
- */
- X status = SYS$QIOW (0, chan, IO$_MODIFY, &iosb, 0, 0,
- X &FibDesc, &FileName, 0, 0, &Atr, 0);
- X if (!(status & 1))
- X return 0;
- X status = iosb [0];
- X if (!(status & 1))
- X return 0;
- X
- X
- /*
- * Okee dokee.
- */
- X return 1;
- }
- SHAR_EOF
- chmod 0644 vmstime.c ||
- echo 'restore of vmstime.c failed'
- Wc_c="`wc -c < 'vmstime.c'`"
- test 6408 -eq "$Wc_c" ||
- echo 'vmstime.c: original size 6408, current size' "$Wc_c"
- fi
- true || echo 'restore of zoo.1 failed'
- echo End of part 9, continue with part 10
- exit 0
-