[Coco] quick basic09 copy program
L. Curtis Boyle
curtisboyle at sasktel.net
Wed Jan 30 10:05:58 EST 2008
I would definitely recommend in the startup file pre-loading the copy
command if you are going to do it this way...
How big are the files you are copying? You may be able to do OPEN/CREATE's
with the GetStat/SetStat calls for I$Read/I$Write to do it a lot faster
than forking a shell which then forks copy for every file...
On Wed, 30 Jan 2008 05:53:50 -0600, Willard Goosey <goosey at virgo.sdc.org>
> Quicky program to copy all files from the current data directory to
> /dd/foo. Hack on it as you wish.
> I'd like to say I just threw this together, but BASIC-09 is subtle and
> quick to anger. ;-) Actually, this did teach me a couple of things
> about BASIC09.
> But it's still pretty much quick and dirty. Not very efficient, as it
> forks a shell for every file it copies.
> PROCEDURE wcopy
> (* copy all files from cwd to another dir
> DIM cwd:BYTE
> DIM origin,fc:STRING
> DIM dest:STRING
> OPEN #cwd,".":READ+DIR
> WHILE NOT(EOF(#cwd)) DO
> GET #cwd,origin
> RUN entry2name(origin)
> IF fc<>CHR$(0) AND fc<>"." THEN
> dest=" /dd/foo/"+origin
> SHELL "copy "+origin+dest
> CLOSE #cwd
> PROCEDURE entry2name
> PARAM entry:STRING
> (*arguement: a OS-9 directory entry: 32 bytes long, 29 byte max.
> (*3 byte LSN, filename's last character has 8th bit set
> (*output: The filename, with the last character's 8th bit cleared
> (*If you have a dir. entry that doesn't have the 8th bit set on the
> (*last character, OS-9 crashed when you read the directory...
> (*Willard Goosey
> (*goosey at sdc.org
> DIM i,tv:INTEGER
> DIM fname,lc:STRING
> EXITIF tv>127 THEN
More information about the Coco