Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
51 user(s) are online (34 user(s) are browsing Forums)

Members: 0
Guests: 51

more...

Headlines

 
  Register To Post  

calling rexx not from inside C-ish system()
Quite a regular
Quite a regular


See User information
Intro:
I am porting LaTeX. LaTeX uses automatic font generation system where if the font is missing, it is created on-the-fly if possible.
The creation is done via system() call and in most cases the ones that are called by system() are shell (sh) scripts.
This works well on *nix where "x" permissions make shell scripts to behave as "propper executable". On Amiga this doesn't work.
I tried to outsmart the system and created an AREXX script with the same name and inside AOS path. The AREXX script calls its brother sh script with the same name and passes all the arguments.
system() doesn't recognize the rexx script as an "executable".


The questions is:
Will system() run AmigaDOS script?
If yes, how can all the arguments inside AmigaDOS script be parsed into a single variable without prior knowledge of the exact number of arguments?
Are there other mechanisms I can use to wrap the shell sctript for execution from inside C?

Thanks in advance
Jack


Edited by Jack on 2007/10/24 23:32:19
Resized Image
"the expression, 'atonal music,' is most unfortunate--it is on a par with calling flying 'the art of not falling,' or swimming 'the art of not drowning.'. A. Schoenberg
Go to top
Re: calling rexx not from inside C-ish system()
Just can't stay away
Just can't stay away


See User information
@Jack

Quote:
system() doesn't recognize the rexx script as an "executable".
If the 's' protection bit of the ARexx script is set it should work.

Go to top
Re: calling rexx not from inside C-ish system()
Quite a regular
Quite a regular


See User information
@joerg

Thanks, does the job. I was I added the "s" bit, but appers it wasn't there...


Jack

Resized Image
"the expression, 'atonal music,' is most unfortunate--it is on a par with calling flying 'the art of not falling,' or swimming 'the art of not drowning.'. A. Schoenberg
Go to top
Re: calling rexx not from inside C-ish system()
Amigans Defender
Amigans Defender


See User information
@Jack
If you want to avoid relying on the 's' bit you can also do things like this instead:
Execute <AmigaDOS script>
and
sh <Bourne script>

That way you don't care if the 's' bit is set or not because it will always be executed by the appropriate interpretor.

ExecSG Team Lead
Go to top
Re: calling rexx not from inside C-ish system()
Quite a regular
Quite a regular


See User information
@ssolie

Quote:

If you want to avoid relying on the 's' bit you can also do things like this instead:
Execute <AmigaDOS script>
and
sh <Bourne script>


Can't do it here. The problem that is system() calls different types of files, scripts and executables, according to sircumstances.

Another question:
does anyone knows where does abc-shell look for startup file on Amiga and what's its name? (meanwhile gone to c rtmf if there's any)

TIA,
Jack


Edit: oops, go->gone


Edited by Jack on 2007/10/25 15:10:25
Resized Image
"the expression, 'atonal music,' is most unfortunate--it is on a par with calling flying 'the art of not falling,' or swimming 'the art of not drowning.'. A. Schoenberg
Go to top
Re: calling rexx not from inside C-ish system()
Amigans Defender
Amigans Defender


See User information
@Jack
Quote:
Can't do it here.

So I take it you tried "system("Execute myscript");" and it didn't work? I find that very surprising.

ExecSG Team Lead
Go to top
Re: calling rexx not from inside C-ish system()
Quite a regular
Quite a regular


See User information
@ssolie

Quote:

So I take it you tried "system("Execute myscript");" and it didn't work? I find that very surprising.


Gimme some credit
LateX uses kpathsea library (part of LaTeX) that searches files and can generates (compiles) the missing files "on-the-fly".
Usually these are fonts, there's no sence to store bitmaps of all the fonts for all resolutions/modes on the disk, so it has their "sources" (in vector format afair) and compiles the bitmaps for the requested reoslution/mode/etc when they are requested for the first time and then caches them instead of directly using them (was sensible when system weren't that fast).
So there's a generic function that calls the system(), and I don't want to change the sources much, so I'm trying to make it call the script directly using the "s" bit as per Joerg's post.
Meanwhile I need that "sh" instance to have all the latex-related env and PATH sruff to be intact.
So I tried to create a directory included in the Amiga path that has the scripts with the same names as ones called by system() that call the appropriate sh scritps or whatever using:

/*rexx*/
parse arg args
parse source junk junk me junk
me=translate(me, " ", "/:")
me=word(me, words(me))
'sh -c ". /tetex/setup; teTeX:bin/powerpc-unknown-amigaos/'me args' " '

Meanwhile it refuses to do what I want it to

Jack

Resized Image
"the expression, 'atonal music,' is most unfortunate--it is on a par with calling flying 'the art of not falling,' or swimming 'the art of not drowning.'. A. Schoenberg
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project