Re: Using stacks in MC CGI scripts: experience of (1)...

2001-04-16 Thread andu

David Bovill wrote:
> 
> OK not quite clear... (Linux novice -:)

> > You can if they are written to a .mt file.
> 
> Can be any file name as long as the permissions are set to execute and the
> file is on the $PATH right?

If you're not in the directory with the file you have to point to it (%
mc /home/users/www/cgi-bin/script.mt)  "%, $, #" stay for the promt sign
which in my case is # (they are not part of your command). If the
application is not on the $PATH you must  point to it; same for the
script file: 
% /usr/local/bin/mc /home/users/www/script.mt
If you're in the same directory with mc and mc is not on the $PATH you
do:
%./mc script.mt  (or the path to the script).

> 
> > % ./mc script.mt # will execute the script.
> 
> Has this come through the email correct? What do I issue from an MC .mt CGI
> script (or other CGI language? Lets take MC as an example:
> 
>  put shell("% ./mc script.mt") into mcShellResult

So, if mc is on the path you do:
put shell("mc /path/to/the/script.mt")
The preffix of the file can be anything not just .mt.
> 
> > Doing:
> > % ./mc stack.mc #will try to open MC in X and not succeed.
> 
> OK
> 
> Thanks again.

You're welcome.

Andu

Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: Using stacks in MC CGI scripts: experience of (1)...

2001-04-16 Thread David Bovill

OK not quite clear... (Linux novice -:)

> From: andu <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Mon, 16 Apr 2001 15:42:07 -0400
> To: [EMAIL PROTECTED]
> Subject: Re: Using stacks in MC CGI scripts: experience of (1)...
> 
> You can if they are written to a .mt file.

Can be any file name as long as the permissions are set to execute and the
file is on the $PATH right?

> % ./mc script.mt # will execute the script.

Has this come through the email correct? What do I issue from an MC .mt CGI
script (or other CGI language? Lets take MC as an example:

 put shell("% ./mc script.mt") into mcShellResult


> Doing:
> % ./mc stack.mc #will try to open MC in X and not succeed.

OK

Thanks again.


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Re: Using stacks in MC CGI scripts: experience of (1)...

2001-04-16 Thread andu

David Bovill wrote:
> 
> Thanks Andu,
> 
> got it working (with your help). I had made a number of mistakes...
> 
> 1) The function had a mistake:
> 
> function getData
>-- put return & fld 1 into someData
>   put return & fld 1 of stack "database" into someData
>   return someData
> end getData
> 
> Basic mistake, but as the script is being used, it had no idea of which
> stack the field was in - so a stack reference was needed. However you can
> call the functions direct (which is a relief for me 'coz my libraries are
> mainly functions).
> 
> Seem to be able to parameters in the expected way. However I've run into a
> problem which seems to be to do with the home stack... pretty sure it is not
> corrupted or anything as it works locally and I am using the same technique
> to transfer it as the other stacks... - I think it is *that* lovely splash
> screen -:)
> 
> Why would I want to use the home stack

Good question.

> - maybe I don't need to, but when
> exploring shell commands, I decided to see if I could use MC shell commands
> and call them from the CGI...
> 
> Stuff like (calling standard shell scripts on Linux serveer):
> 
>   -- put shell("whereis sh") after buffer
>   -- put return after buffer
> 
>   -- put shell("whereis mc") after buffer
>   -- put return after buffer
> 
>   -- put shell("whereis perl") after buffer
>   -- put return & return after buffer
> 
> Works a treat in the CGI, but when I tried to use MC based scripts...
> 
> First I got back that sh (the shell interpreter) couldn't handle it, so I
> needed to change the shellCommand...
> 
>   -- set the shellcommand to "mc"
> 
> to which I get back...
> 
>   -- ...mcPath: Can't open display
>   -- ...mcPath: Can't load stack or script mchome.mc
> 
> Which brings me on th the fact that with the home stack on the server and a
> couple of database stacks:
> 
>   -- put fld 1 of stack "database" into someData -- works fine
>   -- put fld 1 of stack "home" into someData -- gives a server error
> 
> So the question I am trying to answer is have I made another silly mistake
> or am I running into a brick wall as the home stack will not run on the
> server (display issue?) and consequently I won't be able to use MC based
> shell scripts?

You can if they are written to a .mt file.
% ./mc script.mt # will execute the script.
Doing:
% ./mc stack.mc #will try to open MC in X and not succeed.

> 
> Maybe I'll have to dig out that SSH Telnet client? Any help from the experts
> out there appreciated...
> 
> David
Andu

Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.




Using stacks in MC CGI scripts: experience of (1)...

2001-04-16 Thread David Bovill

Thanks Andu, 

got it working (with your help). I had made a number of mistakes...

1) The function had a mistake:

function getData
   -- put return & fld 1 into someData
  put return & fld 1 of stack "database" into someData
  return someData
end getData

Basic mistake, but as the script is being used, it had no idea of which
stack the field was in - so a stack reference was needed. However you can
call the functions direct (which is a relief for me 'coz my libraries are
mainly functions). 

Seem to be able to parameters in the expected way. However I've run into a
problem which seems to be to do with the home stack... pretty sure it is not
corrupted or anything as it works locally and I am using the same technique
to transfer it as the other stacks... - I think it is *that* lovely splash
screen -:)

Why would I want to use the home stack - maybe I don't need to, but when
exploring shell commands, I decided to see if I could use MC shell commands
and call them from the CGI...

Stuff like (calling standard shell scripts on Linux serveer):

  -- put shell("whereis sh") after buffer
  -- put return after buffer
  
  -- put shell("whereis mc") after buffer
  -- put return after buffer

  -- put shell("whereis perl") after buffer
  -- put return & return after buffer

Works a treat in the CGI, but when I tried to use MC based scripts...

First I got back that sh (the shell interpreter) couldn't handle it, so I
needed to change the shellCommand...

  -- set the shellcommand to "mc"

to which I get back...

  -- ...mcPath: Can't open display
  -- ...mcPath: Can't load stack or script mchome.mc

Which brings me on th the fact that with the home stack on the server and a
couple of database stacks:

  -- put fld 1 of stack "database" into someData -- works fine
  -- put fld 1 of stack "home" into someData -- gives a server error


So the question I am trying to answer is have I made another silly mistake
or am I running into a brick wall as the home stack will not run on the
server (display issue?) and consequently I won't be able to use MC based
shell scripts?

Maybe I'll have to dig out that SSH Telnet client? Any help from the experts
out there appreciated...

David


Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.