![]() |
> > I am working on a simple sendpage/web gateway. From the command line, a > simple C program such as: > > execl("/usr/local/bin/sendpage","sendpage.web", "-q", > "-ptony","hello...testing",NULL); > } I don't know why you are using C; a simple shell wrapper should work, something like: #! /bin/sh echo "Status: 200 OK" # strictly should be pending not OK code # but I don't have the HTTP spec to hand echo "Content-Type: text/html" echo echo "<HTML><HEAD><TITLE>Tony's Page Request Acceptance Page</TITLE>" echo "</HEAD><BODY><H1>Page Accepted</H1>Your page request has be queued" echo "for transmission.</BODY></HTML>" exec /usr/local/bin/sendpage -q -ptony "hello...testing" > /dev/null # sendpage command not verified You could use text/plain and return the actual response from sendpage. To include it in HTML, you will need to bracket it in <PRE></PRE> and translate & < > and possibly " into entities (e.g. use sed). You might want to look at the cgiparse utility that comes with the CERN server. > However, if I put the execl line into a C program and run as a cgi on a web > server, it bombs with a server error. A valid CGI program must output at least "Location: url" or "Content-Type: xxx/yyy" followed by a blank line. "Status: 204 No output" ought also to be OK, again followed by a blank line. > > I can only assume that perhaps the output of sendpage (lots of texts) is > the problem since the return value exec* is expecting is an int. I don't The output from sendpage is on standard output, or possibly standard error. It ALSO returns an int return code. Note that the above is telling you the requirements for a CGI script - it is possible that sendpage has other requirements on its environment.