remove dos eols
[catagits/fcgi2.git] / doc / fastcgi-prog-guide / ch4tcl.htm
index 8b78544..9a5f652 100755 (executable)
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">\r
-<HTML>\r
-   <HEAD>\r
-      <TITLE>\r
-         FastCGI Programmer&#39;s Guide - Chapter 4, Developing FastCGI Applications in Tcl\r
-      </TITLE>\r
-<STYLE TYPE="text/css">\r
- body {\r
-  background-color: #ffffff;\r
- }\r
- li.c2 {list-style: none}\r
- div.c1 {text-align: center}\r
-</STYLE>\r
-   </HEAD>\r
-   <BODY>\r
-      <A HREF="cover.htm">[Top]</A> <A HREF="ch3perl.htm">[Prev]</A> <A HREF="apaman.htm">[Next]</A> <A HREF=\r
-      "ap_guida.htm">[Bottom]</A> \r
-      <HR>\r
-      <BR>\r
-       <A NAME="3659"></A>\r
-      <DIV CLASS="c1">\r
-         <H1>\r
-            4 Developing FastCGI<BR>\r
-            Applications in Tcl\r
-         </H1>\r
-      </DIV>\r
-      <A NAME="4835"></A>\r
-      <P>\r
-         This chapter explains how to code FastCGI applications in Tcl. Prior to creating a FastCGI application, you\r
-         must have a FastCGI-savvy version of the Tcl interpreter. Open Market develops Tcl binaries for popular\r
-         platforms and makes them available with our developer&#39;s kit.\r
-      </P>\r
-      <P>\r
-         <A NAME="4943"></A> The FastCGI-savvy binaries are extensions of standard Tcl, and are intended to replace\r
-         your existing Tcl installation. There is no need to maintain two versions of Tcl: the version that we supply\r
-         will work fine when invoked from a shell or a CGI program. There are also directions in the developer&#39;s\r
-         kit for how to make your own FastCGI-savvy Tcl, if you need a version for some platform that we don&#39;t\r
-         supply.\r
-      </P>\r
-      <P>\r
-         <A NAME="4221"></A> In many cases, you can convert a Tcl script from CGI to FastCGI by adding a few lines of\r
-         code to an existing script. For more complex scripts, you may also need to rearrange some existing code.\r
-      </P>\r
-      <BR>\r
-      <BR>\r
-      <H1>\r
-         Getting Started\r
-      </H1>\r
-      <A NAME="4223"></A>\r
-      <P>\r
-         The first line of any Tcl script typically specifies the pathname of the Tcl interpreter itself. You must\r
-         specify the pathname of a FastCGI-savvy Tcl.\r
-      </P>\r
-      <P>\r
-         <A NAME="4226"></A> Then, you have to divide FastCGI scripts into the following two sections:\r
-      </P>\r
-      <BR>\r
-      <BR>\r
-      <UL>\r
-         <LI CLASS="c2">\r
-            <A NAME="4227"></A>\r
-         </LI>\r
-         <LI>\r
-            Initialization section, which is executed only once. <A NAME="4228"></A>\r
-         </LI>\r
-         <LI>\r
-            Response loop section, which gets executed every time the FastCGI script gets called.\r
-         </LI>\r
-      </UL>\r
-      <A NAME="4229"></A>\r
-      <P>\r
-         A response loop typically has the following format:\r
-      </P>\r
-      <BR>\r
-      <BR>\r
-<PRE>\r
-<A NAME="4923">while {[FCGI_Accept] &gt;= 0 } {\r
-</A>\r
-<A NAME="4925"># body of response loop\r
-</A>\r
-<A NAME="4367">}\r
-</A>\r
-</PRE>\r
-      <A NAME="4233"></A>\r
-      <P>\r
-         The <CODE>FCGI_Accept</CODE> call returns 0 whenever a client requests the FastCGI script. Otherwise, the\r
-         <CODE>FCGI_Accept</CODE> call returns -1.\r
-      </P>\r
-      <BR>\r
-      <BR>\r
-      <H1>\r
-         Example: TinyFastCGI\r
-      </H1>\r
-      <A NAME="4343"></A>\r
-      <P>\r
-         Here is a simple example of a FastCGI application written in Tcl:\r
-      </P>\r
-      <BR>\r
-      <BR>\r
-<PRE>\r
-<A NAME="4344"></A>\r
-#!fcgi-savvy-tcl\r
-\r
-set count 0\r
-\r
-# Response Loop\r
-while {[FCGI_Accept] &gt;= 0 } {\r
-        incr count\r
-        puts -nonewline &quot;Content-type: text/html\r\n\r\n&quot;\r
-        puts &quot;&lt;title&gt;FastCGI Hello! (Tcl)&lt;/title&gt;&quot;\r
-        puts &quot;&lt;h1&gt;FastCGI Hello! (Tcl)&lt;/h1&gt;&quot;\r
-        puts &quot;Request number $count running on host  &lt;i&gt;$env(SERVER_NAME)&lt;/i&gt;&quot;\r
-}\r
-</PRE>\r
-      <P>\r
-      </P>\r
-      <HR>\r
-      <BR>\r
-       <A HREF="cover.htm">[Top]</A> <A HREF="ch3perl.htm">[Prev]</A> <A HREF="apaman.htm">[Next]</A> <A HREF=\r
-      "ap_guida.htm">[Bottom]</A> \r
-      <HR>\r
-      <BR>\r
-       <!-- This file was created with Quadralay WebWorks Publisher 3.0.3 -->\r
-      <!-- -->\r
-      <!-- For more information on how this document, and how the rest of -->\r
-      <!-- this server was created, email yourEmail@xyzcorp.com -->\r
-      <!-- -->\r
-      <!-- Last updated: 04/15/96 08:00:19 -->\r
-   </BODY>\r
-</HTML>\r
-\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+   <HEAD>
+      <TITLE>
+         FastCGI Programmer&#39;s Guide - Chapter 4, Developing FastCGI Applications in Tcl
+      </TITLE>
+<STYLE TYPE="text/css">
+ body {
+  background-color: #ffffff;
+ }
+ li.c2 {list-style: none}
+ div.c1 {text-align: center}
+</STYLE>
+   </HEAD>
+   <BODY>
+      <A HREF="cover.htm">[Top]</A> <A HREF="ch3perl.htm">[Prev]</A> <A HREF="apaman.htm">[Next]</A> <A HREF=
+      "ap_guida.htm">[Bottom]</A> 
+      <HR>
+      <BR>
+       <A NAME="3659"></A>
+      <DIV CLASS="c1">
+         <H1>
+            4 Developing FastCGI<BR>
+            Applications in Tcl
+         </H1>
+      </DIV>
+      <A NAME="4835"></A>
+      <P>
+         This chapter explains how to code FastCGI applications in Tcl. Prior to creating a FastCGI application, you
+         must have a FastCGI-savvy version of the Tcl interpreter. Open Market develops Tcl binaries for popular
+         platforms and makes them available with our developer&#39;s kit.
+      </P>
+      <P>
+         <A NAME="4943"></A> The FastCGI-savvy binaries are extensions of standard Tcl, and are intended to replace
+         your existing Tcl installation. There is no need to maintain two versions of Tcl: the version that we supply
+         will work fine when invoked from a shell or a CGI program. There are also directions in the developer&#39;s
+         kit for how to make your own FastCGI-savvy Tcl, if you need a version for some platform that we don&#39;t
+         supply.
+      </P>
+      <P>
+         <A NAME="4221"></A> In many cases, you can convert a Tcl script from CGI to FastCGI by adding a few lines of
+         code to an existing script. For more complex scripts, you may also need to rearrange some existing code.
+      </P>
+      <BR>
+      <BR>
+      <H1>
+         Getting Started
+      </H1>
+      <A NAME="4223"></A>
+      <P>
+         The first line of any Tcl script typically specifies the pathname of the Tcl interpreter itself. You must
+         specify the pathname of a FastCGI-savvy Tcl.
+      </P>
+      <P>
+         <A NAME="4226"></A> Then, you have to divide FastCGI scripts into the following two sections:
+      </P>
+      <BR>
+      <BR>
+      <UL>
+         <LI CLASS="c2">
+            <A NAME="4227"></A>
+         </LI>
+         <LI>
+            Initialization section, which is executed only once. <A NAME="4228"></A>
+         </LI>
+         <LI>
+            Response loop section, which gets executed every time the FastCGI script gets called.
+         </LI>
+      </UL>
+      <A NAME="4229"></A>
+      <P>
+         A response loop typically has the following format:
+      </P>
+      <BR>
+      <BR>
+<PRE>
+<A NAME="4923">while {[FCGI_Accept] &gt;= 0 } {
+</A>
+<A NAME="4925"># body of response loop
+</A>
+<A NAME="4367">}
+</A>
+</PRE>
+      <A NAME="4233"></A>
+      <P>
+         The <CODE>FCGI_Accept</CODE> call returns 0 whenever a client requests the FastCGI script. Otherwise, the
+         <CODE>FCGI_Accept</CODE> call returns -1.
+      </P>
+      <BR>
+      <BR>
+      <H1>
+         Example: TinyFastCGI
+      </H1>
+      <A NAME="4343"></A>
+      <P>
+         Here is a simple example of a FastCGI application written in Tcl:
+      </P>
+      <BR>
+      <BR>
+<PRE>
+<A NAME="4344"></A>
+#!fcgi-savvy-tcl
+
+set count 0
+
+# Response Loop
+while {[FCGI_Accept] &gt;= 0 } {
+        incr count
+        puts -nonewline &quot;Content-type: text/html\r\n\r\n&quot;
+        puts &quot;&lt;title&gt;FastCGI Hello! (Tcl)&lt;/title&gt;&quot;
+        puts &quot;&lt;h1&gt;FastCGI Hello! (Tcl)&lt;/h1&gt;&quot;
+        puts &quot;Request number $count running on host  &lt;i&gt;$env(SERVER_NAME)&lt;/i&gt;&quot;
+}
+</PRE>
+      <P>
+      </P>
+      <HR>
+      <BR>
+       <A HREF="cover.htm">[Top]</A> <A HREF="ch3perl.htm">[Prev]</A> <A HREF="apaman.htm">[Next]</A> <A HREF=
+      "ap_guida.htm">[Bottom]</A> 
+      <HR>
+      <BR>
+       <!-- This file was created with Quadralay WebWorks Publisher 3.0.3 -->
+      <!-- -->
+      <!-- For more information on how this document, and how the rest of -->
+      <!-- this server was created, email yourEmail@xyzcorp.com -->
+      <!-- -->
+      <!-- Last updated: 04/15/96 08:00:19 -->
+   </BODY>
+</HTML>
+