i'm trying run a cgi script from a c program using execve(). It seems to be able to open and run the cgi file. but instead of actually generating graphical html it generates html code. example: execve("this.cgi", NULL, NULL)
will generate:
/this.cgi
/this.cgi
<html>
. . . the rest of the html code
I can't figure out why this is.
int status;
pid_t pid;
pid = fork();
dup2(fileno(fp), 1);
dup2(fileno(fp), 2);
close(fileno(fp));
char dot_slash[] = "./";
char *dsPtr = dot_slash;
strcat(dsPtr, file_name);
puts(dsPtr);
char *arg[1];
arg[0] = NULL;
//arg[1] = NULL;
execve(dsPtr, arg, NULL);
thanks