int main(void) {
char *data;
long m, n;
printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1", 13, 10);
printf("Multiplication results\n");
printf("Multiplication results
\n");
data = getenv("QUERY_STRING");
if (data == NULL)
printf("Error! Error in passing data from form to script.");
else if (sscanf(data, "m=%ld&n=%ld", &m, &n) != 2)
printf("
Error! Invalid data. Data must be numeric.");
else
printf("
The product of %ld and %ld is %ld.", m, n, m * n);
return 0;
}
```
Пример CGI-программы на C