Thanks for replying. I fixed my
error and added the “Content-type”
statement (forgot about that one). I am still getting the same result
on Netscape, however. Any other ideas?
You also mentioned that you are using apache. What version are you
using? I am currently trying out apache myself and downloaded the
binary distribution from the Apache website for QNX (ie.
apache_1.3.9-PCI-qssl-qnx32.tar.gz). I would be interested in learning
what you did, in terms of whether you just used a binary distribution or
whether you compiled the code yourself.
Rodney Lott
John Uff wrote:
I’m using apache not slinger but one problem is the lack of a header
defining a mime-type, followed by at least one blank line to separate it
from the document… I’m suprised your getting anything, IE would have choked
on it.
something like:
printf(“Content-type: text/html\n\n”);
which goes before your <html
you’ve got an unmatched
in there too (char *test=“This is a
test.”; ) which might confuse things
John Uff
juff@fax.co.uk
http://fax.co.uk > The UK’s Email to Fax gateway
“Rodney Lott” <> rod@fuelcelltechnologies.ca> > wrote in message
news:> 39BD2D30.E7F3B785@fuelcelltechnologies.ca> …
Hello.
I have been trying to write a CGI bin script, written in C, which will
work with slinger. My index file is as follows:
html
head
title>Test Page for QNX4 Slinger</title
/head
body
p>This is a test page for the QNX Slinger Web Server.</p
a href="/cgibin/myecho?name=test">Click here to run CGI script.</a
/body
/html
My CGI program written in C is:
#include <stdio.h
#include <stdlib.h
#include <string.h
main(int argc, char *argv[])
char *test=“This is a test.
”;
fprintf(stdout,"");
fprintf(stdout,"");
fprintf(stdout,“
Query Results
”);
fprintf(stdout,getenv(“QUERY_STRING”) );
fprintf(stdout,“Test String = %s.\n”, test);
fprintf(stderr, “
End of example.
”);
fprintf(stdout,"");
fprintf(stdout,"");
return;
}
When I click on the reference to the CGI script from the test page in my
Netscape browser, the script executes and I see the title, displayed in
H1 format but the stuff following the title shows as follows:
blank line where the QUERY_STRING should have displayed
Test string = %s.\n
miscallaneous characters and garble
It would appear that the fprintf statements are not substituting the
variables appropriately, since it is just printing the string as is. I
am not sure if this is an inadequacy with slinger or if I am just not
writing the CGI program properly. I copied it from a web page on CGI
scripts, so I believe that it is correct. At least it would appear to
be working. I guess I would be curious to find out how slinger executes
a CGI script from an HTML anchor.
TIA.
Rodney Lott