oops!
Sorry I should have really looked more closely - I'd assumed your email
was a follow-up on the webserver script I sent you. Instead I missed that
that really is a CGI script! My comments on quoting still stand.
Using printf in your program should be ok
On Thu, 19 Jan 2006, Jim Jackson wrote:
>
> 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
>
>
>
>
>
>
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/
|