From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_40,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10261c,509328845dc85b2e X-Google-Attributes: gid10261c,public X-Google-Thread: 111659,509328845dc85b2e X-Google-Attributes: gid111659,public X-Google-Thread: 10baee,443ef81d0a810cc1,start X-Google-Attributes: gid10baee,public X-Google-Thread: 103376,443ef81d0a810cc1,start X-Google-Attributes: gid103376,public From: dbask Subject: Re: cgi in turbo pascal or freepascal in windows 95 Date: 2000/05/13 Message-ID: <391D527C.AED6AAA8@enztecNOS.PAMorg>#1/1 X-Deja-AN: 622919985 Content-Transfer-Encoding: 7bit References: <391BA598.A750AD0A@enztecNOS.PAMorg> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@xmission.com X-Trace: news.xmission.com 958222975 23303 166.70.167.172 (13 May 2000 13:02:55 GMT) Organization: enztec.|org Mime-Version: 1.0 NNTP-Posting-Date: 13 May 2000 13:02:55 GMT Newsgroups: comp.lang.pascal.borland,comp.lang.pascal.misc,comp.lang.pascal.delphi.misc,comp.lang.ada Date: 2000-05-13T13:02:55+00:00 List-Id: 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 int main() { cout << "Content-type: text/html\n\n

Hello World!

"; 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(''); write('

Hello World!

'); write(''); 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(""); Put("

Hello World!

"); Put(""); End cgi1; The Html code that calls the cgi is : CGI Example

CGI Example

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.