Here is more correct patch tnanking the Anthony's notice.

Sergei
diff -ur athttpd.orig/current/ChangeLog athttpd/current/ChangeLog
--- athttpd.orig/current/ChangeLog      2006-07-21 17:11:54.000000000 +0300
+++ athttpd/current/ChangeLog   2006-07-26 09:16:03.000000000 +0300
@@ -1,3 +1,19 @@
+2006-07-25  Sergei Gavrikov  <[EMAIL PROTECTED]>
+
+       * cdl/httpd.cdl: CYGDAT_NET_ATHTTPD_SERVEROPT_CGIDIR is changed
+       to allow a using of the CGI scripts in Tcl.
+       * doc/athttpd.sgml: Fixed typos.
+       * include/jim.h: The Jim_InitExtension() function is declared
+       as inline against a compiler warning.
+       * src/cgi.c: cyg_httpd_exec_cgi_tcl(): missed in some conditions
+       cyg_ldr_malloc() replaced by malloc() against a compiler error;
+       A prototyping of the ExportedJimCreateInterp removed.
+       * src/forms.c: cyg_httpd_handle_method_POST(): allowed a using
+       the Tcl scripts.
+       * src/httpd.c: cyg_httpd_handle_method_GET(): Ditto.
+       * src/socket.c: cyg_httpd_daemon(): debug message added that
+       points out the Tcl has been initialized.
+
 2006-07-19  Anthony Tonizzo  <[EMAIL PROTECTED]>
 
        * src/socket.c: Corrected a typo that generated an assertion.
diff -ur athttpd.orig/current/cdl/httpd.cdl athttpd/current/cdl/httpd.cdl
--- athttpd.orig/current/cdl/httpd.cdl  2006-07-18 19:37:23.000000000 +0300
+++ athttpd/current/cdl/httpd.cdl       2006-07-25 12:48:23.000000000 +0300
@@ -130,7 +130,7 @@
       
       cdl_option CYGDAT_NET_ATHTTPD_SERVEROPT_CGIDIR {
           display "cgi-bin directory"
-          active_if    { 0 != CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER }
+          active_if    { 0 != CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER || 0 != 
CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL }
           flavor data
           default_value {"\"cgi-bin/\""}
           description "This is the path, relative to 
CYGDAT_NET_ATHTTPD_SERVEROPT_ROOTDIR,
diff -ur athttpd.orig/current/doc/athttpd.sgml athttpd/current/doc/athttpd.sgml
--- athttpd.orig/current/doc/athttpd.sgml       2006-07-20 10:20:56.000000000 
+0300
+++ athttpd/current/doc/athttpd.sgml    2006-07-25 10:56:00.000000000 +0300
@@ -106,7 +106,7 @@
 inside the body of the callback function.

 

 The following is an example of how to add a callback to a function myForm()

-whenever the /myform.gci is called.

+whenever the /myform.cgi is called.

 </para>
 
 <programlisting width=72>
@@ -336,7 +336,7 @@
 form variable called foo, and during the GET request we are defining foo
 as being "1":</para>
 
-<programlisting width=72>GET /myForm.gci?foo=1</programlisting>
+<programlisting width=72>GET /myForm.cgi?foo=1</programlisting>
 
 <para>then tcl will be able to access the variable foo as $foo.</para>
 
diff -ur athttpd.orig/current/include/jim.h athttpd/current/include/jim.h
--- athttpd.orig/current/include/jim.h  2006-07-18 19:37:24.000000000 +0300
+++ athttpd/current/include/jim.h       2006-07-25 11:26:27.000000000 +0300
@@ -798,7 +798,7 @@
 
 #if defined JIM_EXTENSION || defined JIM_EMBEDDED
 /* This must be included "inline" inside the extension */
-static void Jim_InitExtension(Jim_Interp *interp)
+static __inline__ void Jim_InitExtension(Jim_Interp *interp)
 {
   Jim_GetApi = interp->getApiFuncPtr;
 
diff -ur athttpd.orig/current/src/cgi.c athttpd/current/src/cgi.c
--- athttpd.orig/current/src/cgi.c      2006-07-18 19:37:24.000000000 +0300
+++ athttpd/current/src/cgi.c   2006-07-26 08:45:59.000000000 +0300
@@ -179,7 +179,7 @@
         return 0;
     }
     
-    char* tcl_buffer = (char*)cyg_ldr_malloc(sp.st_size);
+    char* tcl_buffer = (char*)malloc(sp.st_size);
     CYG_ASSERT(tcl_buffer != NULL, "Cannot malloc() for tcl CGI");
     if (tcl_buffer == NULL)
     {
@@ -210,7 +210,6 @@
     return 0;
 }
 
-Jim_Interp *ExportedJimCreateInterp(void);
 static void Jim_InitEmbedded(void) {
     Jim_Interp *i = ExportedJimCreateInterp();
     Jim_InitExtension(i);
@@ -304,7 +303,7 @@
 #ifdef CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL
     if ( strcmp(extension, CYG_HTTPD_DEFAULT_CGIBIN_TCL_EXTENSION) == 0)
     {
-        // Load a cgibin via OBJLOADER.
+        // Load a cgibin via TCL.
         cyg_int32 rc = cyg_httpd_exec_cgi_tcl(file_name);
         return rc;
     }    
diff -ur athttpd.orig/current/src/forms.c athttpd/current/src/forms.c
--- athttpd.orig/current/src/forms.c    2006-07-18 19:37:24.000000000 +0300
+++ athttpd/current/src/forms.c 2006-07-25 12:30:32.000000000 +0300
@@ -214,7 +214,7 @@
         return;
     }
 
-#ifdef CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER
+#if defined(CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER) || 
defined(CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL)
     // If we did not find a c language callback handler for this URL see if
     //  we are trying to execute a CGI via the OBJLOADER package.
     if (httpstate.url[0] == '/' &&
diff -ur athttpd.orig/current/src/http.c athttpd/current/src/http.c
--- athttpd.orig/current/src/http.c     2006-07-18 19:37:24.000000000 +0300
+++ athttpd/current/src/http.c  2006-07-25 12:29:42.000000000 +0300
@@ -722,7 +722,7 @@
 #endif        
     }
     
-#ifdef CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER
+#if defined(CYGOPT_NET_ATHTTPD_USE_CGIBIN_OBJLOADER) || 
defined(CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL)
     // If the URL is a CGI script, there is a different directory...
     if (httpstate.url[0] == '/' &&
                     !strncmp(httpstate.url + 1, 
diff -ur athttpd.orig/current/src/socket.c athttpd/current/src/socket.c
--- athttpd.orig/current/src/socket.c   2006-07-21 17:11:56.000000000 +0300
+++ athttpd/current/src/socket.c        2006-07-26 09:18:46.000000000 +0300
@@ -336,6 +336,9 @@
 
 #ifdef CYGOPT_NET_ATHTTPD_USE_CGIBIN_TCL
     cyg_httpd_init_tcl_interpreter();
+#if CYGOPT_NET_ATHTTPD_DEBUG_LEVEL > 0
+    diag_printf("Tcl interpreter has been initialized...\n");
+#endif
 #endif    
     
     cyg_httpd_initialize();

Reply via email to