Environment variables

I am [attempting] to write a couple of
programs for use on a (Linux/Apache) web
server thru cgi. Does anyone have
experience with doing this? I used to
program in Pascal a while ago and, after
becoming extremely annoyed with the way C
handles strings, I thought it would be a
brilliant wheeze to use gpc instead.
However, I am not sure how to access the
environment variables, such as HOST_ADDRESS
and QUERY_STRING, that are necessary in cgi
programming. Everybody seems to do their
cgi programming in C and Perl, not Pascal.
Well... any help would be appreciated.

ta,
hJm