Article View: comp.sys.amiga.tech
Article #9220Re: ARexx Questions
From: Dave Haynie
Date: Wed, 29 Jun 1988 00:02
Date: Wed, 29 Jun 1988 00:02
69 lines
2997 bytes
2997 bytes
in article <2119@cadovax.UUCP>, kaz@cadovax.UUCP (Kerry Zimmerman) says:
> Keywords: ARexx
> After reading so many glowing words about ARexx here on the net...
> Why would I want to write a script in ARexx instead of using a CLI script
> or a Shell script (using Matt's Shell)?
I don't recall the examples on the ARexx disk offhand. But there are lots
of things you can't do easily, or possibly at all, using the CLI script
language, or probably Matt's shell language (tough I haven't used it
myself). One of the features I like the most about the ARexx language
is that it supports recursive subroutines, like any REAL computer
language.
Consider, for a moment, this problem. I've got gobs of stuff on my
hard disk, all kinds of directories filled with Usenet downloads. I
like to transfer whole directories over to floppy disks. I waste lots
of time if I try to transfer a directory and find out that it won't
fit on the space remaining on a floppy. So I want a function that'll
tell me the size, in blocks, of a directory tree.
Here's an ARexx solution, written in about 10 minutes.
-----Cut Here-----
/* Sizeblk.rexx Shows recursive function. -Dave Haynie */
parse arg dir .
blocks = countblock(dir)
say 'Total of' blocks 'blocks in directory' '9b'x'3m'dir'9b'x'0m'
exit
countblock : procedure
arg dir
blocks = 0
files = showdir(dir,'file')
dirs = showdir(dir,'dir')
call pragma 'Directory',dir
do while files ~= ''
parse var files oner .
files = delword(files,1,1)
blocks = blocks + subword(statef(oner),3,1) + 1
end
do while dirs ~= ''
parse var dirs oner .
dirs = delword(dirs,1,1)
blocks = blocks + countblock(oner) + 1
end
call pragma 'Directory','/'
return blocks
-----Cut Here-----
> No advantage is gained using ARexx over the CLI or Shell to communicate
> with DOS that I know of.
I'd be interested in seeing this done with CLI Scripts. You could certainly
write a C program to do this, but it would be longer, and it would probably
take more than 10 minutes to write. I guess it would be faster, too, but
this is just an example.
> Kerry Zimmerman
> # {ucbvax,decvax}!trwrb!cadovax!kaz Contel Business Systems 213-323-8170
> A difference between an amateur and a professional,
> is that a professional has the right tools.
--
Dave Haynie "The 32 Bit Guy" Commodore-Amiga "The Crew That Never Rests"
{ihnp4|uunet|rutgers}!cbmvax!daveh PLINK: D-DAVE H BIX: hazy
"I can't relax, 'cause I'm a Boinger!"
Technical Details
Message-ID:
<4131@cbmvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!mhuxo!mhuxt!mhuxi!mhuxh!mhuxu!att!ihnp4!cbmvax!davehReferences:
<2119@cadovax.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!mhuxo!mhuxt!mhuxi!mhuxh!mhuxu!att!ihnp4!cbmvax!daveh From: daveh@cbmvax.UUCP (Dave Haynie) Newsgroups: comp.sys.amiga.tech Subject: Re: ARexx Questions Message-ID: <4131@cbmvax.UUCP> Date: 29 Jun 88 00:02:16 GMT References: <2119@cadovax.UUCP> Organization: Commodore Technology, West Chester, PA Lines: 69