#!/bin/sh
echo "Location: http://www.cs.put.poznan.pl"
echo
#!/bin/sh
echo "Content-Type: text/html"
echo
echo "<html><body>"
echo "<p>"
x=`cat count.txt` || x=1
echo "$x"
x=`expr $x + 1`
echo $x > count.txt
echo "</body></html>"
#!/usr/bin/perl
print "Content-Type: text/html\n\n"
print <<koniec;
<html>
<body>
<h1>Przykład</h1>
</body>
</html>
koniec
#include <stdio.h>
#include "cgi-util.h"
int main(int argc, char * argv[])
{
int res;
char* nazwisko;
char* imie;
res = cgi_init();
printf("Content-type: text/html\n\n");
if (res != CGIERR_NONE)
{
printf("Error # %d: %s<p>\n", res, cgi_strerror(res));
exit(0);
}
nazwisko = (char*)cgi_getentrystr("nazwisko");
imie = (char*)cgi_getentrystr("imie");
printf("<h1>Odczyt parametrów</h1>\n");
printf("<p>Nazwisko=%s\n", nazwisko);
printf("<p>Imię=%s\n", imie);
cgi_quit();
return(0);
}
Do kompilacji potrzebna jest biblioteka cgi-util, dostępna lokalnie jako pliki: cgi-util.c i cgi-util.h.