[comp.sys.amiga.tech] Arexx help

new@udel.EDU (Darren New) (08/25/89)

I would think this should be simple, but maybe I'm missing something.
I want to be able to say

1> cd sys:xyz/pdq
1> rx hello
SYS:xyz/pdq
1>

Where hello.rexx contains something along the lines of:
/* hello.rexx */
address command
'cd'

However, it seems as though SYS: is the current dir for all the
commands I start from ARexx.  What am I doing wrong?
Thanks in advance.     -- Darren

mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) (08/25/89)

In article <22442@louie.udel.EDU> new@udel.EDU (Darren New) writes:
<I would think this should be simple, but maybe I'm missing something.
<I want to be able to say
<
<1> cd sys:xyz/pdq
<1> rx hello
<SYS:xyz/pdq
<1>
<
<Where hello.rexx contains something along the lines of:
</* hello.rexx */
<address command
<'cd'
<
<However, it seems as though SYS: is the current dir for all the
<commands I start from ARexx.  What am I doing wrong?
<Thanks in advance.     -- Darren

Similar questions come up regularly on AREXX-L (The bitnet ARexx
discussion list), so I suspect the following may be of interest to the
net at large.

First off, I'm not quite sure what the question is. If I create a
"hello.rexx" that does basically what you do, it works like you want
it to - hello does the same things as a bare cd command, in any of
WShell, AmigaShell and the CLI. If you're using something else, that
could be the problem.

The first thing to note is that there are two "current directories"
associated with a running ARexx script (usually, anyway). One is the
current directory of the client program that invoked the script. The
other is the current directory of the script itself - which is
inherited from the client program if that has one, or from the rexx
server if the client doesn't have one. I'm going to ignore the latter
case.

Even though they start the same, they can be changed independently. To
change the current directory of the ARexx script, you use the
directory pragma, like so:

say pragma('Directory')		/* Reports current directory */
say pragma('Directory', 'sys:')	/* Reports current, then changes to sys: */
call pragma('D', 'c:')		/* Change to c: */
say pragma('d', 's:')		/* report current, change to s: */

How you change the clients current directory will depend on the
client. You issue the command to it that you would issue interactively
to change the directory. For instance:

WShell:		'cd sys:'		/* Change to sys: */
		'cd' directory		/* Change to name in directory */

Unfortunately, the only other client I have that lets you change
directories is mg3a, which uses the exact same syntax. Oh well, you
should get the idea.

Finally, if you're running ARexx via rx and sending commands to the
command address, you don't have a real client. What you have is the
ability to do an Execute. These commands get their current working
directoryt from the ARexx script. As stated above, the directory
pragma lets you change that to start those commands in an arbitrary
directory.

	<mike

Version notes: I'm using 1.10. Since it's much faster, and the upgrade
is $5, I recommend it to _everybody_. Some of the above has changed in
the past, but shouldn't be noticably in most scripts.
--
He was your reason for living				Mike Meyer
So you once said					mwm@berkeley.edu
Now your reason for living				ucbvax!mwm
Has left you half dead					mwm@ucbjade.BITNET

stevem@hal.CSS.GOV (Steve Masters) (08/25/89)

new@udel.EDU (Darren New) writes:

>I would think this should be simple, but maybe I'm missing something.
>I want to be able to say

>1> cd sys:xyz/pdq
>1> rx hello
>SYS:xyz/pdq

>Where hello.rexx contains something along the lines of:
>/* hello.rexx */
>address command
>'cd'

>However, it seems as though SYS: is the current dir for all the
>commands I start from ARexx.  What am I doing wrong?

According to Bill Hawes, the problem lies with the system Execute() function
and the way it inherits its current directory.  You are correct that
the 'cd' has no effect in subsequent commands when called from ARexx.  
There is a work-around, however, suggested by Mr. Hawes.  If you
concatenate the 'cd' and the command you want with a 'newline' character,
the 'cd' will apply:

 address command 'cd new.directory'||'0a'x||'new.command'

 'New.command' will inherit the 'new.directory.'  Note, however, that the
 current directory is reset when the command terminates.  This problem
 has been at least partially fixed in the latest ARexx update, but I have
 not read the new docs closely enough to see what new coding is required.
 Perhaps others can post the newer, better solution.

 I am told that Bill Hawes' WShell also fixes this problem, but I do not
 own it so I am not sure.

Steve Masters
ENSCO, Inc.
Melbourne, FL
stevem@hal.CSS.GOV

will@waf2000.UUCP (Will Fiveash) (09/04/90)

This is a previous post that has been modified.
I have been trying to integrate RCS commands with ARexx and CED.
Unfortunately, I seem unable to launch an Arexx script from CED that
executes the RCS command ci without crashing my system.  The following
is a bit of the Arexx script.

cr = '0A'X
conwindow = "newcon:0/0/640/100/CI"
cmd = 'cd '||path||cr||'rcs:ci -l '||sourcefile||cr||'endcli'||cr
open(cmdfile,"tmp:ci.sh",write)
writech(cmdfile,cmd)  /* create checkin script */
close(cmdfile)
address command 'devkit:c/WBTF' /* move workbench screen to front */
options failat 999
address command 
'newshell' conwindow "tmp:ci.sh" /* this is where is crashes */
/* end example */

I get the ci prompt in the new window but after I finish the log 
message, the software error alert greets me.
If I execute the 'newshell conwindow tmp:ci.sh' from a CLI it works just
fine.  This is driving me crazy.  Does this have anything to do with
the task vs process environment?  I am using Arexx 1.10 and the latest
CED release.


--
	Will Fiveash
UUCP:home  ...!cs.utexas.edu!ut-emx!waf2000!will

rsbx@cbmvax.commodore.com (Raymond S. Brand) (09/12/90)

In article <03468.AA03468@waf2000.UUCP>, will@waf2000.UUCP (Will Fiveash) writes:
> This is a previous post that has been modified.
> I have been trying to integrate RCS commands with ARexx and CED.
> Unfortunately, I seem unable to launch an Arexx script from CED that
> executes the RCS command ci without crashing my system.  The following
> is a bit of the Arexx script.
> 
> cr = '0A'X
> conwindow = "newcon:0/0/640/100/CI"
> cmd = 'cd '||path||cr||'rcs:ci -l '||sourcefile||cr||'endcli'||cr
> open(cmdfile,"tmp:ci.sh",write)
> writech(cmdfile,cmd)  /* create checkin script */
> close(cmdfile)
> address command 'devkit:c/WBTF' /* move workbench screen to front */
> options failat 999
> address command 
> 'newshell' conwindow "tmp:ci.sh" /* this is where is crashes */
> /* end example */
> 
> I get the ci prompt in the new window but after I finish the log 
> message, the software error alert greets me.
> If I execute the 'newshell conwindow tmp:ci.sh' from a CLI it works just
> fine.  This is driving me crazy.  Does this have anything to do with
> the task vs process environment?  I am using Arexx 1.10 and the latest
> CED release.

RCS needs lots of stack to run; try adding a 'stack 20000' to your script

> 	Will Fiveash

						rsbx

------------------------------------------------------------------------
  Raymond S. Brand			rsbx@cbmvax.commodore.com
  Commodore-Amiga Engineering		...!uunet!cbmvax!rsbx
  1200 Wilson Drive			(215)-431-9100
  West Chester PA 19380			"Looking"
------------------------------------------------------------------------