home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
source
/
cp.lha
/
cp.doc
< prev
next >
Wrap
Text File
|
1988-03-03
|
4KB
|
89 lines
Here is a replacement for AmigaDog "copy" program that I have
been working on for quite a while. It implements the AmigaDos
pattern matching algorithm, the "all" command, and has the
added bonus that it retains the date of copied file.
It's my first posting to the net, and I have my fingers crossed
that all goes well...
Contents:
cp.doc - documentation
cp.c - the main program
PatMatch.c - supporting routines to implement the pattern matching.
setDate.c - gets and sets the file date.
wb_parse.c - Aztec allows you to skip the workbench parms parse.
makefile - to compile and link the whole thing.
cp.uue - uuencoded cp
============
cat <cp.doc>
============
Cp - a replacement for AmigaDos Copy that retains the date.
by Jeff Lydiatt
Vancouver, Canada
Release 1.0, May 17, 1987
Cp and the c source is freely redistributable for personal
non-commercial use. Commercial rights are reserved by the
author. Feel free to make any modifications or use any
of the modules in other programs. I encourage you to do so
and hope you will release the code so others can learn by it.
Cp has most of the features of the AmigaDos copy command:
--------------------------------------------------------
o Cp supports the AmigaDos style pattern matching in the "from" name.
o Cp supports the All option.
o Cp supports the optional "from" and "to" qualifiers for file names.
o Cp will copy directories
Cp has a number of features not found in AmigaDos copy:
-------------------------------------------------------
o Cp will retain the date of the copied file.
o Cp uses a 32000 byte buffer, which speeds copies when the from and
to file is on the same disk.
o You may specify the current directory by a "to" name of ".". For
example if your current directory is "Df0:",
"cp ram:x ."
will copy the file called x in your ram: disk to "df0:x".
o Cp will also create the "to" file for you if you use the "All"
option. For example if "x" is a directory,
"cp from x to y"
will create a directory called "y", and will copy all the files in
x to the newly created "y" directory.
About the AmigaDos-style pattern matching.
-----------------------------------------
Cp uses a compact function for regular expression pattern matching.
The algorithm was taken from a paper by Martin Richards, that was
published in the September 1979 issue of "Software, Practice and
Experience". Professor Richards published his example in BCPL, and
I have (sucessfully I think) translated it to C. It's interesting to
note that I translated it verbatim, with no special modifications to
adapt it to AmigaDos conventions.
Cp recognises a number of special characters with special meanings,
which can be used to recognise any other charcaters that match them.
? Matches any single character.
% Matches the null character.
#<p> Matches zero or more occurrences of the pattern <p>
<p1>|<p2> Matches either pattern <p1> or <p2>.
() Can be used to group expressions together.
'# Can be used to turn off the special meaning of the special
characters #, ?, %, |, (, ), or '.
Some examples will help to make this clearer.
cp a|b . copies a or b to the current directory.
cp a#bc . copies ac abc abbc.
cp a#(b|c)d . copies ad abd abcd.
cp a?b . copies axb ayb aab.
cp a#?b copies ab axxb ax.ab.
cp '?#?'# . copies ?# ?ab# ??##.
cp a(b|%)#c . copies a abc accc.