ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: how to request 7250 execute command from external web

To:
Subject: Re: [ts-7000] Re: how to request 7250 execute command from external web browser?
From: Jim Jackson <>
Date: Thu, 19 Jan 2006 11:15:13 +0000 (GMT)
On Wed, 18 Jan 2006, Onur T wrote:

> Hi,
>
>   I have a question about this thread. I have a simple cgi script as follows:
>
>   ------>
>   #!/bin/sh
>   # disable filename globbing
>   set -f
>   echo Content-type: text/plain
>   echo
>   echo CGI/1.0 test script report:
>   echo
>
>   echo argc is $#. argv is "$*".
>   echo
>
>   echo MY PROGRAM
>   stest
>   -------------->
>
>   My problem is While my program stest is called in this script and it
> runs, the output of the program is never displayed on the webpage. Why
> is that? Is it because I am using printfs in my program that I don't see
> the output?

check the script I attached and checkout what it does, it does things for
reasons :-)

Also you need to learn soem sh scripting - there are tons on quick
tutorials on the web - google is your friend.

1) It is always best to quote the string you want echo to write, that
stops sh from globbing and, aqnd depending on whether you use ' or "
prevents sh from doing other stuff as well (like interpeting '>' etc as
stdout etc redirection.

2) The http standard defines the use of CRLF as an end of line - by
default Unix uses LF, hence

 echo -e "Content-type: text/plain\r"

makes echo interpret '\X' sequences and '\r' is a CR

3) You haven't given complete HTTP response headers - again check the
script I attached - it's pretty self explanatory and easily edited and
adapted.


>
>   How can I interface the output of my program to the cgiscript without
> having to write to files.

as long as your program writes to stdout, then just run the program and
the output gets included in the data stream of the HTTP response.

>   Also is there an easier way to do this? i.e. have the output of C
> programs in an html document?

and finally ....

Just so there is no confusion, you say "cgi script" - this is not correct,
it's a web server script :-)  Do not run the script as an apache cgi
program, run it from inetd by configuring inetd.conf etc

Jim

p.s. If you need consultancy on this, I can let you have my rates :-)


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU