Mail Archives: djgpp/1993/05/08/21:57:41
After doing a lot of work on my names2dos script, I've found that I've
re-invented that round thingy...the wheel. Computerwise Consulting
Services (CCS) runs a shareware-distribution-via-email service that
includes, among other things, a version of tar that does recursive file
and directory name mapping from Unix to Dos names. This product does
not change the contents of any file, but it writes a verbose log that
is very similiar to that of names2dos. It would be very easy to use
chunks of names2dos to transform the CCS tar log file into sed
instructions to change the contents of files. At this point I am
suspending all further work on names2dos.
Enclosed is an edited excerpt from the doc file enclosed with CCS tar.
======================================================================
-----------------------------------------------------------------------------
COPYRIGHT (C) 1993 COMPUTERWISE CONSULTING SERVICES. ALL RIGHTS RESERVED.
-----------------------------------------------------------------------------
COMPUTERWISE CONSULTING SERVICES | Voice Mail: (703) 450-7175
P.O. Box 813, McLean, VA 22101 USA | Internet email: bob AT grebyn DOT com
-----------------------------------------------------------------------------
Please send bug reports to the mail or email address shown above. Thanks!
-----------------------------------------------------------------------------
---------------------------------
The CCS Automated Mail Server
------------------------------------------------------------------------------
The latest products from the CCS labs are available via our automated Mail
Server. Send email to Internet address "joan AT grebyn DOT com" (from CompuServe
send it to ">INTERNET:joan AT grebyn DOT com"). Set the Subject line to exactly
"Mail Server, Please". In the message body use 1 or more of these commands:
PATH path [Optional] To specify your return email address
CATALOG (or HELP) To have us email the latest catalog to you
SEND name [name...] Ask for email delivery of product "name"
Sample email request: TO: JOAN AT GREBYN DOT COM
SUBJECT: MAIL SERVER, PLEASE
CATALOG
SEND CHATTERBOX INVOICE
This request gets you: / Our catalog of available software
/ Our network conferencing product CHATTERBOX
/ A blank invoice for registering our products
------------------------------------------------------------------------------
Product : Joan Riff's 'tar' for the PC
Version : Apr 13 1993
Licensing fee: $10
This program maintains Unix-compatible tape archive (tar) files.
Use: tar [-c | -x | -t] [-flags] tarfile patterns...
where *ONE* of the following must be used to specify the action to
be performed:
-c Create a new archive, consisting of all DOS files and/or
directories which match all patterns.
-x Extract files from a tar archive. If patterns are specified,
then archived files and/or directories which match those
patterns are extracted.
-t List contents of an archive. THIS IS THE DEFAULT FUNCTION,
AND WILL BE PERFORMED IF NO OTHER HAS BEEN SPECIFIED. If
patterns are specified, then archived files and/or directories
which match those patterns are listed.
and the [optional] other flags are:
-a Don't automatically generate unique DOS names when extracting from
an archive. Normally, a numbered variant of an archive element's
name is created in order to achieve uniqeness. An attempt is
made to keep the most significant part of the original name.
The use of the "-a" flag suppresses this action, and will speed
up the extraction process at the expense of possibly encountering
name conflicts.
-b During an extraction from an archive, print the derived DOS path
for every file in the archive. These paths go into a table which
associates original archive paths with derived DOS paths. This
table is built to support linked files, so that we can locate the
[perhaps radically renamed] DOS equivalent for a given archive
path. In the absence of the -b flag, this table is printed after
all extractions, not as each is done.
-d Enable debug displays (i.e. - dump headers, show how many
EOF records are being written, etc)
-enn Specify the number of zeroed EOF records to write at the end of
a created tar archive. The default is 1, but you may want to
set this to 20 ("-e20") if the created tar archive is to
be extracted on a Unix system whose 'blocking factor' defaults
to 20.
-gnnn Specify group id as decimal number nnn. This is used only
during a create, and will be stored in the group id field
of all headers in the archive. If you want the final Unix-
extracted files to have a specific group id, then this is the
way to assign it.
-Gxxx Specify group id as group name xxx. See -gnnn for use. This
differs only in that you are specifying an alpha string for
the group name, instead of a decimal group number. Use of this
flag (or the -U flag) automatically causes the tar header
record's 'magic' field to be set to "ustar ", indicating
that the header's uname[] and gname[] fields are valid.
-j Include DOS drive prefix in archive path. Normally, a file
named "c:foo.bar" gets moved into the archive with a path of
"foo.bar". If you use the "-j" flag, however, then the
drive prefix is included as a superior directory, so that it
is entered into the archive as "c/foo.bar".
This action (of removing or translating the drive prefix) occurs
before the "-s" flag (if present) is applied, so keep this in
mind when you formulate your "-s" string. If you use "-j",
then your "-s" string had better start with "c/" if you hope
to catch files from drive C:.
-k Ignore archive header checksum errors (careful!).
-lnn Specify levels deep to descend as decimal nn (default = 99).
The create function will not consider subordinate levels once it
has recursively descended nn-1 levels. If nn = 1, for example,
then only the initial directory is done.
-m When extracting, don't bother replicating the file modification
times found in the archive. Once a file (not a directory) has
been extracted to a DOS file, it's modification time is normally
set to the value that the original Unix file had. This slows the
extraction somewhat, due to the extra DOS directory accesses
involved. The "-m" flag suppresses this processing, so that
you get a faster extraction, but lose the original file times.
-o Overwrite existing DOS files when extracting from an archive.
Due to the extensive renaming which is sometimes necessary to
move a sometimes-exotic Unix filename to DOS, duplicate names
may be generated. Or you may simply be extracting a path which
already exists. Whatever the case, this flag gives you control
over what happens when a conflict occurs. Specifying this flag
(along with "-am") will produce the fastest extraction. If
what you're extracting is a collection of files all of which
are unique in the first 8 characters, then "-amo" makes sense.
-pxxx Specify a string which is to be prepended to paths as they go
into or come out of an archive. If you specify "-pdos/src/"
during an archive create, then a DOS file named "foo.bar" will
be entered into the archive as "dos/src/foo.bar". If you use
"-pc:\src\" on extraction, then an archive filename of "x.c"
will turn into a DOS path of "c:\src\x.c", thus allowing you
to extract into some directory other than your current one. In
this case, the directory "c:\src\" will of course be created
if it does not already exist.
Note that '/' and '\' are interchangeable in string "xxx".
-q Don't process linked files when extracting from an archive. The
idea of linking one file to another makes no sense on DOS, so you
may want to specify this flag as a matter of course.
The default is to process linked files, if for no other reason
than to assure that you wind up with a workable (if often overly
large) directory structure. This is done by copying the original
file to the linked file, so that [as of the instant of extraction,
anyway] both files are identical.
A special table is built (use the -b flag to print it out) which
makes it possible to identify the original file even if it was
renamed and/or auto-generated (see the -a flag) when it was
translated into a DOS path. If this table runs out of memory,
by the way, then an error message is displayed and future links
may be ignored (i.e. a -q flag will be automatically simulated).
NOTE: If a linked file appears in the archive *PRIOR* to the file
to which it is linked, then this whole grand scheme falls
apart because there is no 'original' file to copy to the
linked file. With the proper flags, you may be able to
run tar again to catch these. Or you may have to just do
them manually. Future versions of tar will keep a 'todo'
list of such missed links, and will come back after the
extraction is done and do the appropriate copies...
-sxxx Specify a string which is to be stripped from the front of
paths as they go into or come out of an archive. Let's say
that you are extracting a bunch of files, all of which start
with "dir1/dir2/dir3/" in the archive. Using standard tar,
everything would be extracted three levels below your current
DOS directory (under the newly-created "dir1\dir2\dir3\". This
is a bit much, even by Unix human interface standards. By using
"-sdir1/dir2/dir3/", for example, you can cause the extracted
paths to be placed immediately below your current directory.
If you are creating an archive and use "-ssrc\backup\", then
a DOS file named "src\backup\foo.bar" will be entered into
the archive simply as "foo.bar".
This feature may also allow you to extract paths which would
otherwise be too long for DOS to use, since archive paths may
be 99 chars long, while the DOS limit is 65 or so.
When used with the "-j" and/or "-p" flags, the order of
processing is:
1) The drive name is either stripped or converted,
according to the "-j" flag. (archive creation
only).
2) The "-s" strip is made against the path.
3) The "-p" prefix is then applied to yield the
final archive or DOS path.
Note that '/' and '\' are interchangeable in string "xxx".
-unnn Like -gnnn, but specifies a user id number to be used in the
user id field of the header.
-Uxxx Like -Gxxx, but specifies user name.
-v Enable verbose output, so that instead of the simple path being
displayed you get a full "ls"-like display for each file. See
the VERBOSE DISPLAY sample below.
'tarfile' names the tar archive file to be created or accessed. The special
name "-" may be used to represent stdin or stdout.
'patterns' define file(s) to add to or extract from archive. These patterns
may include '*' and '?' wildcards.
When creating an archive, the patterns are passed to DOS for wildcard
matching, and so are caseless. If no patterns are specified, then an
empty archive is created.
When extracting from or listing an archive, the patterns are matched by
an internal routine, and are case sensitive simply because Unix filenames
are. If no patterns are specified, then all archive elements match.
======================================================================
--
Mark Bergman (Biker, Stagehand, (former) Unix user support grunt)
718-855-9148
bergman AT panix DOT com
{cmcl2,uunet}!panix!bergman
- Raw text -