comp.lang.ada
 help / color / mirror / Atom feed
From: dbask <dbask@enztecNOS.PAMorg>
Subject: Re: cgi in turbo pascal or freepascal in windows 95
Date: 2000/05/13
Date: 2000-05-13T13:02:55+00:00	[thread overview]
Message-ID: <391D527C.AED6AAA8@enztecNOS.PAMorg> (raw)
In-Reply-To: 391BA598.A750AD0A@enztecNOS.PAMorg

dbask wrote:
> 
> Could someone please post some simple code in turbo pascal or
> freepascal that will do cgi in windows 95?
> 
> Thank you

I had a need for a 'Hello World!' level cgi program and I wanted to use
pascal (turbo pascal, freepascal and console delphi pascal dialect)
because of pascal's great string handling functions, ease of programming
and small and fast exe's. All of which make it a great programming
language for use in cgi programming.

The first 'Hello World!' cgi program I compiled was the following Turbo
C++ code I recieved in an IRC channel :

#include <iostream> 
int main() 
{
cout << "Content-type: text/html\n\n <html><body><p>Hello
World!</p></body></html>";
return 0;
}


I translated it into the following turbo pascal, freepascal and console
delphi pascal dialect 'Hello World!' cgi program :

program cgi1;
const nl = chr(13) + chr(10);
begin
write('Content-type: text/html',nl,nl);
write('<html><body>');
write('<p>Hello World!</p>');
write('</body></html>');
end.


Then into the following ADA 'Hello World' cgi program :

With Text_IO; Use Text_IO;
Pragma RangeCheck(off); Pragma Debug(off); Pragma Arithcheck(Off);
Procedure cgi1 Is
Begin
Put("Content-type: text/html"); New_Line; New_Line;
Put("<html><body>");
Put("<p>Hello World!</p>");
Put("</body></html>");
End cgi1;


The Html code that calls the cgi is :

<!-html for cgi->
<HTML>
<BODY>
<TITLE>CGI Example</TITLE>
<H1>CGI Example</H1>
<FORM ACTION="/cgi-bin/cgi1.exe" METHOD="POST">
<INPUT TYPE="submit" VALUE="Press Here">
</FORM>
</BODY>
</HTML>

Of course these programs are completely stripped down stdin/stdout
programs, but that is all that is needed for a starting cgi program.

A cgi 'Hello World' program is very useful to test whether the web
server is set up properly, the internet and computer systems are
functioning as needed, as well as a 'first program' on which to begin
with and gain cgi programming confidence.

Thank you to Jonas Maebe, Garry Wood, and Marco van de Voort for
replying to my inquiry. 

With freepascal running on both Windows and Linux it is the way to go.




       reply	other threads:[~2000-05-13  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <391BA598.A750AD0A@enztecNOS.PAMorg>
2000-05-13  0:00 ` dbask [this message]
2000-05-15  0:00   ` cgi in turbo pascal or freepascal in windows 95 sking9999
2000-05-15  0:00     ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox