[Xitami] #exec cmd= in Win XP
Marc Doigny
xitami@lists.xitami.org
Thu, 11 Dec 2003 21:09:09 +0100
At 20:03 11/12/03, "Charles Duval" <ch_duval@hotmail.com> wrote:
To begin with, just create a simple executable that displays the time.
If it can do that, you can go further.
> shell "c:\windows\system32\xcopy.exe d:\xitami\toramdsk\*.* r:\ /e
>/y /h /d"
tmp$ = ENVIRON$("TEMP") to locate the temp directory.
You can also hard-code it.
cmd$ = ENVIRON$("COMSPEC") to locate the command interpreter directory
SHELL cmd$ + " /c c:\windows\system32\xcopy .... >>" + tmp$ + "\xxx.tmp"
Xitami evokes executables in the console subsystem (an empty space), while
running a program from the command prompt actually runs the program as an
argument of the command interpreter (that is, the command interpreter is
always available in command prompt mode)
You have to specify where the output goes.
Simply printing it to screen won't work - Xitami does not display a console
screen, it can even cause your application to fail, waiting for a screen to
print to that never is available.
fileout$ = ENVIRON$("CGI_STDOUT") that's the file Xitami is expecting
DIM file AS QFileStream
File.Open(fileout$, fmOpenWrite)
File.Write("<html><body>Copying files to Ramdisk<pre>")
Now add the content of tmp$ + "\xxx.tmp" to the output stream (don't know
how to do that in this dialect)
Seems you can only have one stream open at any given moment.
and terminate:
File.Write("</pre>FINISHED</body></html>")
File.Close
Basically, Xitami is just a fileserver. Whenever a user request a page,
Xitami delivers it using the correct protocols. When the requested page is
a CGI,
Xitami sets some environment variables,
calls the application,
waits for it to terminate,
send the generated output (a file) to the user.
RapidQ is an interpreted language, meaning it's not well suited for cgi
applications.
Each time your application is started, it must be compiled before execution.
Not very important for desktop applications (these applications are only
started once a day and the user can wait some seconds), but of great
importance if you have a web site that relies on cgi.