Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
I've only recently started exploring options for real CGI work in RetroForth. (At this point I'm using a combined bash shell script and the development builds of RetroForth 8.3 (see http://rf.fcode.org/get -- the development builds help because they support the command line arguments)
Anyway, a very simple example script:
#!/bin/bash echo Content-type: text/html echo /path/to/rf $1 bye If this was in your "cgi-bin" directory as "simple.fs", you could test it with:
http://server.com/cgi-bin/simple.fs?words The example script will evaluate the first command line option as a forth word. I'd recommend that you not use this script on a public server as it could be abused, but it does show the basic concept.
The binary will provide a couple of command line related words (cmdline and #args ) which return a pointer to the command line and the number of arguments on the command line. Processing that data is up to your code though... (Note that RetroForth will evaluate the command line that's passed to it. Use something like:
/path/to/rf -f myscript.forth ( .... actual data you want to process in your app .... ) bye
Or:
/path/to/rf -f myscript.forth bye .... actual data you want to process in your app .... To load and run "myscript.forth". You'll need to locate where your data starts in the command line and then proceed from there.
I hope this helps somewhat.
|