I now need to compile a simple C program that allows form processing and email the results via ssmtp/sendmail. This program as written works in standard linux and I have compiled simple C programs that execute via a telnet shell, like the simple "Hello World" program. I also wrote a very simple program that when executed as a CGI program on a standard linux machine would produce a basic webpage, but not on the openwrt. Here is the code:
#include <stdio.h>
int main ( void )
{
printf("Content-type: text/htmlnn");
printf("<html>n");
printf("n");
printf("<head>n");
printf("</head>n");
printf("<body>n");
printf("this is a test");
printf("</body>n");
printf("</html>n");
return(1);
}
This code does compile using the following commandline string:
/var/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-uclibc-gcc test.c -mips2 -Os -fomit-frame-pointer -o test.cgi
And when executed at the command line produces the desired results. When executed from appWeb via the CGI interface it returns the following line in the error.log file:
default:1 Error: 503 "Service Unavailable" for "/cgi-bin/test.cgi", file "/web/cgi-bin/test.cgi": CGI process /cgi-bin/test.cgi: exited abnormally with exit code
So my question is that maybe this type of CGI script is not allowed by appWeb or that i need to use fprintf and redirect the pointer to the right location so that the output is displayed by the CGI interface.
Any help would be appreciated
bob