I'm sorry, but I have to make yet another post about this,
the last one, with the final version. I'll make it short:

(1) install fgexec in the PATH  (e.g. ~/bin/)
(2) copy exec.nas to ~/.fgfs/Nasal/
(3) run "fgexec" (or "fgexec start") before running fgfs,
    and "fgexec stop" after finishing it.

You can also just put fgexec in ~/.bashrc and never stop it,
if you don't mind the script occupying memory. It won't use
(m?)any cycles if there's no command to execute. You can also
run "fgexec" several times without ever stopping it. You may
want to define an alias:

  alias fgfs="fgexec; fgfs; fgexec stop"

That's all. No need to create the FIFO ("named pipe")
manually. There's still only "openurl" implemented, as well
as a command "stop" that terminates fgexec (same as "fgexec
stop" from the command line). Of course, if you feel adventurous,
you can replace the case/esac by just "eval $cmd $args". Then
you don't have to hard-code a list of supported commands, and
can do things like  exec("rm -rf ~");  without extra work.  ;-)

m.

Attachment: fgexec
Description: application/shellscript

var fifo = getprop("/sim/fg-home") ~ "/Export/exec.fifo";
if ((var stat = io.stat(fifo)) == nil or !io.isfifo(stat[2]))
        die(fifo ~ " missing or not a FIFO. Run fgexec first!");


globals.exec = func {
        var f = io.open(fifo, "w");
        io.write(f, call(sprintf, arg) ~ "\n");
        io.close(f);
}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to